diff --git a/docs/values.md b/docs/values.md index 5d9ac7707f6f2586e05062dbb5983efabc37ef0c..5f7fee99708a441c5da8922c52cb9153296d9d1e 100644 --- a/docs/values.md +++ b/docs/values.md @@ -79,6 +79,8 @@ This file contains the markdown version of the default values that this chart ta | metrics.alertmanager.ingress.hosts | Array | `[]` | list of hosts for the alertmanager ingress | | metrics.alertmanager.ingress.tls | Hash | `{}` | tls configuration for the alertmanager ingress | | metrics.alertmanager.nodeSelector | Hash | `{}` | node selector configuration for the alertmanager | +| metrics.alertmanager.volumes | Array | `[]` | list of volumes to be declared | +| metrics.alertmanager.volumeMounts | Array | `[]` | list of volumes to be mounted | | otlp.endpoint | string | `"monit-otlp.cern.ch"` | otlp endpoint where the otlp receivers are listening | | otlp.port | int | `4319` | otlp port where the otlp receivers are listening | | tenant.name | string | - | username used for authenitcating in the MONIT infrastructure | diff --git a/templates/alertmanager/alertmanager.yaml b/templates/alertmanager/alertmanager.yaml index d8b31bd9deb90d12d0c8777ee1f850fda32d7003..af4e7c69eeb0f279ca16c1b8cc5265ee018ff390 100644 --- a/templates/alertmanager/alertmanager.yaml +++ b/templates/alertmanager/alertmanager.yaml @@ -13,4 +13,12 @@ spec: forceEnableClusterMode: true alertmanagerConfigSelector: {} alertmanagerConfigNamespaceSelector: {} -{{- end -}} \ No newline at end of file + {{- if .Values.metrics.alertmanager.volumes }} + volumes: + {{- toYaml .Values.metrics.alertmanager.volumes | nindent 4 }} + {{- end }} + {{- if .Values.metrics.alertmanager.volumeMounts }} + volumeMounts: + {{- toYaml .Values.metrics.alertmanager.volumeMounts | nindent 4 }} + {{- end }} +{{- end -}} diff --git a/tests/alertmanager/alertmanager.yaml b/tests/alertmanager/alertmanager.yaml new file mode 100644 index 0000000000000000000000000000000000000000..327d621870a93ce415951ff63a8067beee70639c --- /dev/null +++ b/tests/alertmanager/alertmanager.yaml @@ -0,0 +1,61 @@ +suite: test alertmanager alertmanager +templates: + - alertmanager/alertmanager.yaml +tests: + - it: should not be deployed if metrics are disabled + set: + metrics.enabled: false + asserts: + - containsDocument: + kind: Alertmanager + apiVersion: "monitoring.coreos.com/v1" + name: it-monit-alertmanager + not: true + - it: should not be deployed if alertmanager is not enabled + set: + metrics.enabled: true + metrics.alertmanager.enabled: false + asserts: + - containsDocument: + kind: Alertmanager + apiVersion: "monitoring.coreos.com/v1" + name: it-monit-alertmanager + not: true + - it: should be deployed if metrics and alertmanager are enabled + set: + metrics.enabled: true + metrics.alertmanager.enabled: true + asserts: + - containsDocument: + kind: Alertmanager + apiVersion: "monitoring.coreos.com/v1" + name: it-monit-alertmanager + - it: should be deployed with volumes and volumeMounts if configured + set: + metrics.enabled: true + metrics.alertmanager.enabled: true + metrics.alertmanager.volumes: + - name: test-volume + secret: + secretName: test-secret + metrics.alertmanager.volumeMounts: + - mountPath: /foo + name: test-volume + asserts: + - containsDocument: + kind: Alertmanager + apiVersion: "monitoring.coreos.com/v1" + name: it-monit-alertmanager + - contains: + path: spec.volumes + count: 1 + content: + name: test-volume + secret: + secretName: test-secret + - contains: + path: spec.volumeMounts + count: 1 + content: + mountPath: /foo + name: test-volume diff --git a/values.yaml b/values.yaml index d9f8842dc6c46e3e1b7d90030d6d70cb16221a87..9e9af9c3bac4de3c9fc0e47868f8dac07229270e 100644 --- a/values.yaml +++ b/values.yaml @@ -273,6 +273,8 @@ metrics: # If given will override the defaultNodeSelector and install the component # only on the nodes that match the given condition. nodeSelector: {} + volumes: [] + volumeMounts: [] apiServer: serviceMonitor: