Skip to content

Commit

Permalink
Fix patch to controller runtime 0.16.3
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Doherty <[email protected]>
  • Loading branch information
chrisdoherty4 committed Jan 12, 2024
1 parent ab129da commit 777917f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 5 additions & 2 deletions cmd/tink-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -88,8 +89,10 @@ func NewRootCommand() *cobra.Command {
LeaderElection: config.EnableLeaderElection,
LeaderElectionID: "tink.tinkerbell.org",
LeaderElectionNamespace: namespace,
MetricsBindAddress: config.MetricsAddr,
HealthProbeBindAddress: config.ProbeAddr,
Metrics: server.Options{
BindAddress: config.MetricsAddr,
},
HealthProbeBindAddress: config.ProbeAddr,
}

mgr, err := controller.NewManager(cfg, options)
Expand Down
5 changes: 4 additions & 1 deletion internal/server/kubernetes_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 777917f

Please sign in to comment.