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

[Part 7 of #758] Added singleuser.tolerations, for node taints #925

Merged
merged 2 commits into from
Sep 20, 2018
Merged
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
2 changes: 2 additions & 0 deletions images/hub/jupyterhub_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@
('node_selector', 'node-selector'),
):
set_config_if_not_none(c.KubeSpawner, trait, 'singleuser.' + cfg_key)
c.KubeSpawner.storage_extra_labels = get_config('singleuser.storage-extra-labels', {})

c.KubeSpawner.image_spec = get_config('singleuser.image-spec')
c.KubeSpawner.tolerations.extend(get_config('singleuser.tolerations', []))
# Configure dynamically provisioning pvc
storage_type = get_config('singleuser.storage.type')
if storage_type == 'dynamic':
Expand Down
16 changes: 16 additions & 0 deletions jupyterhub/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,22 @@ properties:
description: |
Deprecated and no longer does anything. Use the user-scheduler instead
in order to accomplish a good packing of the user pods.
extraTolerations:
type: list
description: |
Tolerations allow a pod to be scheduled on nodes with taints. These
are additional tolerations other than the user pods and core pods
default ones `hub.jupyter.org/dedicated=user:NoSchedule` or
`hub.jupyter.org/dedicated=core:NoSchedule`. Note that a duplicate set
of tolerations exist where `/` is replaced with `_` as the Google
cloud does not support the character `/` yet in the toleration.

See the [Kubernetes docs](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/)
for more info.

Pass this field an array of
[`Toleration`](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.11/#toleration-v1-core)
objects.


scheduling:
Expand Down
9 changes: 9 additions & 0 deletions jupyterhub/templates/hub/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -208,13 +208,22 @@ data:
{{- range $key, $value := .Values.singleuser.extraLabels }}
{{ $key | quote }}: {{ $value | quote }}
{{- end }}
{{- if .Values.singleuser.storage.extraLabels }}
singleuser.storage-extra-labels: |
{{- range $key, $value := .Values.singleuser.storage.extraLabels }}
{{ $key | quote }}: {{ $value | quote }}
{{- end }}
{{- end }}
{{- if .Values.singleuser.extraEnv }}
singleuser.extra-env: |
{{- range $key, $value := .Values.singleuser.extraEnv }}
{{ $key | quote }}: {{ $value | quote }}
{{- end }}
{{- end }}

singleuser.tolerations: |
{{- include "jupyterhub.userTolerations" . | nindent 4 }}

{{- if .Values.scheduling.userScheduler.enabled }}
singleuser.scheduler-name: "{{ .Release.Name }}-user-scheduler"
{{- end }}
Expand Down
2 changes: 2 additions & 0 deletions jupyterhub/templates/image-puller/_daemonset-helper.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ spec:
{{- /* Changes here will cause the DaemonSet to restart the pods. */}}
{{- include "jupyterhub.matchLabels" . | nindent 8 }}
spec:
tolerations:
{{- include "jupyterhub.userTolerations" . | nindent 8 }}
terminationGracePeriodSeconds: 0
automountServiceAccountToken: false
{{- if .Values.singleuser.imagePullSecret.enabled }}
Expand Down
17 changes: 17 additions & 0 deletions jupyterhub/templates/scheduling/_scheduling-helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{{- /*
jupyterhub.userTolerations
Lists the tolerations for node taints that the user pods should have
*/}}
{{- define "jupyterhub.userTolerations" -}}
- key: hub.jupyter.org_dedicated
operator: Equal
value: user
effect: NoSchedule
- key: hub.jupyter.org/dedicated
operator: Equal
value: user
effect: NoSchedule
consideRatio marked this conversation as resolved.
Show resolved Hide resolved
{{- if .Values.singleuser.extraTolerations }}
{{- .Values.singleuser.extraTolerations | toYaml | trimSuffix "\n" | nindent 0 }}
{{- end }}
{{- end }}
2 changes: 2 additions & 0 deletions jupyterhub/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ auth:


singleuser:
extraTolerations: []
networkTools:
image:
name: jupyterhub/k8s-network-tools
Expand Down Expand Up @@ -171,6 +172,7 @@ singleuser:
serviceAccountName:
storage:
type: dynamic
extraLabels: {}
extraVolumes: []
extraVolumeMounts: []
static:
Expand Down
9 changes: 7 additions & 2 deletions tools/templates/lint-and-validate-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,11 @@ auth:
singleuser:
nodeSelector:
mock-node-selector: mock
extraTolerations: []
extraTolerations:
- key: hub.jupyter.org/test
operator: Equal
value: test
effect: NoSchedule
extraNodeAffinity:
required: []
preferred: []
Expand All @@ -172,7 +176,6 @@ singleuser:
- 169.254.169.254/32
events: true
extraLabels: {}
storageExtraLabels: {}
extraEnv: {}
lifecycleHooks:
initContainers:
Expand All @@ -188,6 +191,8 @@ singleuser:
serviceAccountName:
storage:
type: dynamic
extraLabels:
mock-label: mock-value
extraVolumes: []
extraVolumeMounts: []
static:
Expand Down