Skip to content

Commit

Permalink
Merge pull request #28 from weaveworks/dont-cache-secrets
Browse files Browse the repository at this point in the history
Disable secret and configmap caching.
  • Loading branch information
bigkevmcd authored Aug 4, 2023
2 parents a08beb3 + 8b065d0 commit 163f947
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ import (
// to ensure that exec-entrypoint and run can make use of them.
_ "k8s.io/client-go/plugin/pkg/client/auth"

corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/runtime"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

Expand Down Expand Up @@ -74,6 +76,18 @@ func main() {
HealthProbeBindAddress: probeAddr,
LeaderElection: enableLeaderElection,
LeaderElectionID: "b1c33ab3.weave.works",

// Don't cache Secrets and ConfigMaps. In general, the
// controller-runtime client does a LIST and WATCH to cache
// kinds you request (see
// https://github.com/kubernetes-sigs/controller-runtime/pull/1249),
// and this can mean caching all secrets and configmaps; when
// all that's required is the few that are referenced for
// objects of interest to this controller.
ClientDisableCacheFor: []client.Object{
&corev1.Secret{},
&corev1.ConfigMap{},
},
})
if err != nil {
setupLog.Error(err, "unable to start manager")
Expand Down

0 comments on commit 163f947

Please sign in to comment.