From 89986fd7f9e5aa53a6317975a62752a24c22f585 Mon Sep 17 00:00:00 2001 From: Ahmed Samir Date: Thu, 16 Apr 2026 18:14:31 +0200 Subject: [PATCH] [aws-load-balancer-controller] Add support for multiple namespaces in watchNamespace This enhancement allows the watchNamespace parameter to accept either: - A single namespace as a string (backward compatible) - Multiple namespaces as a list The template now checks if watchNamespace is a slice and iterates through each namespace, passing multiple --watch-namespace flags to the controller. This resolves the limitation where the controller could only watch a single namespace at a time, improving deployment flexibility for multi-namespace environments. Closes #1306 --- stable/aws-load-balancer-controller/README.md | 2 +- .../templates/deployment.yaml | 6 ++++++ stable/aws-load-balancer-controller/values.yaml | 10 +++++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/stable/aws-load-balancer-controller/README.md b/stable/aws-load-balancer-controller/README.md index 77f7f09f..2ebaba33 100644 --- a/stable/aws-load-balancer-controller/README.md +++ b/stable/aws-load-balancer-controller/README.md @@ -250,7 +250,7 @@ The default values set by the application itself can be confirmed [here](https:/ | `globalAcceleratorMaxConcurrentReconciles` | Maximum number of concurrently running reconcile loops for GlobalAccelerator objects | None | | `globalAcceleratorMaxExponentialBackoffDelay` | Maximum duration of exponential backoff for GlobalAccelerator reconcile failures | None | | `syncPeriod` | Period at which the controller forces the repopulation of its local object stores | None | -| `watchNamespace` | Namespace the controller watches for updates to Kubernetes objects, If empty, all namespaces are watched | None | +| `watchNamespace` | Namespace(s) the controller watches for updates to Kubernetes objects. Can be a string for a single namespace or a list for multiple namespaces. If empty, all namespaces are watched | None | | `disableIngressClassAnnotation` | Disables the usage of kubernetes.io/ingress.class annotation | None | | `disableIngressGroupNameAnnotation` | Disables the usage of alb.ingress.kubernetes.io/group.name annotation | None | | `tolerateNonExistentBackendService` | whether to allow rules that reference a backend service that does not exist. (When enabled, it will return 503 error if backend service not exist) | `true` | diff --git a/stable/aws-load-balancer-controller/templates/deployment.yaml b/stable/aws-load-balancer-controller/templates/deployment.yaml index a710865e..5d06bf59 100644 --- a/stable/aws-load-balancer-controller/templates/deployment.yaml +++ b/stable/aws-load-balancer-controller/templates/deployment.yaml @@ -140,8 +140,14 @@ spec: - --sync-period={{ .Values.syncPeriod }} {{- end }} {{- if .Values.watchNamespace }} + {{- if kindIs "slice" .Values.watchNamespace }} + {{- range .Values.watchNamespace }} + - --watch-namespace={{ . }} + {{- end }} + {{- else }} - --watch-namespace={{ .Values.watchNamespace }} {{- end }} + {{- end }} {{- if kindIs "bool" .Values.disableIngressClassAnnotation }} - --disable-ingress-class-annotation={{ .Values.disableIngressClassAnnotation }} {{- end }} diff --git a/stable/aws-load-balancer-controller/values.yaml b/stable/aws-load-balancer-controller/values.yaml index 8073d596..efc620ec 100644 --- a/stable/aws-load-balancer-controller/values.yaml +++ b/stable/aws-load-balancer-controller/values.yaml @@ -291,7 +291,15 @@ lbStabilizationMonitorInterval: # Period at which the controller forces the repopulation of its local object stores. (default 10h0m0s) syncPeriod: -# Namespace the controller watches for updates to Kubernetes objects, If empty, all namespaces are watched. +# Namespace(s) the controller watches for updates to Kubernetes objects. +# Can be a single namespace (string) or multiple namespaces (list). +# If empty, all namespaces are watched. +# Examples: +# Single namespace: watchNamespace: my-namespace +# Multiple namespaces: +# watchNamespace: +# - namespace1 +# - namespace2 watchNamespace: # disableIngressClassAnnotation disables the usage of kubernetes.io/ingress.class annotation, false by default