From c266df487ea6caebc74153f9805e7ccc07e3ad48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cezar=20S=C3=A1=20Espinola?= Date: Wed, 25 Sep 2019 13:16:02 -0300 Subject: [PATCH] [stable/cluster-autoscaler] Allow individual envs from secrets (#16901) This commit adds the `extraEnvSecrets` config to be a map in the format: ``` envFromSecret: : name: key: ``` This adds more flexibility by allowing to expose selected keys from a secret and also allowing for a different name for the env variable. The new behavior is identical to the existing `envFromConfigMap` config. Signed-off-by: Cezar Sa Espinola --- stable/cluster-autoscaler/Chart.yaml | 2 +- stable/cluster-autoscaler/README.md | 5 +++-- stable/cluster-autoscaler/templates/deployment.yaml | 7 +++++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/stable/cluster-autoscaler/Chart.yaml b/stable/cluster-autoscaler/Chart.yaml index 4f7b157474..fc631c78bb 100644 --- a/stable/cluster-autoscaler/Chart.yaml +++ b/stable/cluster-autoscaler/Chart.yaml @@ -2,7 +2,7 @@ apiVersion: v1 description: Scales worker nodes within autoscaling groups. icon: https://github.com/kubernetes/kubernetes/blob/master/logo/logo.png name: cluster-autoscaler -version: 4.0.1 +version: 4.1.0 appVersion: 1.13.7 home: https://github.com/kubernetes/autoscaler sources: diff --git a/stable/cluster-autoscaler/README.md b/stable/cluster-autoscaler/README.md index 465339a85b..138478636f 100644 --- a/stable/cluster-autoscaler/README.md +++ b/stable/cluster-autoscaler/README.md @@ -148,8 +148,9 @@ Parameter | Description | Default `extraArgs` | additional container arguments | `{}` `podDisruptionBudget` | Pod disruption budget | `maxUnavailable: 1` `extraEnv` | additional container environment variables | `{}` -`envFromConfigMap` | additional container environment variables from a configmap | `[]` -`envFromSecret` | additional container environment variables from secret | `nil` +`envFromConfigMap` | additional container environment variables from a configmap | `{}` +`envFromSecret` | secret name containing keys that will be exposed as envs | `nil` +`extraEnvSecrets` | additional container environment variables from a secret | `{}` `nodeSelector` | node labels for pod assignment | `{}` `podAnnotations` | annotations to add to each pod | `{}` `deployment.apiVersion` | apiVersion for the deployment | `extensions/v1beta1` diff --git a/stable/cluster-autoscaler/templates/deployment.yaml b/stable/cluster-autoscaler/templates/deployment.yaml index 62d17822af..625a9d35bc 100644 --- a/stable/cluster-autoscaler/templates/deployment.yaml +++ b/stable/cluster-autoscaler/templates/deployment.yaml @@ -149,6 +149,13 @@ spec: name: {{ default (include "cluster-autoscaler.fullname" $) $value.name }} key: {{ required "Must specify key!" $value.key }} {{- end }} + {{- range $key, $value := .Values.extraEnvSecrets }} + - name: {{ $key }} + valueFrom: + secretKeyRef: + name: {{ default (include "cluster-autoscaler.fullname" $) $value.name }} + key: {{ required "Must specify key!" $value.key }} + {{- end }} {{- if .Values.envFromSecret }} envFrom: - secretRef: