Skip to content

Commit

Permalink
c/r changes: c/r changes: use the new mechanism to build non-caching …
Browse files Browse the repository at this point in the history
…client

Following c/r change in kubernetes-sigs/controller-runtime#2150

Signed-off-by: irbekrm <irbekrm@gmail.com>
  • Loading branch information
irbekrm committed May 26, 2023
1 parent 02724f4 commit 6536db1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pkg/controller/configmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,13 @@ type configmap struct {
}

func AddConfigMapController(ctx context.Context, log logr.Logger, opts Options) error {
noCacheClient, err := client.NewDelegatingClient(client.NewDelegatingClientInput{
CacheReader: opts.Manager.GetCache(),
Client: opts.Manager.GetClient(),
UncachedObjects: []client.Object{new(corev1.ConfigMap)},
CacheUnstructured: false,
// noCacheClient is used to retrieve objects that we don't want to cache.
noCacheClient, err := client.New(opts.Manager.GetConfig(), client.Options{
Cache: &client.CacheOptions{
Reader: opts.Manager.GetCache(),
DisableFor: []client.Object{&corev1.ConfigMap{}},
Unstructured: false,
},
})
if err != nil {
return fmt.Errorf("failed to build non-cached client for ConfigMaps: %w", err)
Expand Down

0 comments on commit 6536db1

Please sign in to comment.