Skip to content

Commit f3fed73

Browse files
Support 'cull connected kernels' as a config in helm and create a way to dynamically pass other environments variables to helm deployment (#1231)
* support cull connected kernels as config in helm * support passing multiple env vars dynamically * add documentation * add missing env keywords to fix helm lint * change example to current env variables that eg actually use * change example to a random string instead of EG_ env vars * address yaml boolean in doc for cullConnected Signed-off-by: Luong Vo <[email protected]> Signed-off-by: Luong Vo <[email protected]>
1 parent eb88e1b commit f3fed73

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

docs/source/operators/deploy-kubernetes.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,13 +474,15 @@ can override them with helm's `--set` or `--values` options. Always use `--set`
474474
| `deployment.terminationGracePeriodSeconds` | Time to wait for Enterprise Gateway to gracefully shutdown. | `30` |
475475
| `deployment.resources` | set Enterprise Gateway container resources. | valid Yaml resources, see values file for example |
476476
| `deployment.replicas` | Update to deploy multiple replicas of EG. | `1` |
477+
| `deployment.extraEnv` | Additional environment variables to set for Enterprise Gateway. | `{}` |
477478
| `logLevel` | Log output level. | `DEBUG` |
478479
| `mirrorWorkingDirs` | Whether to mirror working directories. NOTE: This requires appropriate volume mounts to make notebook dir accessible. | `false` |
479480
| `authToken` | Optional authorization token passed in all requests (see --EnterpriseGatewayApp.auth_token) | `nil` |
480481
| `kernel.clusterRole` | Kernel cluster role created by this chart. Used if no KERNEL_NAMESPACE is provided by client. | `kernel-controller` |
481482
| `kernel.shareGatewayNamespace` | Will start kernels in the same namespace as EG if True. | `false` |
482483
| `kernel.launchTimeout` | Timeout for kernel launching in seconds. | `60` |
483484
| `kernel.cullIdleTimeout` | Idle timeout in seconds. Default is 1 hour. | `3600` |
485+
| `kernel.cullConnected` | Whether to cull idle kernels that still have clients connected. | `false` |
484486
| `kernel.allowedKernels` | List of kernel names that are available for use. | `{r_kubernetes,...}` (see `values.yaml`) |
485487
| `kernel.defaultKernelName` | Default kernel name should be something from the allowedKernels | `python-kubernetes` |
486488
| `kernelspecs.image` | Optional custom data image containing kernelspecs to use. Cannot be used with NFS enabled. | `nil` |

etc/kubernetes/helm/enterprise-gateway/templates/deployment.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ spec:
6565
value: {{ if .Values.mirrorWorkingDirs }}"True"{{ else }}"False"{{ end }}
6666
- name: EG_CULL_IDLE_TIMEOUT
6767
value: !!str {{ .Values.kernel.cullIdleTimeout }}
68+
- name: EG_CULL_CONNECTED
69+
value: {{ if .Values.kernel.cullConnected }}"True"{{ else }}"False"{{ end }}
6870
- name: EG_LOG_LEVEL
6971
value: {{ .Values.logLevel }}
7072
- name: EG_KERNEL_LAUNCH_TIMEOUT
@@ -78,6 +80,13 @@ spec:
7880
- name: EG_AUTH_TOKEN
7981
value: {{ .Values.authToken }}
8082
{{- end }}
83+
{{- if .Values.deployment.extraEnv }}
84+
{{- range $key, $val := .Values.deployment.extraEnv }}
85+
- name: {{ $key }}
86+
value: |-
87+
{{ $val | indent 12 }}
88+
{{- end }}
89+
{{- end }}
8190
ports:
8291
{{ with index .Values.service.ports 0 }}
8392
- containerPort: {{ .port }}

etc/kubernetes/helm/enterprise-gateway/values.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,16 @@ deployment:
6262
tolerations: []
6363
affinity: {}
6464
nodeSelector: {}
65+
extraEnv: {}
66+
# SOME_ENV_VAR_WITH_SIMPLE_VALUE: "example"
67+
# SOME_ENV_VAR_WITH_LONG_VALUE: >
68+
# 'this example',
69+
# 'will not preserve',
70+
# 'line breaks',
71+
# SOME_ENV_VAR_WITH_MULTILINE_VALUE: |
72+
# this example
73+
# will preserve
74+
# line breaks
6575

6676
# Log output level.
6777
logLevel: DEBUG
@@ -79,6 +89,8 @@ kernel:
7989
launchTimeout: 60
8090
# Timeout for an idle kernel before its culled in seconds. Default is 1 hour.
8191
cullIdleTimeout: 3600
92+
# Whether to cull idle kernels with connecting clients
93+
cullConnected: false
8294
# List of kernel names that are available for use. To allow additional kernelspecs without
8395
# requiring redeployment (and assuming kernelspecs are mounted or otherwise accessible
8496
# outside the pod), comment out (or remove) the entries, leaving only `allowedKernels:`.

0 commit comments

Comments
 (0)