Skip to content

Commit

Permalink
Enable deprecation check which was disabled for version upgrade
Browse files Browse the repository at this point in the history
Signed-off-by: wei-chenglai <[email protected]>
  • Loading branch information
seanlaii committed Nov 26, 2024
1 parent 079d0ab commit e05628b
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
4 changes: 0 additions & 4 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,6 @@ linters-settings:
- name: unexported-return
- name: time-naming
- name: empty-block
staticcheck:
# TODO(@RainbowMango): Disable deprecation check temporary for Kubernetes dependency update.
# This is tracked by https://github.com/karmada-io/karmada/issues/5796.
checks: ["all", "-SA1019"]

issues:
# The list of ids of default excludes to include or disable. By default it's empty.
Expand Down
4 changes: 2 additions & 2 deletions cmd/aggregated-apiserver/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,11 @@ func (o *Options) Run(ctx context.Context) error {
}

server.GenericAPIServer.AddPostStartHookOrDie("start-aggregated-server-informers", func(context genericapiserver.PostStartHookContext) error {
config.GenericConfig.SharedInformerFactory.Start(context.StopCh)
config.GenericConfig.SharedInformerFactory.Start(context.Done())
return nil
})

return server.GenericAPIServer.PrepareRun().Run(ctx.Done())
return server.GenericAPIServer.PrepareRun().RunWithContext(ctx)
}

// Config returns config for the api server given Options
Expand Down
10 changes: 5 additions & 5 deletions cmd/karmada-search/app/karmada-search.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ func run(ctx context.Context, o *options.Options, registryOptions ...Option) err
}

server.GenericAPIServer.AddPostStartHookOrDie("start-karmada-search-informers", func(context genericapiserver.PostStartHookContext) error {
config.GenericConfig.SharedInformerFactory.Start(context.StopCh)
config.GenericConfig.SharedInformerFactory.Start(context.Done())
return nil
})

server.GenericAPIServer.AddPostStartHookOrDie("start-karmada-informers", func(context genericapiserver.PostStartHookContext) error {
config.ExtraConfig.KarmadaSharedInformerFactory.Start(context.StopCh)
config.ExtraConfig.KarmadaSharedInformerFactory.Start(context.Done())
return nil
})

Expand All @@ -138,14 +138,14 @@ func run(ctx context.Context, o *options.Options, registryOptions ...Option) err
if config.ExtraConfig.Controller != nil {
server.GenericAPIServer.AddPostStartHookOrDie("start-karmada-search-controller", func(context genericapiserver.PostStartHookContext) error {
// start ResourceRegistry controller
config.ExtraConfig.Controller.Start(context.StopCh)
config.ExtraConfig.Controller.Start(context.Done())
return nil
})
}

if config.ExtraConfig.ProxyController != nil {
server.GenericAPIServer.AddPostStartHookOrDie("start-karmada-proxy-controller", func(context genericapiserver.PostStartHookContext) error {
config.ExtraConfig.ProxyController.Start(context.StopCh)
config.ExtraConfig.ProxyController.Start(context.Done())
return nil
})

Expand All @@ -155,7 +155,7 @@ func run(ctx context.Context, o *options.Options, registryOptions ...Option) err
})
}

return server.GenericAPIServer.PrepareRun().Run(ctx.Done())
return server.GenericAPIServer.PrepareRun().RunWithContext(ctx)
}

// `config` returns config for the api server given Options
Expand Down
6 changes: 3 additions & 3 deletions cmd/metrics-adapter/app/options/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@ func (o *Options) Config(stopCh <-chan struct{}) (*metricsadapter.MetricsServer,

err = server.GenericAPIServer.AddPostStartHook("start-karmada-informers", func(context genericapiserver.PostStartHookContext) error {
kubeFactory.Core().V1().Secrets().Informer()
kubeFactory.Start(context.StopCh)
kubeFactory.WaitForCacheSync(context.StopCh)
factory.Start(context.StopCh)
kubeFactory.Start(context.Done())
kubeFactory.WaitForCacheSync(context.Done())
factory.Start(context.Done())
return nil
})
if err != nil {
Expand Down
4 changes: 4 additions & 0 deletions pkg/util/grpcconnection/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ func (s *ServerConfig) NewServer() (*grpc.Server, error) {
// DialWithTimeOut will attempt to create a client connection based on the given targets, one at a time, until a client connection is successfully established.
func (c *ClientConfig) DialWithTimeOut(paths []string, timeout time.Duration) (*grpc.ClientConn, error) {
opts := []grpc.DialOption{
// grpc.WithBlock is deprecated. TODO: Perhaps need to reconsider the approach in a future PR
//nolint:staticcheck
grpc.WithBlock(),
}

Expand Down Expand Up @@ -155,6 +157,8 @@ func createGRPCConnection(path string, timeout time.Duration, opts ...grpc.DialO
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()

// grpc.DialContext is deprecated. TODO: Perhaps need to reconsider the approach in a future PR
//nolint:staticcheck
cc, err := grpc.DialContext(ctx, path, opts...)
if err != nil {
return nil, fmt.Errorf("dial %s error: %v", path, err)
Expand Down

0 comments on commit e05628b

Please sign in to comment.