From c97c592216854374602d57e8d0bac9919e8af260 Mon Sep 17 00:00:00 2001 From: willxz Date: Mon, 20 Jul 2020 08:18:34 -0400 Subject: [PATCH] Change for alertmanager v0.20 - Update alertmanger and prometheus discovery port from 6783 to 9094 - Update to support fqdn for discovery hostname - Add one test alert to Prometheus to test alert pipeline - update container name from alertmanger to prometheus-alertmanager Change-Id: Iec5e758e4b576dff01e84591a2440d030d5ff3c4 --- .../templates/bin/_alertmanager.sh.tpl | 2 +- .../templates/clusterrolebinding.yaml | 2 +- .../templates/ingress-alertmanager.yaml | 2 +- .../templates/secret-ingress-tls.yaml | 2 +- .../templates/service-discovery.yaml | 6 ++-- .../service-ingress-alertmanager.yaml | 2 +- .../templates/service.yaml | 6 ++-- .../templates/statefulset.yaml | 36 +++++++++---------- prometheus-alertmanager/values.yaml | 16 ++++----- prometheus/values.yaml | 2 +- .../network-policy/050-prometheus.sh | 2 +- .../network-policy/060-alertmanager.sh | 2 +- 12 files changed, 40 insertions(+), 40 deletions(-) diff --git a/prometheus-alertmanager/templates/bin/_alertmanager.sh.tpl b/prometheus-alertmanager/templates/bin/_alertmanager.sh.tpl index b09dc2660..a9b4bf398 100644 --- a/prometheus-alertmanager/templates/bin/_alertmanager.sh.tpl +++ b/prometheus-alertmanager/templates/bin/_alertmanager.sh.tpl @@ -29,7 +29,7 @@ function generate_peers () { final_pod_suffix=$(( {{ .Values.pod.replicas.alertmanager }}-1 )) for pod_suffix in `seq 0 "$final_pod_suffix"` do - echo --cluster.peer={{ .Release.Name }}-$pod_suffix.$DISCOVERY_SVC:$MESH_PORT + echo --cluster.peer=prometheus-alertmanager-$pod_suffix.$DISCOVERY_SVC:$MESH_PORT done } diff --git a/prometheus-alertmanager/templates/clusterrolebinding.yaml b/prometheus-alertmanager/templates/clusterrolebinding.yaml index 20f091a9c..cb5086632 100644 --- a/prometheus-alertmanager/templates/clusterrolebinding.yaml +++ b/prometheus-alertmanager/templates/clusterrolebinding.yaml @@ -14,7 +14,7 @@ limitations under the License. {{- if .Values.manifests.clusterrolebinding }} {{- $envAll := . }} -{{- $serviceAccountName := printf "%s-%s" .Release.Name "alertmanager" }} +{{- $serviceAccountName := printf "%s" "prometheus-alertmanager" }} --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding diff --git a/prometheus-alertmanager/templates/ingress-alertmanager.yaml b/prometheus-alertmanager/templates/ingress-alertmanager.yaml index 6d499a3b5..8d3049255 100644 --- a/prometheus-alertmanager/templates/ingress-alertmanager.yaml +++ b/prometheus-alertmanager/templates/ingress-alertmanager.yaml @@ -13,6 +13,6 @@ limitations under the License. */}} {{- if and .Values.manifests.ingress .Values.network.alertmanager.ingress.public }} -{{- $ingressOpts := dict "envAll" . "backendService" "alertmanager" "backendServiceType" "alerts" "backendPort" "alerts-api" -}} +{{- $ingressOpts := dict "envAll" . "backendService" "alertmanager" "backendServiceType" "alertmanager" "backendPort" "alerts-api" -}} {{ $ingressOpts | include "helm-toolkit.manifests.ingress" }} {{- end }} diff --git a/prometheus-alertmanager/templates/secret-ingress-tls.yaml b/prometheus-alertmanager/templates/secret-ingress-tls.yaml index 966e8e42b..e3b8b79a5 100644 --- a/prometheus-alertmanager/templates/secret-ingress-tls.yaml +++ b/prometheus-alertmanager/templates/secret-ingress-tls.yaml @@ -13,5 +13,5 @@ limitations under the License. */}} {{- if .Values.manifests.secret_ingress_tls }} -{{- include "helm-toolkit.manifests.secret_ingress_tls" ( dict "envAll" . "backendServiceType" "alerts" "backendService" "alertmanager") }} +{{- include "helm-toolkit.manifests.secret_ingress_tls" ( dict "envAll" . "backendServiceType" "alertmanager" "backendService" "alertmanager") }} {{- end }} diff --git a/prometheus-alertmanager/templates/service-discovery.yaml b/prometheus-alertmanager/templates/service-discovery.yaml index 4171ab0db..8d63e82c2 100644 --- a/prometheus-alertmanager/templates/service-discovery.yaml +++ b/prometheus-alertmanager/templates/service-discovery.yaml @@ -18,13 +18,13 @@ limitations under the License. apiVersion: v1 kind: Service metadata: - name: {{ tuple "alerts" "discovery" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }} + name: {{ tuple "alertmanager" "discovery" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }} spec: type: ClusterIP clusterIP: None ports: - name: peer-mesh - port: {{ tuple "alerts" "internal" "mesh" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} + port: {{ tuple "alertmanager" "internal" "mesh" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} selector: -{{ tuple $envAll "alertmanager" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} +{{ tuple $envAll "prometheus-alertmanager" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} {{- end }} diff --git a/prometheus-alertmanager/templates/service-ingress-alertmanager.yaml b/prometheus-alertmanager/templates/service-ingress-alertmanager.yaml index 67aa1f849..8e33e420a 100644 --- a/prometheus-alertmanager/templates/service-ingress-alertmanager.yaml +++ b/prometheus-alertmanager/templates/service-ingress-alertmanager.yaml @@ -13,6 +13,6 @@ limitations under the License. */}} {{- if and .Values.manifests.service_ingress .Values.network.alertmanager.ingress.public }} -{{- $serviceIngressOpts := dict "envAll" . "backendServiceType" "alerts" -}} +{{- $serviceIngressOpts := dict "envAll" . "backendServiceType" "alertmanager" -}} {{ $serviceIngressOpts | include "helm-toolkit.manifests.service_ingress" }} {{- end }} diff --git a/prometheus-alertmanager/templates/service.yaml b/prometheus-alertmanager/templates/service.yaml index 134d48b6b..19d51befe 100644 --- a/prometheus-alertmanager/templates/service.yaml +++ b/prometheus-alertmanager/templates/service.yaml @@ -18,16 +18,16 @@ limitations under the License. apiVersion: v1 kind: Service metadata: - name: {{ tuple "alerts" "internal" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }} + name: {{ tuple "alertmanager" "internal" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }} spec: ports: - name: alerts-api {{ if .Values.network.alertmanager.node_port.enabled }} nodePort: {{ .Values.network.alertmanager.node_port.port }} {{ end }} - port: {{ tuple "alerts" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} + port: {{ tuple "alertmanager" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} selector: -{{ tuple $envAll "alertmanager" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} +{{ tuple $envAll "prometheus-alertmanager" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} {{ if .Values.network.alertmanager.node_port.enabled }} type: NodePort {{ end }} diff --git a/prometheus-alertmanager/templates/statefulset.yaml b/prometheus-alertmanager/templates/statefulset.yaml index b1f3cb70f..dfafc1715 100644 --- a/prometheus-alertmanager/templates/statefulset.yaml +++ b/prometheus-alertmanager/templates/statefulset.yaml @@ -18,45 +18,45 @@ limitations under the License. {{- $mounts_alertmanager := .Values.pod.mounts.alertmanager.alertmanager }} {{- $mounts_alertmanager_init := .Values.pod.mounts.alertmanager.init_container }} -{{- $serviceAccountName := "alertmanager" }} -{{ tuple $envAll "alertmanager" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} +{{- $serviceAccountName := "prometheus-alertmanager" }} +{{ tuple $envAll "prometheus-alertmanager" $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }} --- apiVersion: apps/v1 kind: StatefulSet metadata: - name: alertmanager + name: prometheus-alertmanager annotations: {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" }} labels: -{{ tuple $envAll "alertmanager" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} +{{ tuple $envAll "prometheus-alertmanager" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }} spec: - serviceName: {{ tuple "alerts" "discovery" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }} + serviceName: {{ tuple "alertmanager" "discovery" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }} podManagementPolicy: "Parallel" replicas: {{ .Values.pod.replicas.alertmanager }} selector: matchLabels: -{{ tuple $envAll "alertmanager" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} +{{ tuple $envAll "prometheus-alertmanager" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 6 }} template: metadata: labels: -{{ tuple $envAll "alertmanager" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} +{{ tuple $envAll "prometheus-alertmanager" "server" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }} configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} -{{ dict "envAll" $envAll "podName" "alertmanager" "containerNames" (list "alertmanager" "alertmanager-perms" "init") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }} +{{ dict "envAll" $envAll "podName" "alertmanager" "containerNames" (list "alertmanager" "alertmanager_perms" "init") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }} spec: {{ dict "envAll" $envAll "application" "server" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} serviceAccountName: {{ $serviceAccountName }} affinity: -{{ tuple $envAll "alertmanager" "server" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} +{{ tuple $envAll "prometheus-alertmanager" "server" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} nodeSelector: {{ .Values.labels.alertmanager.node_selector_key }}: {{ .Values.labels.alertmanager.node_selector_value | quote }} terminationGracePeriodSeconds: {{ .Values.pod.lifecycle.termination_grace_period.alertmanager.timeout | default "30" }} initContainers: {{ tuple $envAll "alertmanager" list | include "helm-toolkit.snippets.kubernetes_entrypoint_init_container" | indent 8 }} - - name: alertmanager-perms -{{ tuple $envAll "alertmanager" | include "helm-toolkit.snippets.image" | indent 10 }} + - name: prometheus-alertmanager-perms +{{ tuple $envAll "prometheus-alertmanager" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.alertmanager | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} {{ dict "envAll" $envAll "application" "server" "container" "alertmanager_perms" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} command: @@ -70,8 +70,8 @@ spec: - name: alertmanager-data mountPath: /var/lib/alertmanager/data containers: - - name: alertmanager -{{ tuple $envAll "alertmanager" | include "helm-toolkit.snippets.image" | indent 10 }} + - name: prometheus-alertmanager +{{ tuple $envAll "prometheus-alertmanager" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.alertmanager | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} {{ dict "envAll" $envAll "application" "server" "container" "alertmanager" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} command: @@ -85,18 +85,18 @@ spec: - stop env: - name: DISCOVERY_SVC - value: {{ tuple "alerts" "discovery" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }} + value: {{ tuple "alertmanager" "discovery" . | include "helm-toolkit.endpoints.hostname_fqdn_endpoint_lookup" }} - name: MESH_PORT - value: {{ tuple "alerts" "internal" "mesh" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | quote }} + value: {{ tuple "alertmanager" "internal" "mesh" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | quote }} ports: - name: alerts-api - containerPort: {{ tuple "alerts" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} + containerPort: {{ tuple "alertmanager" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} - name: peer-mesh - containerPort: {{ tuple "alerts" "internal" "mesh" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} + containerPort: {{ tuple "alertmanager" "internal" "mesh" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} readinessProbe: httpGet: path: /#/status - port: {{ tuple "alerts" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} + port: {{ tuple "alertmanager" "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 43a5d1475..389dae168 100644 --- a/prometheus-alertmanager/values.yaml +++ b/prometheus-alertmanager/values.yaml @@ -18,7 +18,7 @@ --- images: tags: - alertmanager: docker.io/prom/alertmanager:v0.20.0 + prometheus-alertmanager: docker.io/prom/alertmanager:v0.20.0 dep_check: quay.io/airshipit/kubernetes-entrypoint:v1.0.0 image_repo_sync: docker.io/docker:17.07.0 pull_policy: IfNotPresent @@ -101,13 +101,13 @@ endpoints: port: registry: node: 5000 - alerts: - name: alertmanager + alertmanager: + name: prometheus-alertmanager namespace: null hosts: default: alerts-engine - public: alertmanager - discovery: alertmanager-discovery + public: prometheus-alertmanager + discovery: prometheus-alertmanager-discovery host_fqdn_override: default: null # NOTE(srwilkers): this chart supports TLS for fqdn over-ridden public @@ -126,7 +126,7 @@ endpoints: default: 9093 public: 80 mesh: - default: 6783 + default: 9094 dependencies: dynamic: @@ -160,7 +160,7 @@ network: secrets: tls: - alerts: + alertmanager: alertmanager: public: alerts-tls-public @@ -197,7 +197,7 @@ conf: storage: path: /var/lib/alertmanager/data cluster: - listen_address: "0.0.0.0:6783" + listen_address: "0.0.0.0:9094" alertmanager: global: # The smarthost and SMTP sender used for mail notifications. diff --git a/prometheus/values.yaml b/prometheus/values.yaml index 34df171fe..793928313 100644 --- a/prometheus/values.yaml +++ b/prometheus/values.yaml @@ -174,7 +174,7 @@ endpoints: default: 9093 public: 80 mesh: - default: 6783 + default: 9094 ldap: hosts: default: ldap diff --git a/tools/deployment/network-policy/050-prometheus.sh b/tools/deployment/network-policy/050-prometheus.sh index 992287d65..d55ad0080 100755 --- a/tools/deployment/network-policy/050-prometheus.sh +++ b/tools/deployment/network-policy/050-prometheus.sh @@ -48,7 +48,7 @@ network_policy: - protocol: TCP port: 9090 - protocol: TCP - port: 6783 + port: 9094 - protocol: TCP port: 9108 - protocol: TCP diff --git a/tools/deployment/network-policy/060-alertmanager.sh b/tools/deployment/network-policy/060-alertmanager.sh index 6084a7e34..1b34d3c54 100755 --- a/tools/deployment/network-policy/060-alertmanager.sh +++ b/tools/deployment/network-policy/060-alertmanager.sh @@ -31,7 +31,7 @@ network_policy: - protocol: TCP port: 9093 - protocol: TCP - port: 6783 + port: 9094 - protocol: TCP port: 80 EOF