Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Kriss <stephen.kriss@gmail.com>
  • Loading branch information
skriss committed Jul 17, 2024
1 parent 3705c17 commit 9461bbf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions cmd/contour/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,7 @@ func (s *Server) doServe() error {
// the contents of the Contour xDS caches after the DAG is built.
var snapshotHandler *xdscache_v3.SnapshotHandler

// nolint:staticcheck
if contourConfiguration.XDSServer.Type == contour_v1alpha1.EnvoyServerType {
snapshotHandler = xdscache_v3.NewSnapshotHandler(resources, s.log.WithField("context", "snapshotHandler"))

Expand Down Expand Up @@ -923,13 +924,15 @@ func (x *xdsServer) Start(ctx context.Context) error {

grpcServer := xds.NewServer(x.registry, grpcOptions(log, x.config.TLS)...)

// nolint:staticcheck
switch x.config.Type {
case contour_v1alpha1.EnvoyServerType:
contour_xds_v3.RegisterServer(envoy_server_v3.NewServer(ctx, x.snapshotHandler.GetCache(), contour_xds_v3.NewRequestLoggingCallbacks(log)), grpcServer)
case contour_v1alpha1.ContourServerType:
contour_xds_v3.RegisterServer(contour_xds_v3.NewContourServer(log, xdscache.ResourcesOf(x.resources)...), grpcServer)
default:
// This can't happen due to config validation.
// nolint:staticcheck
log.Fatalf("invalid xDS server type %q", x.config.Type)
}

Expand All @@ -944,6 +947,7 @@ func (x *xdsServer) Start(ctx context.Context) error {
log = log.WithField("insecure", true)
}

// nolint:staticcheck
log.Infof("started xDS server type: %q", x.config.Type)
defer log.Info("stopped xDS server")

Expand Down
4 changes: 2 additions & 2 deletions internal/contourconfig/contourconfiguration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,12 @@ func TestOverlayOnDefaults(t *testing.T) {
"ContourConfig with single non-default field is overlaid correctly": {
contourConfig: contour_v1alpha1.ContourConfigurationSpec{
XDSServer: &contour_v1alpha1.XDSServerConfig{
Type: contour_v1alpha1.EnvoyServerType,
Port: 7777,
},
},
want: func() contour_v1alpha1.ContourConfigurationSpec {
res := contourconfig.Defaults()
res.XDSServer.Type = contour_v1alpha1.EnvoyServerType
res.XDSServer.Port = 7777
return res
},
},
Expand Down

0 comments on commit 9461bbf

Please sign in to comment.