Skip to content

Commit

Permalink
fix(base-cluster/kube-prometheus-stack): only register healthcheck if…
Browse files Browse the repository at this point in the history
… enabled on both sides
  • Loading branch information
cwrau committed Jul 29, 2024
1 parent 1a86629 commit a3640a3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
)
Expand Down
Empty file.

0 comments on commit a3640a3

Please sign in to comment.