Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add envFromSecret to support loading environment variables from a K8S Secret #97

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions charts/localstack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ extraEnvVars:
value: "<your api key>"
```

You can also load the key from a Kubernetes secret:
```yaml
envFromSecret:
- name: LOCALSTACK_API_KEY
secret: localstack-secrets
key: API_KEY
```

And you can use these values when installing the chart in your cluster:
```bash
$ helm repo add localstack-charts https://localstack.github.io/helm-charts
Expand Down Expand Up @@ -116,6 +124,7 @@ The following table lists the configurable parameters of the Localstack chart an
| `mountDind.image` | Specify DinD image tag | `docker:20.10-dind` |
| `volumes` | Extra volumes to mount | `[]` |
| `volumeMounts` | Extra volumes to mount | `[]` |
| `envFromSecret` | Specify environment variables from a Kubernetes Secret | `[]`

[k8s-probe]: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-startup-probes/#configure-probes

Expand Down
7 changes: 7 additions & 0 deletions charts/localstack/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@ spec:
valueFrom:
fieldRef:
fieldPath: metadata.namespace
{{- range .Values.envFromSecret }}
- name: {{ .name }}
valueFrom:
secretKeyRef:
name: {{ .secret }}
key: {{ .key }}
{{- end }}
{{- if include "localstack.lambda.labels" . }}
- name: LAMBDA_K8S_LABELS
value: {{ include "localstack.lambda.labels" . | quote }}
Expand Down