From 9afaed4d37d10582d5bd3fc7e15a0ffe6cccda56 Mon Sep 17 00:00:00 2001 From: "James E. Blair" Date: Fri, 10 Jan 2020 13:49:33 -0800 Subject: [PATCH] Add option to manage secrets outside of helm So that a user can manage the nodepool config file (which is a secret) outside of helm, add an option where the user can specify the name of that secret as a value, and if it's set, helm will not write the secret and will tell k8s to mount that secret as the nodepool config instead. Change-Id: Ifa1b5e81b6c7700faef82f3b18aab157d042e735 --- charts/nodepool/templates/builder/statefulset.yaml | 2 +- charts/nodepool/templates/launcher/deployment.yaml | 2 +- charts/nodepool/templates/secret.yaml | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/charts/nodepool/templates/builder/statefulset.yaml b/charts/nodepool/templates/builder/statefulset.yaml index edad8d7..0671b61 100644 --- a/charts/nodepool/templates/builder/statefulset.yaml +++ b/charts/nodepool/templates/builder/statefulset.yaml @@ -40,7 +40,7 @@ spec: volumes: - name: nodepool-config secret: - secretName: {{ include "nodepool.fullname" . }} + secretName: {{ (empty .Values.config.secret) | ternary (include "nodepool.fullname" .) .Values.config.secret }} - name: nodepool-logs emptyDir: {} - name: dev diff --git a/charts/nodepool/templates/launcher/deployment.yaml b/charts/nodepool/templates/launcher/deployment.yaml index 5bd1b69..3a22048 100644 --- a/charts/nodepool/templates/launcher/deployment.yaml +++ b/charts/nodepool/templates/launcher/deployment.yaml @@ -31,7 +31,7 @@ spec: volumes: - name: nodepool-config secret: - secretName: {{ include "nodepool.fullname" . }} + secretName: {{ (empty .Values.config.secret) | ternary (include "nodepool.fullname" .) .Values.config.secret }} {{- with .Values.tolerations }} tolerations: {{ toYaml . | indent 8 }} diff --git a/charts/nodepool/templates/secret.yaml b/charts/nodepool/templates/secret.yaml index e55cf57..aca2054 100644 --- a/charts/nodepool/templates/secret.yaml +++ b/charts/nodepool/templates/secret.yaml @@ -1,4 +1,5 @@ --- +{{ if not .Values.config.secret }} apiVersion: v1 kind: Secret metadata: @@ -11,4 +12,5 @@ stringData: {{ toYaml .Values.config | indent 4 }} clouds.yaml: | clouds: -{{ toYaml .Values.clouds | indent 6 }} \ No newline at end of file +{{ toYaml .Values.clouds | indent 6 }} +{{ end }} \ No newline at end of file