Skip to content

Commit

Permalink
feat(provider/satellite)!: detect and report loops
Browse files Browse the repository at this point in the history
* BREAKING CHANGE: Adjusted protobuf schema to streamline the detection
  of loops in the satellite network.
  • Loading branch information
isometry committed Apr 1, 2024
1 parent 9e46fae commit b319cc1
Show file tree
Hide file tree
Showing 15 changed files with 414 additions and 206 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ ko-build: protoc generate
generate:
go generate ./...

protoc: pkg/platform_health/platform_health.pb.go pkg/platform_health/platform_health_grpc.pb.go pkg/platform_health/details/tls.pb.go
protoc: pkg/platform_health/platform_health.pb.go pkg/platform_health/platform_health_grpc.pb.go pkg/platform_health/details/detail_loop.pb.go pkg/platform_health/details/detail_tls.pb.go

pkg/platform_health/platform_health.pb.go: proto/platform_health.proto
protoc --go_out=. --go_opt=module=$(MODULE) $<
pkg/platform_health/platform_health_grpc.pb.go: proto/platform_health.proto
protoc --go-grpc_out=. --go-grpc_opt=module=$(MODULE) $<
pkg/platform_health/details/tls.pb.go: proto/detail_tls.proto
pkg/platform_health/details/detail_tls.pb.go: proto/detail_tls.proto
protoc --go_out=. --go_opt=module=$(MODULE) $<
pkg/platform_health/details/detail_loop.pb.go: proto/detail_loop.proto
protoc --go_out=. --go_opt=module=$(MODULE) $<
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ go 1.22.1

require (
github.com/fsnotify/fsnotify v1.7.0
github.com/google/uuid v1.6.0
github.com/mcuadros/go-defaults v1.2.0
github.com/mitchellh/mapstructure v1.5.0
github.com/spf13/cobra v1.8.0
github.com/spf13/viper v1.18.2
github.com/stretchr/testify v1.9.0
github.com/veqryn/slog-context v0.6.0
github.com/veqryn/slog-context v0.7.0
google.golang.org/grpc v1.62.1
google.golang.org/protobuf v1.33.0
helm.sh/helm/v3 v3.14.3
Expand Down Expand Up @@ -63,7 +64,6 @@ require (
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/gosuri/uitable v0.0.4 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
github.com/veqryn/slog-context v0.6.0 h1:RV0DL6SIXwTjKu5hUfZlreitiQ47HG6BA7G/aQINK9A=
github.com/veqryn/slog-context v0.6.0/go.mod h1:E+qpdyiQs2YKRxFnX1JjpdFE1z3Ka94Kem2q9ZG6Jjo=
github.com/veqryn/slog-context v0.7.0 h1:Ne7ajlR6Mjs2rQQtpg8k0eO6krR5wzpareh5VpV+V2s=
github.com/veqryn/slog-context v0.7.0/go.mod h1:E+qpdyiQs2YKRxFnX1JjpdFE1z3Ka94Kem2q9ZG6Jjo=
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb h1:zGWFAtiMcyryUHoUjUJX0/lt1H2+i2Ka2n+D3DImSNo=
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
Expand Down
9 changes: 6 additions & 3 deletions pkg/commands/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"path/filepath"
"strconv"

"github.com/google/uuid"
"github.com/spf13/cobra"
"github.com/spf13/viper"

Expand Down Expand Up @@ -95,6 +96,8 @@ func serve(c *cobra.Command, args []string) error {

slog.Info("listening", "address", address)

serverId := uuid.New().String()

opts := []server.Option{}
if !noGrpcHealthV1 {
opts = append(opts, server.WithHealthService())
Expand All @@ -103,7 +106,7 @@ func serve(c *cobra.Command, args []string) error {
opts = append(opts, server.WithReflection())
}

srv, err := server.NewPlatformHealthServer(conf, opts...)
srv, err := server.NewPlatformHealthServer(&serverId, conf, opts...)
if err != nil {
slog.Error("failed to create server", "error", err)
return err
Expand All @@ -115,10 +118,10 @@ func serve(c *cobra.Command, args []string) error {
func init() {
ServerCmd.Flags().StringVarP(&listenHost, "bind", "l", "", "listen on host (default all interfaces)")
ServerCmd.Flags().Lookup("bind").NoOptDefVal = "localhost"
viper.BindPFlag(config.ServerFlagPrefix+".listener.host", ServerCmd.Flags().Lookup("bind"))
viper.BindPFlag(config.ServerFlagPrefix+".listen.host", ServerCmd.Flags().Lookup("bind"))

ServerCmd.Flags().IntVarP(&listenPort, "port", "p", 8080, "listen on port")
viper.BindPFlag(config.ServerFlagPrefix+".listener.port", ServerCmd.Flags().Lookup("port"))
viper.BindPFlag(config.ServerFlagPrefix+".listen.port", ServerCmd.Flags().Lookup("port"))

ServerCmd.Flags().StringSliceVarP(&configPaths, "config-path", "C", []string{"/config", "."}, "configuration paths")
viper.BindPFlag(config.ServerFlagPrefix+".config.path", ServerCmd.Flags().Lookup("config-path"))
Expand Down
147 changes: 147 additions & 0 deletions pkg/platform_health/details/detail_loop.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b319cc1

Please sign in to comment.