Skip to content

Commit

Permalink
Adapt to the breaking change how the cache is restricted to object wi…
Browse files Browse the repository at this point in the history
…th label selectors
  • Loading branch information
ialidzhikov committed Apr 5, 2024
1 parent b90a77a commit 1335707
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pkg/app/cli_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"k8s.io/apimachinery/pkg/selection"
"k8s.io/apimachinery/pkg/util/runtime"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/manager"

gutil "github.com/gardener/gardener-custom-metrics/pkg/util/gardener"
Expand Down Expand Up @@ -149,8 +150,8 @@ func (c *CLIConfig) ManagerOptions() manager.Options {
runtime.Must(err)
secretsLabelSelector := labels.NewSelector().Add(*nameRequirement)

opts.NewCache = cache.BuilderWithOptions(cache.Options{
SelectorsByObject: cache.SelectorsByObject{
opts.Cache = cache.Options{
ByObject: map[client.Object]cache.ByObject{
&corev1.Secret{}: {
Label: secretsLabelSelector,
},
Expand All @@ -161,7 +162,7 @@ func (c *CLIConfig) ManagerOptions() manager.Options {
}),
},
},
})
}

return opts
}

0 comments on commit 1335707

Please sign in to comment.