Skip to content

Commit e1e452c

Browse files
shalomy-cyeraTimothy-Dougherty
authored andcommitted
feat: add optional service monitor namespace (kubernetes-sigs#2609)
* feat: add optional service monitor namespace * namespace to None
1 parent a1779e8 commit e1e452c

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

helm/aws-load-balancer-controller/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ The following tables lists the configurable parameters of the chart and their de
166166
The default values set by the application itself can be confirmed [here](https://kubernetes-sigs.github.io/aws-load-balancer-controller/guide/controller/configurations/).
167167

168168
| Parameter | Description | Default |
169-
| ---------------------------------------------- | -------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
169+
|------------------------------------------------| -------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- |
170170
| `image.repository` | image repository | `602401143452.dkr.ecr.us-west-2.amazonaws.com/amazon/aws-load-balancer-controller` |
171171
| `image.tag` | image tag | `<VERSION>` |
172172
| `image.pullPolicy` | image pull policy | `IfNotPresent` |
@@ -238,4 +238,5 @@ The default values set by the application itself can be confirmed [here](https:/
238238
| `serviceMonitor.enabled` | Specifies whether a service monitor should be created, requires the ServiceMonitor CRD to be installed | `false` |
239239
| `serviceMonitor.additionalLabels` | Labels to add to the service account | `{}` |
240240
| `serviceMonitor.interval` | Prometheus scrape interval | `1m` |
241+
| `serviceMonitor.namespace` | Namespace in which Prometheus is running | None |
241242
| `clusterSecretsPermissions.allowAllSecrets` | If `true`, controller has access to all secrets in the cluster. | `false` |

helm/aws-load-balancer-controller/templates/servicemonitor.yaml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ apiVersion: monitoring.coreos.com/v1
33
kind: ServiceMonitor
44
metadata:
55
name: {{ include "aws-load-balancer-controller.fullname" . }}
6+
{{- if .Values.serviceMonitor.namespace }}
7+
namespace: {{ .Values.serviceMonitor.namespace }}
8+
{{- else }}
9+
namespace: {{ .Release.Namespace | quote }}
10+
{{- end }}
611
labels:
712
{{- include "aws-load-balancer-controller.labels" . | nindent 4 }}
813
{{- with .Values.serviceMonitor.additionalLabels }}
@@ -27,4 +32,4 @@ spec:
2732
{{- with .Values.serviceMonitor.interval }}
2833
interval: {{ . }}
2934
{{- end }}
30-
{{- end -}}
35+
{{- end -}}

helm/aws-load-balancer-controller/values.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,8 @@ serviceMonitor:
287287
additionalLabels: {}
288288
# Prometheus scrape interval
289289
interval: 1m
290+
# Namespace to create the service monitor in
291+
namespace:
290292

291293
# clusterSecretsPermissions lets you configure RBAC permissions for secret resources
292294
# Access to secrets resource is required only if you use the OIDC feature, and instead of

0 commit comments

Comments
 (0)