From 0a2615e24b4cb259f3df350992544b656073ad17 Mon Sep 17 00:00:00 2001 From: Grace Do Date: Thu, 30 Jan 2020 18:34:46 -0800 Subject: [PATCH] kommander: Only copy opsportal secret username --- ...-secret.yaml => opsportal-username-secret.yaml} | 14 +++++++------- stable/kommander/values.yaml | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) rename stable/kommander/templates/grafana/{opsportal-credentials-secret.yaml => opsportal-username-secret.yaml} (66%) diff --git a/stable/kommander/templates/grafana/opsportal-credentials-secret.yaml b/stable/kommander/templates/grafana/opsportal-username-secret.yaml similarity index 66% rename from stable/kommander/templates/grafana/opsportal-credentials-secret.yaml rename to stable/kommander/templates/grafana/opsportal-username-secret.yaml index 39c642b011..fb72262d7c 100644 --- a/stable/kommander/templates/grafana/opsportal-credentials-secret.yaml +++ b/stable/kommander/templates/grafana/opsportal-username-secret.yaml @@ -2,7 +2,7 @@ apiVersion: batch/v1 kind: Job metadata: - name: copy-opsportal-credentials-secret + name: copy-{{ .Values.grafana.hooks.secretKeyRef }} namespace: {{ .Release.Namespace }} labels: {{ include "kommander.labels" . | indent 4 }} @@ -13,7 +13,7 @@ metadata: spec: template: metadata: - name: copy-opsportal-credentials-secret + name: copy-{{ .Values.grafana.hooks.secretKeyRef }} spec: containers: - name: kubectl @@ -23,13 +23,13 @@ spec: command: - /bin/sh - -c - - kubectl get secret ops-portal-credentials --namespace=kubeaddons --export -o yaml | kubectl apply --namespace={{ .Release.Namespace }} -f - + - kubectl create secret generic {{ .Values.grafana.hooks.secretKeyRef }} -n {{ .Release.Namespace }} --from-literal=username=$(kubectl get secret ops-portal-credentials --namespace=kubeaddons --export -o jsonpath="{.data.username}" | base64 --decode) restartPolicy: OnFailure --- apiVersion: batch/v1 kind: Job metadata: - name: cleanup-opsportal-credentials-secret + name: cleanup-{{ .Values.grafana.hooks.secretKeyRef }} namespace: {{ .Release.Namespace }} labels: {{ include "kommander.labels" . | indent 4 }} @@ -40,7 +40,7 @@ metadata: spec: template: metadata: - name: cleanup-opsportal-credentials-secret + name: cleanup-{{ .Values.grafana.hooks.secretKeyRef }} spec: serviceAccountName: {{ .Values.grafana.hooks.kommanderServiceAccount }} containers: @@ -50,6 +50,6 @@ spec: command: - /bin/sh - -c - - kubectl delete secret ops-portal-credentials --namespace={{ .Release.Namespace }} + - kubectl delete secret {{ .Values.grafana.hooks.secretKeyRef }} --namespace={{ .Release.Namespace }} restartPolicy: OnFailure -{{- end }} \ No newline at end of file +{{- end }} diff --git a/stable/kommander/values.yaml b/stable/kommander/values.yaml index fd455733e5..70e7d8f348 100644 --- a/stable/kommander/values.yaml +++ b/stable/kommander/values.yaml @@ -81,7 +81,7 @@ grafana: hooks: jobName: set-kommander-grafana-home-dashboard image: dwdraju/alpine-curl-jq - secretKeyRef: ops-portal-credentials + secretKeyRef: ops-portal-username serviceURL: http://kommander-kubeaddons-grafana.kommander # This is the UID of the "Kubernetes / Compute Resources / Clusters" summary dashboard homeDashboardUID: efa86fd1d0c121a26444b636a3f509a8