Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(base-cluster/kube-prometheus-stack): only register healthcheck if enabled on both sides #1052

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions charts/base-cluster/ci/artifacthub-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ storage:
enabled: true
global:
clusterName: test
baseDomain: example.com
serviceLevelAgreement: None
monitoring:
grafana:
Expand Down
2 changes: 2 additions & 0 deletions charts/base-cluster/ci/deadmansswitch-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ monitoring:
enabled: true
pingKey: PING_KEY
apiKey: API_KEY
global:
baseDomain: example.com
2 changes: 1 addition & 1 deletion charts/base-cluster/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
===
You can access your grafana instance via

{{- if and .Values.certManager.email .Values.monitoring.grafana.ingress.enabled .Values.global.baseDomain }}
{{- if and .Values.certManager.email .Values.monitoring.grafana.ingress.enabled }}
{{- printf "https://%s" (include "base-cluster.grafana.host" $) | nindent 2 }}
{{- else }}
{{- printf "$ kubectl -n monitoring port-forward svc/kube-prometheus-stack-grafana 3000:http-web" | nindent 2 }}
Expand Down
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,7 +63,7 @@ spec:
curl --silent --show-error --fail --retry 5 --max-time 30 "https://hc-ping.com/$PING_KEY/$checkName"
tasches marked this conversation as resolved.
Show resolved Hide resolved
}

checkName={{- printf "k8s-cluster-%s-%s" (.Values.global.baseDomain | replace "." "-") .Values.global.clusterName | quote }}
checkName={{- include "base-cluster.deadMansSwitch.checkName" . | quote }}
{{- if .Values.monitoring.prometheus.enabled }}
createCheck "$checkName-monitoring"
{{- end }}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{- if .Values.monitoring.deadMansSwitch.enabled -}}
{{- if not .Values.global.baseDomain -}}
{{- fail "You need to provide a `.Values.global.baseDomain` when enabling the dead mans switch" -}}
{{- end -}}
{{- end -}}
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ config:
{{- $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