From cd99dd15ce2fcf7245c90caa10700b4cb6f5dd6f Mon Sep 17 00:00:00 2001 From: Chris Doherty Date: Fri, 12 Jan 2024 16:55:20 -0600 Subject: [PATCH] Patch 0.16.3 updates Signed-off-by: Chris Doherty --- cmd/tink-controller/main.go | 3 ++- internal/server/kubernetes_api.go | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/tink-controller/main.go b/cmd/tink-controller/main.go index 556bdaaf3..7aacefbec 100644 --- a/cmd/tink-controller/main.go +++ b/cmd/tink-controller/main.go @@ -15,6 +15,7 @@ import ( "k8s.io/client-go/tools/clientcmd" clientcmdapi "k8s.io/client-go/tools/clientcmd/api" ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/metrics/server" ) // version is set at build time. @@ -88,7 +89,7 @@ func NewRootCommand() *cobra.Command { LeaderElection: config.EnableLeaderElection, LeaderElectionID: "tink.tinkerbell.org", LeaderElectionNamespace: namespace, - MetricsBindAddress: config.MetricsAddr, + Metrics: server.Options{BindAddress: config.MetricsAddr}, HealthProbeBindAddress: config.ProbeAddr, } diff --git a/internal/server/kubernetes_api.go b/internal/server/kubernetes_api.go index 8fdbd7f48..a5a8771a5 100644 --- a/internal/server/kubernetes_api.go +++ b/internal/server/kubernetes_api.go @@ -15,6 +15,7 @@ import ( "k8s.io/client-go/rest" "k8s.io/client-go/tools/clientcmd" clientcmdapi "k8s.io/client-go/tools/clientcmd/api" + "sigs.k8s.io/controller-runtime/pkg/cache" "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/cluster" ) @@ -60,7 +61,9 @@ func NewKubeBackedServerFromREST(logger logr.Logger, config *rest.Config, namesp clstr, err := cluster.New(config, func(opts *cluster.Options) { opts.Scheme = controller.DefaultScheme() opts.Logger = zapr.NewLogger(zap.NewNop()) - opts.Cache.Namespaces = []string{namespace} + opts.Cache.DefaultNamespaces = map[string]cache.Config{ + namespace: {}, + } }) if err != nil { return nil, fmt.Errorf("init client: %w", err)