From 657646b1bd886f68b6b8c24dd885b081735b1b5b Mon Sep 17 00:00:00 2001 From: Steve Wilkerson Date: Mon, 5 Mar 2018 10:33:30 -0600 Subject: [PATCH] Alertmanager: use endpoints section and lookups to set port This PS moves alertmanager to use the endpoints section and lookups to set the ports it serves on. Change-Id: I62108ca207f615d10d0b4385da204214b9aeae32 --- .../templates/bin/_alertmanager.sh.tpl | 2 +- prometheus-alertmanager/templates/service-discovery.yaml | 2 +- prometheus-alertmanager/templates/service.yaml | 2 +- prometheus-alertmanager/templates/statefulset.yaml | 8 +++++--- prometheus-alertmanager/values.yaml | 2 -- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/prometheus-alertmanager/templates/bin/_alertmanager.sh.tpl b/prometheus-alertmanager/templates/bin/_alertmanager.sh.tpl index a6e08849d..26f6a9183 100644 --- a/prometheus-alertmanager/templates/bin/_alertmanager.sh.tpl +++ b/prometheus-alertmanager/templates/bin/_alertmanager.sh.tpl @@ -31,7 +31,7 @@ function generate_peers () { final_pod_suffix=$(( {{ .Values.pod.replicas.alertmanager }}-1 )) for pod_suffix in `seq 0 "$final_pod_suffix"` do - echo -mesh.peer={{ .Release.Name }}-$pod_suffix.$DISCOVERY_SVC:6783 + echo -mesh.peer={{ .Release.Name }}-$pod_suffix.$DISCOVERY_SVC:$MESH_PORT done } diff --git a/prometheus-alertmanager/templates/service-discovery.yaml b/prometheus-alertmanager/templates/service-discovery.yaml index ba82edf58..9485f3666 100644 --- a/prometheus-alertmanager/templates/service-discovery.yaml +++ b/prometheus-alertmanager/templates/service-discovery.yaml @@ -26,7 +26,7 @@ spec: clusterIP: None ports: - name: peer-mesh - port: {{ .Values.network.alertmanager.mesh_port }} + port: {{ tuple "alerts" "internal" "mesh" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} selector: {{ tuple $envAll "alertmanager" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} {{- end }} diff --git a/prometheus-alertmanager/templates/service.yaml b/prometheus-alertmanager/templates/service.yaml index fb17dfca3..9667ac26e 100644 --- a/prometheus-alertmanager/templates/service.yaml +++ b/prometheus-alertmanager/templates/service.yaml @@ -27,7 +27,7 @@ spec: {{ if .Values.network.alertmanager.node_port.enabled }} nodePort: {{ .Values.network.alertmanager.node_port.port }} {{ end }} - port: {{ .Values.network.alertmanager.port }} + port: {{ tuple "alerts" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} selector: {{ tuple $envAll "alertmanager" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} {{ if .Values.network.alertmanager.node_port.enabled }} diff --git a/prometheus-alertmanager/templates/statefulset.yaml b/prometheus-alertmanager/templates/statefulset.yaml index 0cb683180..374dcd6e1 100644 --- a/prometheus-alertmanager/templates/statefulset.yaml +++ b/prometheus-alertmanager/templates/statefulset.yaml @@ -81,15 +81,17 @@ spec: env: - name: DISCOVERY_SVC value: {{ tuple "alerts" "discovery" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }} + - name: MESH_PORT + value: {{ tuple "alerts" "internal" "mesh" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | quote }} ports: - name: alerts-api - containerPort: {{ .Values.network.alertmanager.port }} + containerPort: {{ tuple "alerts" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} - name: peer-mesh - containerPort: {{ .Values.network.alertmanager.mesh_port }} + containerPort: {{ tuple "alerts" "internal" "mesh" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} readinessProbe: httpGet: path: /#/status - port: {{ .Values.network.alertmanager.port }} + port: {{ tuple "alerts" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} initialDelaySeconds: 30 timeoutSeconds: 30 volumeMounts: diff --git a/prometheus-alertmanager/values.yaml b/prometheus-alertmanager/values.yaml index 2df5acca7..75180e612 100644 --- a/prometheus-alertmanager/values.yaml +++ b/prometheus-alertmanager/values.yaml @@ -133,8 +133,6 @@ network: node_port: enabled: false port: 30903 - port: 9093 - mesh_port: 6783 storage: enabled: true