From c162b356c4e41cac46a6435fd9ec022ae844251e Mon Sep 17 00:00:00 2001 From: Srinivas Chippagiri Date: Wed, 28 Oct 2026 08:56:13 -0700 Subject: [PATCH 1/2] feat: allow sidecars to watch specific resource names Add ruler.sidecar.resourceName and alertmanager.sidecar.resourceName, which set RESOURCE_NAME on the k8s-sidecar containers so they only watch the listed ConfigMaps and/or Secrets. Signed-off-by: Srinivas Chippagiri --- README.md | 2 ++ templates/alertmanager/alertmanager-dep.yaml | 4 ++++ templates/alertmanager/alertmanager-statefulset.yaml | 4 ++++ templates/ruler/ruler-dep.yaml | 4 ++++ values.yaml | 4 ++++ 5 files changed, 18 insertions(+) diff --git a/README.md b/README.md index 6ca543db..05d4d103 100644 --- a/README.md +++ b/README.md @@ -155,6 +155,7 @@ Kubernetes: `^1.19.0-0` | alertmanager.​sidecar.​readinessProbe.​httpGet.​port | string | `"sidecar-health"` | | | alertmanager.​sidecar.​readinessProbe.​periodSeconds | int | `5` | | | alertmanager.​sidecar.​resource | string | `"both"` | The resource type that the operator will filter for. Can be configmap, secret or both | +| alertmanager.​sidecar.​resourceName | string | `""` | Comma separated list of ConfigMap and/or Secret names to watch. When empty, all resources matching the label are watched | | alertmanager.​sidecar.​resources | object | `{}` | | | alertmanager.​sidecar.​searchNamespace | string | `""` | The Namespace(s) from which resources will be watched. For multiple namespaces, use a comma-separated string like "default,test". If not set or set to ALL, it will watch all Namespaces. | | alertmanager.​sidecar.​skipTlsVerify | bool | `false` | Set to true to skip tls verification for kube api calls | @@ -893,6 +894,7 @@ Kubernetes: `^1.19.0-0` | ruler.​sidecar.​readinessProbe.​httpGet.​port | string | `"sidecar-health"` | | | ruler.​sidecar.​readinessProbe.​periodSeconds | int | `5` | | | ruler.​sidecar.​resource | string | `"both"` | The resource type that the operator will filter for. Can be configmap, secret or both | +| ruler.​sidecar.​resourceName | string | `""` | Comma separated list of ConfigMap and/or Secret names to watch. When empty, all resources matching the label are watched | | ruler.​sidecar.​resources | object | `{}` | | | ruler.​sidecar.​searchNamespace | string | `""` | The Namespace(s) from which resources will be watched. For multiple namespaces, use a comma-separated string like "default,test". If not set or set to ALL, it will watch all Namespaces. | | ruler.​sidecar.​skipTlsVerify | bool | `false` | Set to true to skip tls verification for kube api calls | diff --git a/templates/alertmanager/alertmanager-dep.yaml b/templates/alertmanager/alertmanager-dep.yaml index cd080672..814a811e 100644 --- a/templates/alertmanager/alertmanager-dep.yaml +++ b/templates/alertmanager/alertmanager-dep.yaml @@ -72,6 +72,10 @@ spec: - name: RESOURCE value: {{ quote .Values.alertmanager.sidecar.resource }} {{- end }} + {{- with .Values.alertmanager.sidecar.resourceName }} + - name: RESOURCE_NAME + value: {{ quote . }} + {{- end }} {{- if .Values.alertmanager.sidecar.enableUniqueFilenames }} - name: UNIQUE_FILENAMES value: "{{ .Values.alertmanager.sidecar.enableUniqueFilenames }}" diff --git a/templates/alertmanager/alertmanager-statefulset.yaml b/templates/alertmanager/alertmanager-statefulset.yaml index c0be57db..0861176c 100644 --- a/templates/alertmanager/alertmanager-statefulset.yaml +++ b/templates/alertmanager/alertmanager-statefulset.yaml @@ -129,6 +129,10 @@ spec: - name: RESOURCE value: {{ quote .Values.alertmanager.sidecar.resource }} {{- end }} + {{- with .Values.alertmanager.sidecar.resourceName }} + - name: RESOURCE_NAME + value: {{ quote . }} + {{- end }} {{- if .Values.alertmanager.sidecar.enableUniqueFilenames }} - name: UNIQUE_FILENAMES value: "{{ .Values.alertmanager.sidecar.enableUniqueFilenames }}" diff --git a/templates/ruler/ruler-dep.yaml b/templates/ruler/ruler-dep.yaml index 28764ea2..9a805c35 100644 --- a/templates/ruler/ruler-dep.yaml +++ b/templates/ruler/ruler-dep.yaml @@ -74,6 +74,10 @@ spec: - name: RESOURCE value: {{ quote .Values.ruler.sidecar.resource }} {{- end }} + {{- with .Values.ruler.sidecar.resourceName }} + - name: RESOURCE_NAME + value: {{ quote . }} + {{- end }} {{- if .Values.ruler.sidecar.enableUniqueFilenames }} - name: UNIQUE_FILENAMES value: "{{ .Values.ruler.sidecar.enableUniqueFilenames }}" diff --git a/values.yaml b/values.yaml index ba8b32fc..3ce0ee19 100644 --- a/values.yaml +++ b/values.yaml @@ -315,6 +315,8 @@ alertmanager: folderAnnotation: "k8s-sidecar-target-directory" # -- The resource type that the operator will filter for. Can be configmap, secret or both resource: "both" + # -- Comma separated list of ConfigMap and/or Secret names to watch. When empty, all resources matching the label are watched + resourceName: "" containerSecurityContext: enabled: true readOnlyRootFilesystem: true @@ -768,6 +770,8 @@ ruler: folderAnnotation: "k8s-sidecar-target-directory" # -- The resource type that the operator will filter for. Can be configmap, secret or both resource: "both" + # -- Comma separated list of ConfigMap and/or Secret names to watch. When empty, all resources matching the label are watched + resourceName: "" containerSecurityContext: enabled: true readOnlyRootFilesystem: true From 290882248ee6540761f3a534a909f43d65300337 Mon Sep 17 00:00:00 2001 From: Srinivas Chippagiri Date: Wed, 28 Oct 2026 08:57:04 -0700 Subject: [PATCH 2/2] docs: add changelog entry Signed-off-by: Srinivas Chippagiri --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 175d9ef0..8bfe00a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## master / unreleased * [FEATURE] Parquet converter: allow running it as a StatefulSet with a persistent volume per pod #685 +* [FEATURE] Add `ruler.sidecar.resourceName` and `alertmanager.sidecar.resourceName` to set `RESOURCE_NAME` on the sidecars #688 * [ENHANCEMENT] Expose `nginx.config.client_body_buffer_size` to set the nginx `client_body_buffer_size` #350 * [DEPENDENCY] Update Helm release rollout-operator to v0.53.1 #683 * [DEPENDENCY] Update prom/memcached-exporter Docker tag to v0.18.0 #684