Skip to content

Commit 1957bfb

Browse files
authored
Merge pull request #1332 from consideRatio/pr/z2jh-like-extraEnv
helm-chart: enhance extraEnv like in z2jh with jupyterhub.extraEnv helper
2 parents 90e9926 + 9b0faac commit 1957bfb

File tree

4 files changed

+36
-6
lines changed

4 files changed

+36
-6
lines changed

helm-chart/binderhub/schema.yaml

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,38 @@ properties:
492492
extraVolumes: *extraVolumes-spec
493493
extraVolumeMounts: *extraVolumeMounts-spec
494494
extraEnv:
495-
type: array
495+
type: [object, array]
496+
additionalProperties: true
496497
description: |
497-
Env to add to the binder Pods.
498+
Environment variables to add to the binder pods.
499+
500+
String literals with `$(ENV_VAR_NAME)` will be expanded by Kubelet which
501+
is a part of Kubernetes.
502+
503+
```yaml
504+
extraEnv:
505+
# basic notation (for literal values only)
506+
MY_ENV_VARS_NAME1: "my env var value 1"
507+
508+
# explicit notation (the "name" field takes precedence)
509+
BINDER_NAMESPACE:
510+
name: BINDER_NAMESPACE
511+
valueFrom:
512+
fieldRef:
513+
fieldPath: metadata.namespace
514+
515+
# implicit notation (the "name" field is implied)
516+
PREFIXED_BINDER_NAMESPACE:
517+
value: "my-prefix-$(BINDER_NAMESPACE)"
518+
SECRET_VALUE:
519+
valueFrom:
520+
secretKeyRef:
521+
name: my-k8s-secret
522+
key: password
523+
```
524+
525+
For more information, see the [Kubernetes EnvVar
526+
specification](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#envvar-v1-core).
498527
podAnnotations:
499528
type: object
500529
additionalProperties: false

helm-chart/binderhub/templates/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ spec:
117117
{{- end }}
118118
{{- end }}
119119
{{- with .Values.extraEnv }}
120-
{{- . | toYaml | nindent 8 }}
120+
{{- include "jupyterhub.extraEnv" . | nindent 8 }}
121121
{{- end }}
122122
ports:
123123
- containerPort: 8585

helm-chart/binderhub/values.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,5 +216,5 @@ initContainers: []
216216
lifecycle: {}
217217
extraVolumes: []
218218
extraVolumeMounts: []
219-
extraEnv: []
219+
extraEnv: {}
220220
podAnnotations: {}

tools/templates/lint-and-validate-values.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,9 @@ lifecycle: *lifecycle
147147
extraVolumes: []
148148
extraVolumeMounts: []
149149
extraEnv: &extraEnv
150-
- name: MOCK_ENV_VAR_NAME1
150+
IGNORED_KEY_NAME:
151+
name: MOCK_ENV_VAR_NAME1
151152
value: MOCK_ENV_VAR_VALUE1
152-
- name: MOCK_ENV_VAR_NAME2
153+
MOCK_ENV_VAR_NAME2:
153154
value: MOCK_ENV_VAR_VALUE2
154155
podAnnotations: *annotations

0 commit comments

Comments
 (0)