From bd1df7d66a16ccd8ddaacad6ec307a2d3cb295c7 Mon Sep 17 00:00:00 2001 From: ada-u Date: Wed, 13 Jan 2021 19:05:13 +0900 Subject: [PATCH] Refactor secret values --- charts/README.md | 6 +++--- charts/templates/_helpers.tpl | 4 ++-- charts/templates/secret.yaml | 4 ++-- charts/values.yaml | 9 ++++----- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/charts/README.md b/charts/README.md index 9f5db06..8121ad4 100644 --- a/charts/README.md +++ b/charts/README.md @@ -6,7 +6,7 @@ A Helm chart for [chatwork/sendgrid-stats-exporter](https://github.com/chatwork/ ## Installing the Chart ``` -$ helm install --set 'deployment.secret.apiKey=secret' --set 'deployment.secret.username=username' sendgrid-stats-exporter ./ +$ helm install --set 'secret.apiKey=secret' --set 'secret.username=username' sendgrid-stats-exporter ./ ``` ``` @@ -39,8 +39,8 @@ The following table lists the configurable parameters of the Sendgrid-stats-expo | `podSecurityContext` | Security context for the pod | `{}` | | `securityContext` | Security context for container | `{}` | | `envFrom` | Extra custom environment variables from ConfigMaps | `[]` | -| `deployment.secret.apiKey` | SendGrid api token | `{}` | -| `deployment.secret.username` | SendGrid username | `[]` | +| `secret.apiKey` | SendGrid api token | `{}` | +| `secret.username` | SendGrid username | `[]` | | `service.type` | Service Type | `"ClusterIP"` | | `service.port` | Service port | `9154` | | `ingress.enabled` | If true, enable Ingress | `false` | diff --git a/charts/templates/_helpers.tpl b/charts/templates/_helpers.tpl index 138feff..d1daaa5 100644 --- a/charts/templates/_helpers.tpl +++ b/charts/templates/_helpers.tpl @@ -65,9 +65,9 @@ Create the name of the service account to use Return secret name to be used based on provided values. */}} {{- define "sendgrid-stats-exporter.secretName" -}} -{{- if not .Values.deployment.secret.existingSecretName -}} +{{- if not .Values.secret.existingSecretName -}} {{ default (printf "%s-secret" (include "sendgrid-stats-exporter.fullname" . )) }} {{- else -}} - {{ .Values.deployment.secret.existingSecretName }} + {{ .Values.secret.existingSecretName }} {{- end -}} {{- end -}} \ No newline at end of file diff --git a/charts/templates/secret.yaml b/charts/templates/secret.yaml index b9157e1..63a766a 100644 --- a/charts/templates/secret.yaml +++ b/charts/templates/secret.yaml @@ -6,5 +6,5 @@ metadata: {{- include "sendgrid-stats-exporter.labels" . | nindent 4 }} type: Opaque data: - username: {{ .Values.deployment.secret.username | b64enc | quote }} - apiKey: {{ .Values.deployment.secret.apiKey | b64enc | quote }} \ No newline at end of file + username: {{ .Values.secret.username | b64enc | quote }} + apiKey: {{ .Values.secret.apiKey | b64enc | quote }} \ No newline at end of file diff --git a/charts/values.yaml b/charts/values.yaml index 541c0e2..729a537 100644 --- a/charts/values.yaml +++ b/charts/values.yaml @@ -29,11 +29,10 @@ securityContext: {} envFrom: [] -deployment: - secret: - existingSecretName: - username: "" - apiKey: "" +secret: + existingSecretName: + username: "" + apiKey: "" service: type: ClusterIP