Skip to content

Commit

Permalink
[alertmanager] Add additional configuration options. (#3620)
Browse files Browse the repository at this point in the history
* [alertmanager] Add additional configuration options.

Signed-off-by: Sam Mcbroom <[email protected]>

* Use port names.

Signed-off-by: Sam Mcbroom <[email protected]>

* Extra volume mounts for config reloader.

Signed-off-by: Sam Mcbroom <[email protected]>

* Add extraEnv value for config reloader.

Signed-off-by: Sam Mcbroom <[email protected]>

* Allow restricting config-reloader to only watch specific file.

Signed-off-by: Sam Mcbroom <[email protected]>

* Allow configuring reload endpoint for config reloader.

Signed-off-by: Sam Mcbroom <[email protected]>

* Fix comments in values.yaml.

Signed-off-by: Sam Mcbroom <[email protected]>

* Allow exposing extra ports on the services.

Signed-off-by: Sam Mcbroom <[email protected]>

* Default value for service.extraPorts.

Signed-off-by: Sam Mcbroom <[email protected]>

* Remove unused service port protocol.

Signed-off-by: Sam Mcbroom <[email protected]>

* Fix helm.

Signed-off-by: Sam Mcbroom <[email protected]>

* Enabled UDP port for cluster peer communication.

Signed-off-by: Sam Mcbroom <[email protected]>

* Bump version.

Signed-off-by: Sam Mcbroom <[email protected]>

---------

Signed-off-by: Sam Mcbroom <[email protected]>
  • Loading branch information
sam-mcbr authored Aug 7, 2023
1 parent 436e336 commit 116493a
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 3 deletions.
2 changes: 1 addition & 1 deletion charts/alertmanager/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
10 changes: 8 additions & 2 deletions charts/alertmanager/templates/services.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,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 }}
---
Expand All @@ -53,13 +56,16 @@ spec:
name: http
{{- if or (gt (int .Values.replicaCount) 1) (.Values.additionalPeers) }}
- port: {{ .Values.service.clusterPort }}
targetPort: {{ .Values.service.clusterPort }}
targetPort: clusterpeer-tcp
protocol: TCP
name: cluster-tcp
- port: {{ .Values.service.clusterPort }}
targetPort: {{ .Values.service.clusterPort }}
targetPort: clusterpeer-udp
protocol: UDP
name: cluster-udp
{{- end }}
{{- with .Values.service.extraPorts }}
{{- toYaml . | nindent 4 }}
{{- end }}
selector:
{{- include "alertmanager.selectorLabels" . | nindent 4 }}
24 changes: 24 additions & 0 deletions charts/alertmanager/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,20 @@ 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:
{{- 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") }}
- --reload-url=http://127.0.0.1:9093/-/reload
{{- end }}
{{- range $key, $value := .Values.configmapReload.extraArgs }}
- --{{ $key }}={{ $value }}
{{- end }}
resources:
{{- toYaml .Values.configmapReload.resources | nindent 12 }}
{{- with .Values.configmapReload.containerPort }}
Expand All @@ -109,6 +120,9 @@ spec:
volumeMounts:
- name: config
mountPath: /etc/alertmanager
{{- if .Values.configmapReload.extraVolumeMounts }}
{{- toYaml .Values.configmapReload.extraVolumeMounts | nindent 12 }}
{{- end }}
{{- end }}
- name: {{ .Chart.Name }}
securityContext:
Expand All @@ -130,7 +144,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 }}
Expand All @@ -153,6 +169,14 @@ spec:
- name: http
containerPort: 9093
protocol: TCP
{{- if or (gt (int .Values.replicaCount) 1) (.Values.additionalPeers) }}
- name: clusterpeer-tcp
containerPort: {{ $svcClusterPort }}
protocol: TCP
- name: clusterpeer-udp
containerPort: {{ $svcClusterPort }}
protocol: UDP
{{- end }}
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
Expand Down
16 changes: 16 additions & 0 deletions charts/alertmanager/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,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: ""
Expand Down Expand Up @@ -245,6 +248,19 @@ configmapReload:
##
resources: {}

extraArgs: {}

## Optionally specify extra list of additional volumeMounts
extraVolumeMounts: []
# - name: extras
# mountPath: /usr/share/extras
# readOnly: true

## Optionally specify extra environment variables to add to alertmanager container
extraEnv: []
# - name: FOO
# value: BAR

templates: {}
# alertmanager.tmpl: |-

Expand Down

0 comments on commit 116493a

Please sign in to comment.