From 3c60e263322fa544a55a386f1017cf0ffae4848d Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Wed, 11 Jul 2018 21:59:24 +0200 Subject: [PATCH] Bugfixes pre merge of PR #758 --- .../templates/scheduling/_scheduling-helpers.tpl | 16 ++++++++++++++-- .../scheduling/user-scheduler/configmap.yaml | 3 +-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/jupyterhub/templates/scheduling/_scheduling-helpers.tpl b/jupyterhub/templates/scheduling/_scheduling-helpers.tpl index de0894936b..31cae9246d 100644 --- a/jupyterhub/templates/scheduling/_scheduling-helpers.tpl +++ b/jupyterhub/templates/scheduling/_scheduling-helpers.tpl @@ -91,12 +91,17 @@ tolerations: {{- end }} {{- define "jupyterhub.podAffinityRequired" -}} +{{- if eq .podKind "core" -}} +{{- else if eq .podKind "user" -}} {{- if .Values.singleuser.extraPodAffinity.required }} {{- .Values.singleuser.extraPodAffinity.required | toYaml | trimSuffix "\n" | nindent 0 }} {{- end }} {{- end }} +{{- end }} {{- define "jupyterhub.podAffinityPreferred" -}} +{{- if eq .podKind "core" -}} +{{- else if eq .podKind "user" -}} {{- if .Values.scheduling.userPods.podAffinity.preferScheduleNextToRealUsers -}} - weight: 100 podAffinityTerm: @@ -111,28 +116,35 @@ tolerations: {{- .Values.singleuser.extraPodAffinity.preferred | toYaml | trimSuffix "\n" | nindent 0 }} {{- end }} {{- end }} +{{- end }} {{- define "jupyterhub.podAntiAffinityRequired" -}} +{{- if eq .podKind "core" -}} +{{- else if eq .podKind "user" -}} {{- if .Values.singleuser.extraPodAntiAffinity.required -}} {{- .Values.singleuser.extraPodAntiAffinity.required | toYaml | trimSuffix "\n" | nindent 0 }} {{- end }} {{- end }} +{{- end }} {{- define "jupyterhub.podAntiAffinityPreferred" -}} -{{- if eq .component "scheduler" -}} +{{- if eq .podKind "core" -}} +{{- if eq .component "user-scheduler" -}} - weight: 100 podAffinityTerm: labelSelector: matchExpressions: - key: component operator: In - values: [scheduler] + values: [user-scheduler] topologyKey: kubernetes.io/hostname {{- end }} +{{- else if eq .podKind "user" -}} {{- if .Values.singleuser.extraPodAntiAffinity.preferred -}} {{- .Values.singleuser.extraPodAntiAffinity.preferred | toYaml | trimSuffix "\n" | nindent 0 }} {{- end }} {{- end }} +{{- end }} diff --git a/jupyterhub/templates/scheduling/user-scheduler/configmap.yaml b/jupyterhub/templates/scheduling/user-scheduler/configmap.yaml index 46dbed73de..efda23b831 100644 --- a/jupyterhub/templates/scheduling/user-scheduler/configmap.yaml +++ b/jupyterhub/templates/scheduling/user-scheduler/configmap.yaml @@ -5,7 +5,6 @@ metadata: name: user-scheduler labels: {{- include "jupyterhub.labels" . | nindent 4 }} - data: policy.cfg: | { @@ -29,7 +28,7 @@ data: { "name": "NodePreferAvoidPodsPriority", "weight": 10000 }, { "name": "NodeAffinityPriority", "weight": 1000 }, { "name": "InterPodAffinityPriority", "weight": 100 }, - { "name": "MostRequestedPriority", "weight": 50 }, + { "name": "MostRequestedPriority", "weight": 50 } ], "hardPodAffinitySymmetricWeight" : 100, "alwaysCheckAllPredicates" : true