Skip to content

Commit

Permalink
kommander: Ensure cleanup jobs use SA with necessary roles
Browse files Browse the repository at this point in the history
  • Loading branch information
gracedo committed Jan 28, 2020
1 parent 4c32f8f commit 0237a53
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 6 deletions.
5 changes: 3 additions & 2 deletions stable/kommander/templates/grafana/hooks-home-dashboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ metadata:
{{ include "kommander.labels" . | indent 4 }}
annotations:
helm.sh/hook: post-install
helm.sh/hook-weight: "-5"
helm.sh/hook-weight: "-4"
helm.sh/hook-delete-policy: hook-succeeded,before-hook-creation
spec:
template:
Expand Down Expand Up @@ -60,13 +60,14 @@ metadata:
{{ include "kommander.labels" . | indent 4 }}
annotations:
"helm.sh/hook": pre-delete
"helm.sh/hook-weight": "-5"
"helm.sh/hook-weight": "5"
"helm.sh/hook-delete-policy": hook-succeeded
spec:
template:
metadata:
name: cleanup-{{ .Values.grafana.hooks.jobName }}
spec:
serviceAccountName: {{ .Values.grafana.hooks.kommanderServiceAccount }}
containers:
- name: kubectl
image: bitnami/kubectl:1.16.2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@ metadata:
{{ include "kommander.labels" . | indent 4 }}
annotations:
"helm.sh/hook": pre-delete
"helm.sh/hook-weight": "-4"
"helm.sh/hook-weight": "5"
"helm.sh/hook-delete-policy": hook-succeeded
spec:
template:
metadata:
name: cleanup-opsportal-credentials-secret
spec:
serviceAccountName: {{ .Values.grafana.hooks.kommanderServiceAccount }}
containers:
- name: kubectl
image: bitnami/kubectl:1.16.2
Expand Down
9 changes: 6 additions & 3 deletions stable/kommander/templates/hooks-kubeaddons.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ metadata:
labels:
{{ include "kommander.labels" . | indent 4 }}
annotations:
"helm.sh/hook": "pre-install"
"helm.sh/hook": pre-install,pre-delete
"helm.sh/hook-weight": "1"
"helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation
rules:
Expand All @@ -27,7 +27,7 @@ metadata:
labels:
{{ include "kommander.labels" . | indent 4 }}
annotations:
"helm.sh/hook": "pre-install"
"helm.sh/hook": pre-install,pre-delete
"helm.sh/hook-weight": "2"
"helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation
roleRef:
Expand All @@ -38,6 +38,9 @@ subjects:
- kind: ServiceAccount
name: default
namespace: {{ .Release.Namespace }}
- kind: ServiceAccount
name: {{ template "kommander.fullname" . }}
namespace: {{ .Release.Namespace }}
---
apiVersion: batch/v1
kind: Job
Expand All @@ -47,7 +50,7 @@ metadata:
labels:
{{ include "kommander.labels" . | indent 4 }}
annotations:
"helm.sh/hook": "pre-install"
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "3"
"helm.sh/hook-delete-policy": hook-succeeded,before-hook-creation
spec:
Expand Down
1 change: 1 addition & 0 deletions stable/kommander/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ grafana:
secretKeyRef: ops-portal-credentials
serviceURL: http://kommander-kubeaddons-grafana.kommander
homeDashboardUID: efa86fd1d0c121a26444b636a3f509a8
kommanderServiceAccount: kommander-kubeaddons

## Do not deploy default dashboards.
##
Expand Down

0 comments on commit 0237a53

Please sign in to comment.