From 3891d60541b04accfa42696fad26faf22147645b Mon Sep 17 00:00:00 2001 From: Sam Mcbroom Date: Thu, 20 Jul 2023 10:27:33 -0700 Subject: [PATCH 01/13] [alertmanager] Add additional configuration options. Signed-off-by: Sam Mcbroom --- charts/alertmanager/Chart.yaml | 2 +- charts/alertmanager/templates/statefulset.yaml | 14 ++++++++++++-- charts/alertmanager/values.yaml | 2 ++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/charts/alertmanager/Chart.yaml b/charts/alertmanager/Chart.yaml index 1e4ab701e57e..96497674d135 100644 --- a/charts/alertmanager/Chart.yaml +++ b/charts/alertmanager/Chart.yaml @@ -6,7 +6,7 @@ icon: https://raw.githubusercontent.com/prometheus/prometheus.github.io/master/a sources: - https://github.com/prometheus/alertmanager type: application -version: 1.0.0 +version: 1.1.0 appVersion: v0.25.0 kubeVersion: ">=1.19.0-0" keywords: diff --git a/charts/alertmanager/templates/statefulset.yaml b/charts/alertmanager/templates/statefulset.yaml index 83979fbf0751..504db3d3489c 100644 --- a/charts/alertmanager/templates/statefulset.yaml +++ b/charts/alertmanager/templates/statefulset.yaml @@ -99,7 +99,10 @@ spec: imagePullPolicy: "{{ .Values.configmapReload.image.pullPolicy }}" args: - --watched-dir=/etc/alertmanager - - --reload-url=http://127.0.0.1:9093/-/reload + - --reload-url=http://127.0.0.1:{{ .Values.service.port }}/-/reload + {{- range $key, $value := .Values.configmapReload.extraArgs }} + - --{{ $key }}={{ $value }} + {{- end }} resources: {{- toYaml .Values.configmapReload.resources | nindent 12 }} {{- with .Values.configmapReload.containerPort }} @@ -130,7 +133,9 @@ spec: {{- end }} args: - --storage.path=/alertmanager + {{- if not (hasKey .Values.extraArgs "config.file") }} - --config.file=/etc/alertmanager/alertmanager.yml + {{- end }} {{- if or (gt (int .Values.replicaCount) 1) (.Values.additionalPeers) }} - --cluster.advertise-address=[$(POD_IP)]:{{ $svcClusterPort }} - --cluster.listen-address=0.0.0.0:{{ $svcClusterPort }} @@ -151,8 +156,13 @@ spec: {{- end }} ports: - name: http - containerPort: 9093 + containerPort: {{ .Values.service.port }} protocol: TCP + {{- if or (gt (int .Values.replicaCount) 1) (.Values.additionalPeers) }} + - name: clusterpeer + containerPort: {{ $svcClusterPort }} + protocol: TCP + {{- end }} livenessProbe: {{- toYaml .Values.livenessProbe | nindent 12 }} readinessProbe: diff --git a/charts/alertmanager/values.yaml b/charts/alertmanager/values.yaml index b3ad2f0ad667..56c2f32cc4e2 100644 --- a/charts/alertmanager/values.yaml +++ b/charts/alertmanager/values.yaml @@ -244,6 +244,8 @@ configmapReload: ## resources: {} + extraArgs: {} + templates: {} # alertmanager.tmpl: |- From 886f6cf13f5efc23069c43bed0208d52fadfdd98 Mon Sep 17 00:00:00 2001 From: Sam Mcbroom Date: Thu, 20 Jul 2023 10:37:24 -0700 Subject: [PATCH 02/13] Use port names. Signed-off-by: Sam Mcbroom --- charts/alertmanager/templates/services.yaml | 4 ++-- charts/alertmanager/templates/statefulset.yaml | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/charts/alertmanager/templates/services.yaml b/charts/alertmanager/templates/services.yaml index ce0876c77fab..0acc3b19b06b 100644 --- a/charts/alertmanager/templates/services.yaml +++ b/charts/alertmanager/templates/services.yaml @@ -47,11 +47,11 @@ spec: name: http {{- if or (gt (int .Values.replicaCount) 1) (.Values.additionalPeers) }} - port: {{ .Values.service.clusterPort }} - targetPort: {{ .Values.service.clusterPort }} + targetPort: clusterpeer protocol: TCP name: cluster-tcp - port: {{ .Values.service.clusterPort }} - targetPort: {{ .Values.service.clusterPort }} + targetPort: clusterpeer protocol: UDP name: cluster-udp {{- end }} diff --git a/charts/alertmanager/templates/statefulset.yaml b/charts/alertmanager/templates/statefulset.yaml index 504db3d3489c..ec595855a087 100644 --- a/charts/alertmanager/templates/statefulset.yaml +++ b/charts/alertmanager/templates/statefulset.yaml @@ -99,7 +99,7 @@ spec: imagePullPolicy: "{{ .Values.configmapReload.image.pullPolicy }}" args: - --watched-dir=/etc/alertmanager - - --reload-url=http://127.0.0.1:{{ .Values.service.port }}/-/reload + - --reload-url=http://127.0.0.1:9093/-/reload {{- range $key, $value := .Values.configmapReload.extraArgs }} - --{{ $key }}={{ $value }} {{- end }} @@ -156,7 +156,7 @@ spec: {{- end }} ports: - name: http - containerPort: {{ .Values.service.port }} + containerPort: 9093 protocol: TCP {{- if or (gt (int .Values.replicaCount) 1) (.Values.additionalPeers) }} - name: clusterpeer From bb9f725307a5642fc3102f5e9d0717d299bcd0ec Mon Sep 17 00:00:00 2001 From: Sam Mcbroom Date: Thu, 20 Jul 2023 15:46:01 -0700 Subject: [PATCH 03/13] Extra volume mounts for config reloader. Signed-off-by: Sam Mcbroom --- charts/alertmanager/templates/statefulset.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/charts/alertmanager/templates/statefulset.yaml b/charts/alertmanager/templates/statefulset.yaml index ec595855a087..1eb165f71e33 100644 --- a/charts/alertmanager/templates/statefulset.yaml +++ b/charts/alertmanager/templates/statefulset.yaml @@ -112,6 +112,9 @@ spec: volumeMounts: - name: config mountPath: /etc/alertmanager + {{- if .Values.configmapReload.extraVolumeMounts }} + {{- toYaml .Values.configmapReload.extraVolumeMounts | nindent 12 }} + {{- end }} {{- end }} - name: {{ .Chart.Name }} securityContext: From 28c450d098173e31e6dc64bea59253e309cabca8 Mon Sep 17 00:00:00 2001 From: Sam Mcbroom Date: Thu, 20 Jul 2023 15:53:20 -0700 Subject: [PATCH 04/13] Add extraEnv value for config reloader. Signed-off-by: Sam Mcbroom --- charts/alertmanager/templates/statefulset.yaml | 4 ++++ charts/alertmanager/values.yaml | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/charts/alertmanager/templates/statefulset.yaml b/charts/alertmanager/templates/statefulset.yaml index 1eb165f71e33..7d0954f84646 100644 --- a/charts/alertmanager/templates/statefulset.yaml +++ b/charts/alertmanager/templates/statefulset.yaml @@ -97,6 +97,10 @@ spec: - name: {{ .Chart.Name }}-{{ .Values.configmapReload.name }} image: "{{ .Values.configmapReload.image.repository }}:{{ .Values.configmapReload.image.tag }}" imagePullPolicy: "{{ .Values.configmapReload.image.pullPolicy }}" + {{- with .Values.configmapReload.extraEnv }} + env: + {{- toYaml . | nindent 12 }} + {{- end }} args: - --watched-dir=/etc/alertmanager - --reload-url=http://127.0.0.1:9093/-/reload diff --git a/charts/alertmanager/values.yaml b/charts/alertmanager/values.yaml index 56c2f32cc4e2..b37022dcb59d 100644 --- a/charts/alertmanager/values.yaml +++ b/charts/alertmanager/values.yaml @@ -246,6 +246,17 @@ configmapReload: extraArgs: {} + ## Optionally specify extra list of additional volumeMounts + extraVolumeMounts: [] + # - name: extras + # mountPath: /usr/share/extras + # readOnly: true + + ## Optionally specify extra list of additional volumes + extraEnv: [] + # - name: extras + # emptyDir: {} + templates: {} # alertmanager.tmpl: |- From 7112000f93d9647bc96ec3254c37e58e9f6b1e91 Mon Sep 17 00:00:00 2001 From: Sam Mcbroom Date: Thu, 20 Jul 2023 16:00:07 -0700 Subject: [PATCH 05/13] Allow restricting config-reloader to only watch specific file. Signed-off-by: Sam Mcbroom --- charts/alertmanager/templates/statefulset.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/charts/alertmanager/templates/statefulset.yaml b/charts/alertmanager/templates/statefulset.yaml index 7d0954f84646..618f10e5780b 100644 --- a/charts/alertmanager/templates/statefulset.yaml +++ b/charts/alertmanager/templates/statefulset.yaml @@ -102,7 +102,9 @@ spec: {{- toYaml . | nindent 12 }} {{- end }} args: + {{- if not (hasKey .Values.configmapReload.extraArgs "config-file") }} - --watched-dir=/etc/alertmanager + {{- end }} - --reload-url=http://127.0.0.1:9093/-/reload {{- range $key, $value := .Values.configmapReload.extraArgs }} - --{{ $key }}={{ $value }} From 74e9e46eac320298ea1313cd70cc826a31d87a53 Mon Sep 17 00:00:00 2001 From: Sam Mcbroom Date: Thu, 20 Jul 2023 16:01:59 -0700 Subject: [PATCH 06/13] Allow configuring reload endpoint for config reloader. Signed-off-by: Sam Mcbroom --- charts/alertmanager/templates/statefulset.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/charts/alertmanager/templates/statefulset.yaml b/charts/alertmanager/templates/statefulset.yaml index 618f10e5780b..cf3a9ff00da4 100644 --- a/charts/alertmanager/templates/statefulset.yaml +++ b/charts/alertmanager/templates/statefulset.yaml @@ -105,7 +105,9 @@ spec: {{- if not (hasKey .Values.configmapReload.extraArgs "config-file") }} - --watched-dir=/etc/alertmanager {{- end }} + {{- if not (hasKey .Values.configmapReload.extraArgs "reload-url") }} - --reload-url=http://127.0.0.1:9093/-/reload + {{- end }} {{- range $key, $value := .Values.configmapReload.extraArgs }} - --{{ $key }}={{ $value }} {{- end }} From a31f5ed65dc664a30980d529a6175a51d7ccfaef Mon Sep 17 00:00:00 2001 From: Sam Mcbroom Date: Thu, 20 Jul 2023 16:05:21 -0700 Subject: [PATCH 07/13] Fix comments in values.yaml. Signed-off-by: Sam Mcbroom --- charts/alertmanager/values.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/charts/alertmanager/values.yaml b/charts/alertmanager/values.yaml index b37022dcb59d..4bb2f129b6f2 100644 --- a/charts/alertmanager/values.yaml +++ b/charts/alertmanager/values.yaml @@ -252,10 +252,10 @@ configmapReload: # mountPath: /usr/share/extras # readOnly: true - ## Optionally specify extra list of additional volumes + ## Optionally specify extra environment variables to add to alertmanager container extraEnv: [] - # - name: extras - # emptyDir: {} + # - name: FOO + # value: BAR templates: {} # alertmanager.tmpl: |- From 1d6d52e3eb809e8809e99e1215ffa1c9e5be130d Mon Sep 17 00:00:00 2001 From: Sam Mcbroom Date: Fri, 21 Jul 2023 10:10:41 -0700 Subject: [PATCH 08/13] Allow exposing extra ports on the services. Signed-off-by: Sam Mcbroom --- charts/alertmanager/templates/services.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/charts/alertmanager/templates/services.yaml b/charts/alertmanager/templates/services.yaml index 0acc3b19b06b..4796f302a305 100644 --- a/charts/alertmanager/templates/services.yaml +++ b/charts/alertmanager/templates/services.yaml @@ -28,6 +28,9 @@ spec: {{- if (and (eq .Values.service.type "NodePort") .Values.service.nodePort) }} nodePort: {{ .Values.service.nodePort }} {{- end }} + {{- with .Values.service.extraPorts }} + {{- toYaml . | nindent 4 }} + {{- end }} selector: {{- include "alertmanager.selectorLabels" . | nindent 4 }} --- @@ -55,5 +58,8 @@ spec: protocol: UDP name: cluster-udp {{- end }} + {{- with .Values.service.extraPorts }} + {{- toYaml . | nindent 4 }} + {{- end }} selector: {{- include "alertmanager.selectorLabels" . | nindent 4 }} From 84fbb1a181825d9b6709279b2fb0ecb86150cba2 Mon Sep 17 00:00:00 2001 From: Sam Mcbroom Date: Fri, 21 Jul 2023 10:14:33 -0700 Subject: [PATCH 09/13] Default value for service.extraPorts. Signed-off-by: Sam Mcbroom --- charts/alertmanager/values.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/charts/alertmanager/values.yaml b/charts/alertmanager/values.yaml index 4bb2f129b6f2..e1761444cd6a 100644 --- a/charts/alertmanager/values.yaml +++ b/charts/alertmanager/values.yaml @@ -106,6 +106,9 @@ service: # if you want to force a specific nodePort. Must be use with service.type=NodePort # nodePort: + # Optionally specify extra list of additional ports exposed on both services + extraPorts: [] + ingress: enabled: false className: "" From 7592d0299563d02dbcb54e67c3091b0339d040e2 Mon Sep 17 00:00:00 2001 From: Sam Mcbroom Date: Fri, 28 Jul 2023 18:25:11 -0700 Subject: [PATCH 10/13] Remove unused service port protocol. Signed-off-by: Sam Mcbroom --- charts/alertmanager/templates/services.yaml | 4 ---- charts/alertmanager/templates/statefulset.yaml | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/charts/alertmanager/templates/services.yaml b/charts/alertmanager/templates/services.yaml index 4796f302a305..adec0f8a4d27 100644 --- a/charts/alertmanager/templates/services.yaml +++ b/charts/alertmanager/templates/services.yaml @@ -53,10 +53,6 @@ spec: targetPort: clusterpeer protocol: TCP name: cluster-tcp - - port: {{ .Values.service.clusterPort }} - targetPort: clusterpeer - protocol: UDP - name: cluster-udp {{- end }} {{- with .Values.service.extraPorts }} {{- toYaml . | nindent 4 }} diff --git a/charts/alertmanager/templates/statefulset.yaml b/charts/alertmanager/templates/statefulset.yaml index cf3a9ff00da4..2a5fb104809d 100644 --- a/charts/alertmanager/templates/statefulset.yaml +++ b/charts/alertmanager/templates/statefulset.yaml @@ -102,7 +102,7 @@ spec: {{- toYaml . | nindent 12 }} {{- end }} args: - {{- if not (hasKey .Values.configmapReload.extraArgs "config-file") }} + {{- if and (not hasKey .Values.configmapReload.extraArgs "config-file") (not hasKey .Values.configmapReload.extraArgs "watched-dir") }} - --watched-dir=/etc/alertmanager {{- end }} {{- if not (hasKey .Values.configmapReload.extraArgs "reload-url") }} From 681efa1a440a10c6676a2aab24f64fd3177e0568 Mon Sep 17 00:00:00 2001 From: Sam Mcbroom Date: Fri, 28 Jul 2023 18:31:41 -0700 Subject: [PATCH 11/13] Fix helm. Signed-off-by: Sam Mcbroom --- charts/alertmanager/templates/statefulset.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/alertmanager/templates/statefulset.yaml b/charts/alertmanager/templates/statefulset.yaml index 2a5fb104809d..29aebe8b706a 100644 --- a/charts/alertmanager/templates/statefulset.yaml +++ b/charts/alertmanager/templates/statefulset.yaml @@ -102,7 +102,7 @@ spec: {{- toYaml . | nindent 12 }} {{- end }} args: - {{- if and (not hasKey .Values.configmapReload.extraArgs "config-file") (not hasKey .Values.configmapReload.extraArgs "watched-dir") }} + {{- if and (hasKey .Values.configmapReload.extraArgs "config-file" | not) (hasKey .Values.configmapReload.extraArgs "watched-dir" | not) }} - --watched-dir=/etc/alertmanager {{- end }} {{- if not (hasKey .Values.configmapReload.extraArgs "reload-url") }} From 9b2832fcf1c8dd8f4e864e6873197ca1fa07d00b Mon Sep 17 00:00:00 2001 From: Sam Mcbroom Date: Tue, 1 Aug 2023 07:29:18 -0700 Subject: [PATCH 12/13] Enabled UDP port for cluster peer communication. Signed-off-by: Sam Mcbroom --- charts/alertmanager/templates/services.yaml | 6 +++++- charts/alertmanager/templates/statefulset.yaml | 5 ++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/charts/alertmanager/templates/services.yaml b/charts/alertmanager/templates/services.yaml index adec0f8a4d27..55105362a3fc 100644 --- a/charts/alertmanager/templates/services.yaml +++ b/charts/alertmanager/templates/services.yaml @@ -50,9 +50,13 @@ spec: name: http {{- if or (gt (int .Values.replicaCount) 1) (.Values.additionalPeers) }} - port: {{ .Values.service.clusterPort }} - targetPort: clusterpeer + targetPort: clusterpeer-tcp protocol: TCP name: cluster-tcp + - port: {{ .Values.service.clusterPort }} + targetPort: clusterpeer-udp + protocol: UDP + name: cluster-udp {{- end }} {{- with .Values.service.extraPorts }} {{- toYaml . | nindent 4 }} diff --git a/charts/alertmanager/templates/statefulset.yaml b/charts/alertmanager/templates/statefulset.yaml index 29aebe8b706a..93970f309782 100644 --- a/charts/alertmanager/templates/statefulset.yaml +++ b/charts/alertmanager/templates/statefulset.yaml @@ -170,9 +170,12 @@ spec: containerPort: 9093 protocol: TCP {{- if or (gt (int .Values.replicaCount) 1) (.Values.additionalPeers) }} - - name: clusterpeer + - name: clusterpeer-tcp containerPort: {{ $svcClusterPort }} protocol: TCP + - name: clusterpeer-udp + containerPort: {{ $svcClusterPort }} + protocol: UDP {{- end }} livenessProbe: {{- toYaml .Values.livenessProbe | nindent 12 }} From 0b5da5885424897bb686295de981676f76d50acc Mon Sep 17 00:00:00 2001 From: Sam Mcbroom Date: Tue, 1 Aug 2023 07:55:28 -0700 Subject: [PATCH 13/13] Bump version. Signed-off-by: Sam Mcbroom --- charts/alertmanager/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/alertmanager/Chart.yaml b/charts/alertmanager/Chart.yaml index 96497674d135..b28f65d72b12 100644 --- a/charts/alertmanager/Chart.yaml +++ b/charts/alertmanager/Chart.yaml @@ -6,7 +6,7 @@ icon: https://raw.githubusercontent.com/prometheus/prometheus.github.io/master/a sources: - https://github.com/prometheus/alertmanager type: application -version: 1.1.0 +version: 1.2.0 appVersion: v0.25.0 kubeVersion: ">=1.19.0-0" keywords: