Skip to content

Commit d3f1040

Browse files
authored
Merge pull request #3192 from stelucz/main
Add env values from Secret in the same way as EBS CSI driver does
2 parents 70b2799 + f7596dd commit d3f1040

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

helm/aws-load-balancer-controller/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ The default values set by the application itself can be confirmed [here](https:/
237237
| `externalManagedTags` | Specifies the list of tag keys on AWS resources that are managed externally | `[]` |
238238
| `livenessProbe` | Liveness probe settings for the controller | (see `values.yaml`) |
239239
| `env` | Environment variables to set for aws-load-balancer-controller pod | None |
240+
| `envSecretName` | AWS credentials as environment variables from Secret (Secret keys `key_id` and `access_key`). | None |
240241
| `hostNetwork` | If `true`, use hostNetwork | `false` |
241242
| `dnsPolicy` | Set dnsPolicy if required | `ClusterFirst` |
242243
| `extraVolumeMounts` | Extra volume mounts for the pod | `[]` |

helm/aws-load-balancer-controller/templates/deployment.yaml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,29 @@ spec:
155155
{{- if ne .Values.defaultTargetType "instance" }}
156156
- --default-target-type={{ .Values.defaultTargetType }}
157157
{{- end }}
158-
{{- if .Values.env }}
158+
{{- if or .Values.env .Values.envSecretName }}
159159
env:
160+
{{- if .Values.env}}
160161
{{- range $key, $value := .Values.env }}
161162
- name: {{ $key }}
162163
value: "{{ $value }}"
163164
{{- end }}
164165
{{- end }}
166+
{{- if .Values.envSecretName }}
167+
- name: AWS_ACCESS_KEY_ID
168+
valueFrom:
169+
secretKeyRef:
170+
name: {{ .Values.envSecretName }}
171+
key: key_id
172+
optional: true
173+
- name: AWS_SECRET_ACCESS_KEY
174+
valueFrom:
175+
secretKeyRef:
176+
name: {{ .Values.envSecretName }}
177+
key: access_key
178+
optional: true
179+
{{- end }}
180+
{{- end }}
165181
securityContext:
166182
{{- toYaml .Values.securityContext | nindent 10 }}
167183
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"

helm/aws-load-balancer-controller/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,9 @@ env:
253253
# ENV_1: ""
254254
# ENV_2: ""
255255

256+
# Use Environment variables credentials from Secret (aws-secret) for aws-load-balancer-controller pod similarly as The EBS CSI Driver does.
257+
# envSecretName: aws-secret
258+
256259
# Specifies if aws-load-balancer-controller should be started in hostNetwork mode.
257260
#
258261
# This is required if using a custom CNI where the managed control plane nodes are unable to initiate

0 commit comments

Comments
 (0)