Skip to content

Commit 16bf032

Browse files
steluczlukasstehlikeset
authored andcommitted
Add env values from Secret in the same way as EBS CSI driver does
1 parent ff8c13d commit 16bf032

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
@@ -231,6 +231,7 @@ The default values set by the application itself can be confirmed [here](https:/
231231
| `externalManagedTags` | Specifies the list of tag keys on AWS resources that are managed externally | `[]` |
232232
| `livenessProbe` | Liveness probe settings for the controller | (see `values.yaml`) |
233233
| `env` | Environment variables to set for aws-load-balancer-controller pod | None |
234+
| `envFromSecret` | If `true`, use Environment variables from Secret (aws-secret) for aws-load-balancer-controller pod similarly as The EBS CSI Driver does. | `false` |
234235
| `hostNetwork` | If `true`, use hostNetwork | `false` |
235236
| `dnsPolicy` | Set dnsPolicy if required | `ClusterFirst` |
236237
| `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
@@ -149,13 +149,29 @@ spec:
149149
{{- if ne .Values.defaultTargetType "instance" }}
150150
- --default-target-type={{ .Values.defaultTargetType }}
151151
{{- end }}
152-
{{- if .Values.env }}
152+
{{- if or .Values.env .Values.envFromSecret | default false }}
153153
env:
154+
{{- if .Values.env}}
154155
{{- range $key, $value := .Values.env }}
155156
- name: {{ $key }}
156157
value: "{{ $value }}"
157158
{{- end }}
158159
{{- end }}
160+
{{- if .Values.envFromSecret | default false }}
161+
- name: AWS_ACCESS_KEY_ID
162+
valueFrom:
163+
secretKeyRef:
164+
name: aws-secret
165+
key: key_id
166+
optional: true
167+
- name: AWS_SECRET_ACCESS_KEY
168+
valueFrom:
169+
secretKeyRef:
170+
name: aws-secret
171+
key: access_key
172+
optional: true
173+
{{- end }}
174+
{{- end }}
159175
securityContext:
160176
{{- toYaml .Values.securityContext | nindent 10 }}
161177
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
@@ -247,6 +247,9 @@ env:
247247
# ENV_1: ""
248248
# ENV_2: ""
249249

250+
# Use Environment variables from Secret (aws-secret) for aws-load-balancer-controller pod similarly as The EBS CSI Driver does.
251+
# envFromSecret: true
252+
250253
# Specifies if aws-load-balancer-controller should be started in hostNetwork mode.
251254
#
252255
# This is required if using a custom CNI where the managed control plane nodes are unable to initiate

0 commit comments

Comments
 (0)