From a3640a3c6b3a1acb4eeda49a5c7f1ec5b02ed637 Mon Sep 17 00:00:00 2001 From: Chris Werner Rau Date: Mon, 29 Jul 2024 13:39:12 +0200 Subject: [PATCH] fix(base-cluster/kube-prometheus-stack): only register healthcheck if enabled on both sides --- .../templates/monitoring/deadMansSwitch/registration.yaml | 8 ++++++-- .../kube-prometheus-stack/_alertmanager-config.yaml | 4 ++-- .../anynines-klutch/templates/NOTES.txt | 0 3 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 charts/crossplane-anynines/anynines-klutch/templates/NOTES.txt diff --git a/charts/base-cluster/templates/monitoring/deadMansSwitch/registration.yaml b/charts/base-cluster/templates/monitoring/deadMansSwitch/registration.yaml index 07cf27e905..dc14b5178d 100644 --- a/charts/base-cluster/templates/monitoring/deadMansSwitch/registration.yaml +++ b/charts/base-cluster/templates/monitoring/deadMansSwitch/registration.yaml @@ -1,3 +1,7 @@ +{{- define "base-cluster.deadMansSwitch.checkName" -}} + {{- printf "k8s-cluster-%s-%s" (.Values.global.baseDomain | replace "." "-") .Values.global.clusterName }} +{{- end -}} + {{- if .Values.monitoring.deadMansSwitch.enabled }} apiVersion: batch/v1 kind: Job @@ -59,8 +63,8 @@ spec: curl --silent --show-error --fail --retry 5 --max-time 30 "https://hc-ping.com/$PING_KEY/$checkName" } - checkName={{- printf "k8s-cluster-%s-%s" (.Values.global.baseDomain | replace "." "-") .Values.global.clusterName | quote }} - {{- if .Values.monitoring.prometheus.enabled }} + checkName={{- include "base-cluster.deadMansSwitch.checkName" . | quote }} + {{- if and .Values.monitoring.prometheus.enabled .Values.monitoring.deadMansSwitch.enabled }} createCheck "$checkName-monitoring" {{- end }} createCheck "$checkName-scheduling" diff --git a/charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml b/charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml index 745e5b3862..90c4727e02 100644 --- a/charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml +++ b/charts/base-cluster/templates/monitoring/kube-prometheus-stack/_alertmanager-config.yaml @@ -45,10 +45,10 @@ config: ) -}} {{- end -}} - {{- if and .Values.monitoring.deadMansSwitch.enabled .Values.global.baseDomain .Values.global.clusterName -}} + {{- if and .Values.monitoring.deadMansSwitch.enabled -}} {{- $receivers = set $receivers "healthchecks.io" (dict "webhook_configs" (list (dict - "url" (printf "https://hc-ping.com/%s/k8s-cluster-%s-%s-monitoring" .Values.monitoring.deadMansSwitch.pingKey (.Values.global.baseDomain | replace "." "-") .Values.global.clusterName) + "url" (printf "https://hc-ping.com/%s/%s" .Values.monitoring.deadMansSwitch.pingKey (include "base-cluster.deadMansSwitch.checkName" .)) "send_resolved" false ) ) diff --git a/charts/crossplane-anynines/anynines-klutch/templates/NOTES.txt b/charts/crossplane-anynines/anynines-klutch/templates/NOTES.txt new file mode 100644 index 0000000000..e69de29bb2