Skip to content

Commit d2c4fb9

Browse files
Merge pull request #308 from CecileRobertMichon/list-namespaces
Disable caching for namespaces
2 parents 6e935de + e0aaa83 commit d2c4fb9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

main.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import (
2828
"github.com/go-logr/logr"
2929
"go.uber.org/zap/zapcore"
3030

31+
corev1 "k8s.io/api/core/v1"
3132
pkgruntime "k8s.io/apimachinery/pkg/runtime"
3233
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
3334
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
@@ -36,6 +37,7 @@ import (
3637
// to ensure that exec-entrypoint and run can make use of them.
3738
_ "k8s.io/client-go/plugin/pkg/client/auth"
3839
ctrl "sigs.k8s.io/controller-runtime"
40+
"sigs.k8s.io/controller-runtime/pkg/client"
3941
"sigs.k8s.io/controller-runtime/pkg/event"
4042
"sigs.k8s.io/controller-runtime/pkg/healthz"
4143
"sigs.k8s.io/controller-runtime/pkg/log/zap"
@@ -117,6 +119,11 @@ func main() {
117119

118120
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
119121
Scheme: scheme,
122+
Client: client.Options{
123+
Cache: &client.CacheOptions{
124+
DisableFor: []client.Object{&corev1.Namespace{}},
125+
},
126+
},
120127
Metrics: server.Options{
121128
BindAddress: metricsAddr,
122129
TLSOpts: tlsOpts,

0 commit comments

Comments
 (0)