Skip to content

Commit

Permalink
kommander: Set home dashboard in regular job instead of post-install
Browse files Browse the repository at this point in the history
  • Loading branch information
gracedo committed Jan 28, 2020
1 parent 0237a53 commit ac3a752
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions stable/kommander/templates/grafana/hooks-home-dashboard.yaml
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
{{- if .Values.grafana.enabled }}
---
# Unable to get post-install job hook working, which is why
# this is a regular Job. The retries in the configmap script
# should ensure that this successfully runs once the Grafana
# server is up.
apiVersion: batch/v1
kind: Job
metadata:
name: {{ .Values.grafana.hooks.jobName | quote }}
namespace: {{ .Release.Namespace }}
labels:
{{ include "kommander.labels" . | indent 4 }}
annotations:
helm.sh/hook: post-install
helm.sh/hook-weight: "-4"
helm.sh/hook-delete-policy: hook-succeeded,before-hook-creation
spec:
template:
metadata:
name: {{ .Values.grafana.hooks.jobName | quote }}
spec:
restartPolicy: Never
containers:
- name: post-install-job
- name: {{ .Values.grafana.hooks.jobName | quote }}
image: {{ .Values.grafana.hooks.image | quote }}
command: ["/bin/sh", "-c", "/job/run.sh"]
env:
Expand Down Expand Up @@ -46,7 +46,7 @@ data:
set -o nounset
set -o errexit
set -o pipefail
CURL="curl --verbose --fail --max-time 60 --retry 10 --retry-connrefused"
CURL="curl --verbose --fail --max-time 30 --retry 20 --retry-connrefused""
DASHBOARD_ID=$($CURL -H "X-Forwarded-User: $X_FORWARDED_USER" {{ .Values.grafana.hooks.serviceURL }}/api/dashboards/uid/{{ .Values.grafana.hooks.homeDashboardUID }} | jq '.dashboard.id')
echo "setting home dashboard to ID" $DASHBOARD_ID
$CURL -X PUT -H "Content-Type: application/json" -H "X-Forwarded-User: $X_FORWARDED_USER" -d '{"homeDashboardId":'"$DASHBOARD_ID"'}' {{ .Values.grafana.hooks.serviceURL }}/api/org/preferences
Expand Down

0 comments on commit ac3a752

Please sign in to comment.