You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// to ensure that exec-entrypoint and run can make use of them.
@@ -65,10 +66,12 @@ func main() {
65
66
varprobeAddrstring
66
67
varsecureMetricsbool
67
68
varenableHTTP2bool
68
-
varnamespacestring
69
+
varnamespacesstring
70
+
vardeprecatedScopedNamespaceWarningbool
69
71
70
72
vartlsOpts []func(*tls.Config)
71
-
flag.StringVar(&namespace, "namespace", "", "Watch InfisicalSecrets scoped in the provided namespace only")
73
+
flag.StringVar(&namespaces, "namespaces", "", "Comma-separated list of namespaces to watch. If empty, watches all namespaces (cluster-scoped)")
74
+
flag.BoolVar(&deprecatedScopedNamespaceWarning, "deprecated-scoped-namespace-warning", false, "If true, logs a deprecation warning for the scopedNamespace field")
72
75
flag.StringVar(&metricsAddr, "metrics-bind-address", "0", "The address the metrics endpoint binds to. "+
73
76
"Use :8443 for HTTPS or :8080 for HTTP, or leave as 0 to disable the metrics service.")
74
77
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
@@ -203,15 +206,35 @@ func main() {
203
206
// LeaderElectionReleaseOnCancel: true,
204
207
}
205
208
209
+
// Parse namespaces and configure cache for namespace-scoped watching
210
+
varnamespaceList []string
211
+
ifnamespaces!="" {
212
+
for_, ns:=rangestrings.Split(namespaces, ",") {
213
+
ns=strings.TrimSpace(ns)
214
+
ifns!="" {
215
+
namespaceList=append(namespaceList, ns)
216
+
}
217
+
}
218
+
}
219
+
220
+
isNamespaceScoped:=len(namespaceList) >0
221
+
222
+
// Log deprecation warning if using the deprecated scopedNamespace field
223
+
ifdeprecatedScopedNamespaceWarning {
224
+
setupLog.Info("WARNING: The 'scopedNamespace' field is deprecated and will be removed in a future version. Please use 'scopedNamespaces' (plural) instead.")
225
+
}
226
+
206
227
// Only set cache options if we're namespace-scoped
207
-
ifnamespace!="" {
228
+
ifisNamespaceScoped {
229
+
defaultNamespaces:=make(map[string]cache.Config)
230
+
for_, ns:=rangenamespaceList {
231
+
defaultNamespaces[ns] = cache.Config{}
232
+
}
208
233
managerOptions.Cache= cache.Options{
209
-
Scheme: scheme,
210
-
DefaultNamespaces: map[string]cache.Config{
211
-
namespace: {}, // whichever namespace the operator is running in
212
-
},
234
+
Scheme: scheme,
235
+
DefaultNamespaces: defaultNamespaces,
213
236
}
214
-
ctrl.Log.Info(fmt.Sprintf("Watching CRDs in [namespace=%s]", namespace))
237
+
ctrl.Log.Info(fmt.Sprintf("Watching CRDs in namespaces: %v", namespaceList))
0 commit comments