diff --git a/.cicd/test.sh b/.cicd/test.sh index 1e6303b..68d5f40 100755 --- a/.cicd/test.sh +++ b/.cicd/test.sh @@ -179,6 +179,8 @@ function check_creates_template() { check_string_existence "" "imagePullPolicy: IfNotPresent" check_setting_has_value "--set image.pullSecrets[0]=weaviate-image-pull-secret" "imagePullSecrets" "name: weaviate-image-pull-secret" check_setting_has_value "--set updateStrategy.type=OnDelete" "updateStrategy" "type: OnDelete" + check_string_existence "--set priorityClassName=critical" "priorityClassName: critical" + check_string_existence "--set globalPriorityClassName=high" "priorityClassName: high" DEPLOYMENT_MODULES=( "text2vec-contextionary" @@ -208,6 +210,8 @@ function check_creates_template() { check_string_existence "--set modules.$module.enabled=true --set modules.$module.securityContext.thisIsATestFrom$no_dots_module-context=true" "thisIsATestFrom$no_dots_module-context: true" check_setting_has_value "--set modules.$module.enabled=true --set modules.$module.imagePullSecrets[0]=$no_dots_module-pullSecrets" "imagePullSecrets" "name: $no_dots_module-pullSecrets" check_setting_has_value "--set modules.$module.enabled=true --set modules.$module.strategy.type=$no_dots_module-strategy" "strategy" "type: $no_dots_module-strategy" + check_string_existence "--set modules.$module.enabled=true --set modules.$module.priorityClassName=$no_dots_module" "priorityClassName: $no_dots_module" + check_string_existence "--set modules.$module.enabled=true --set globalPriorityClassName=high" "priorityClassName: high" done _settingScrapePromMetrics="--set env.PROMETHEUS_MONITORING_ENABLED=true --set serviceMonitor.enabled=true" diff --git a/weaviate/templates/_helpers.tpl b/weaviate/templates/_helpers.tpl index 44caece..14b8003 100644 --- a/weaviate/templates/_helpers.tpl +++ b/weaviate/templates/_helpers.tpl @@ -132,3 +132,23 @@ username: {{ randAlphaNum 32 | b64enc | quote }} password: {{ randAlphaNum 32 | b64enc | quote }} {{- end -}} {{- end -}} + + +{{/* +Return PriorityClassName +Usage: +{{- include "pod.priorityClassName" ( dict "global" .Values.path.to.global.priorityClassName "priorityClassName" .Values.path.to.priorityClassName) | nindent 6 }} +*/}} +{{- define "pod.priorityClassName" -}} + {{- $priorityClassName := "" -}} + + {{- if .global -}} + {{- $priorityClassName = .global -}} + {{- else if .priorityClassName -}} + {{- $priorityClassName = .priorityClassName -}} + {{- end -}} + + {{- if (not (empty $priorityClassName)) -}} + {{- printf "priorityClassName: %s" $priorityClassName -}} + {{- end -}} +{{- end -}} diff --git a/weaviate/templates/contextionaryDeployment.yaml b/weaviate/templates/contextionaryDeployment.yaml index 65422ea..812c4ea 100644 --- a/weaviate/templates/contextionaryDeployment.yaml +++ b/weaviate/templates/contextionaryDeployment.yaml @@ -31,6 +31,7 @@ spec: serviceAccountName: {{ index .Values "serviceAccountName" }} {{- end }} {{- include "image.pullSecrets" (dict "pullSecrets" (index $module "imagePullSecrets")) | nindent 6 }} + {{- include "pod.priorityClassName" ( dict "global" $.Values.globalPriorityClassName "priorityClassName" (index $module "priorityClassName")) | nindent 6 }} containers: - name: {{ index $module "fullnameOverride" }} image: {{ index $module "registry" }}/{{ index $module "repo" }}:{{ index $module "tag" }} diff --git a/weaviate/templates/gpt4allInferenceDeployment.yaml b/weaviate/templates/gpt4allInferenceDeployment.yaml index a22374b..cc24f7f 100644 --- a/weaviate/templates/gpt4allInferenceDeployment.yaml +++ b/weaviate/templates/gpt4allInferenceDeployment.yaml @@ -29,6 +29,7 @@ spec: serviceAccountName: {{ index .Values "serviceAccountName" }} {{- end }} {{- include "image.pullSecrets" (dict "pullSecrets" (index $module "imagePullSecrets")) | nindent 6 }} + {{- include "pod.priorityClassName" ( dict "global" $.Values.globalPriorityClassName "priorityClassName" (index $module "priorityClassName")) | nindent 6 }} containers: - name: {{ index $module "fullnameOverride" }} image: {{ index $module "registry" }}/{{ index $module "repo" }}:{{ index $module "tag" }} diff --git a/weaviate/templates/img2vecNeuralDeployment.yaml b/weaviate/templates/img2vecNeuralDeployment.yaml index ccac3ba..55c72a5 100644 --- a/weaviate/templates/img2vecNeuralDeployment.yaml +++ b/weaviate/templates/img2vecNeuralDeployment.yaml @@ -29,6 +29,7 @@ spec: serviceAccountName: {{ index .Values "serviceAccountName" }} {{- end }} {{- include "image.pullSecrets" (dict "pullSecrets" (index $module "imagePullSecrets")) | nindent 6 }} + {{- include "pod.priorityClassName" ( dict "global" $.Values.globalPriorityClassName "priorityClassName" (index $module "priorityClassName")) | nindent 6 }} containers: - name: {{ index $module "fullnameOverride" }} image: {{ index $module "registry" }}/{{ index $module "repo" }}:{{ index $module "tag" }} diff --git a/weaviate/templates/multi2vecBindDeployment.yaml b/weaviate/templates/multi2vecBindDeployment.yaml index d1b68f7..481bea2 100644 --- a/weaviate/templates/multi2vecBindDeployment.yaml +++ b/weaviate/templates/multi2vecBindDeployment.yaml @@ -29,6 +29,7 @@ spec: serviceAccountName: {{ index .Values "serviceAccountName" }} {{- end }} {{- include "image.pullSecrets" (dict "pullSecrets" (index $module "imagePullSecrets")) | nindent 6 }} + {{- include "pod.priorityClassName" ( dict "global" $.Values.globalPriorityClassName "priorityClassName" (index $module "priorityClassName")) | nindent 6 }} containers: - name: {{ index $module "fullnameOverride" }} image: {{ index $module "registry" }}/{{ index $module "repo" }}:{{ index $module "tag" }} diff --git a/weaviate/templates/multi2vecClipDeployment.yaml b/weaviate/templates/multi2vecClipDeployment.yaml index f25b54e..3378c20 100644 --- a/weaviate/templates/multi2vecClipDeployment.yaml +++ b/weaviate/templates/multi2vecClipDeployment.yaml @@ -29,6 +29,7 @@ spec: serviceAccountName: {{ index .Values "serviceAccountName" }} {{- end }} {{- include "image.pullSecrets" (dict "pullSecrets" (index $module "imagePullSecrets")) | nindent 6 }} + {{- include "pod.priorityClassName" ( dict "global" $.Values.globalPriorityClassName "priorityClassName" (index $module "priorityClassName")) | nindent 6 }} containers: - name: {{ index $module "fullnameOverride" }} image: {{ index $module "registry" }}/{{ index $module "repo" }}:{{ index $module "tag" }} diff --git a/weaviate/templates/nerTransformersDeployment.yaml b/weaviate/templates/nerTransformersDeployment.yaml index 4224ac3..b9f5977 100644 --- a/weaviate/templates/nerTransformersDeployment.yaml +++ b/weaviate/templates/nerTransformersDeployment.yaml @@ -29,6 +29,7 @@ spec: serviceAccountName: {{ index .Values "serviceAccountName" }} {{- end }} {{- include "image.pullSecrets" (dict "pullSecrets" (index $module "imagePullSecrets")) | nindent 6 }} + {{- include "pod.priorityClassName" ( dict "global" $.Values.globalPriorityClassName "priorityClassName" (index $module "priorityClassName")) | nindent 6 }} containers: - name: {{ index $module "fullnameOverride" }} image: {{ index $module "registry" }}/{{ index $module "repo" }}:{{ index $module "tag" }} diff --git a/weaviate/templates/qnaTransformersDeployment.yaml b/weaviate/templates/qnaTransformersDeployment.yaml index 515bd9e..013017b 100644 --- a/weaviate/templates/qnaTransformersDeployment.yaml +++ b/weaviate/templates/qnaTransformersDeployment.yaml @@ -29,6 +29,7 @@ spec: serviceAccountName: {{ index .Values "serviceAccountName" }} {{- end }} {{- include "image.pullSecrets" (dict "pullSecrets" (index $module "imagePullSecrets")) | nindent 6 }} + {{- include "pod.priorityClassName" ( dict "global" $.Values.globalPriorityClassName "priorityClassName" (index $module "priorityClassName")) | nindent 6 }} containers: - name: {{ index $module "fullnameOverride" }} image: {{ index $module "registry" }}/{{ index $module "repo" }}:{{ index $module "tag" }} diff --git a/weaviate/templates/rerankerTransformersDeployment.yaml b/weaviate/templates/rerankerTransformersDeployment.yaml index 18a1a11..4242187 100644 --- a/weaviate/templates/rerankerTransformersDeployment.yaml +++ b/weaviate/templates/rerankerTransformersDeployment.yaml @@ -29,6 +29,7 @@ spec: serviceAccountName: {{ index .Values "serviceAccountName" }} {{- end }} {{- include "image.pullSecrets" (dict "pullSecrets" (index $module "imagePullSecrets")) | nindent 6 }} + {{- include "pod.priorityClassName" ( dict "global" $.Values.globalPriorityClassName "priorityClassName" (index $module "priorityClassName")) | nindent 6 }} containers: - name: {{ index $module "fullnameOverride" }} image: {{ index $module "registry" }}/{{ index $module "repo" }}:{{ index $module "tag" }} diff --git a/weaviate/templates/sumTransformersDeployment.yaml b/weaviate/templates/sumTransformersDeployment.yaml index 1b0d868..0cd235a 100644 --- a/weaviate/templates/sumTransformersDeployment.yaml +++ b/weaviate/templates/sumTransformersDeployment.yaml @@ -29,6 +29,7 @@ spec: serviceAccountName: {{ index .Values "serviceAccountName" }} {{- end }} {{- include "image.pullSecrets" (dict "pullSecrets" (index $module "imagePullSecrets")) | nindent 6 }} + {{- include "pod.priorityClassName" ( dict "global" $.Values.globalPriorityClassName "priorityClassName" (index $module "priorityClassName")) | nindent 6 }} containers: - name: {{ index $module "fullnameOverride" }} image: {{ index $module "registry" }}/{{ index $module "repo" }}:{{ index $module "tag" }} diff --git a/weaviate/templates/textSpellcheckDeployment.yaml b/weaviate/templates/textSpellcheckDeployment.yaml index fc5c945..cd20a77 100644 --- a/weaviate/templates/textSpellcheckDeployment.yaml +++ b/weaviate/templates/textSpellcheckDeployment.yaml @@ -29,6 +29,7 @@ spec: serviceAccountName: {{ index .Values "serviceAccountName" }} {{- end }} {{- include "image.pullSecrets" (dict "pullSecrets" (index $module "imagePullSecrets")) | nindent 6 }} + {{- include "pod.priorityClassName" ( dict "global" $.Values.globalPriorityClassName "priorityClassName" (index $module "priorityClassName")) | nindent 6 }} containers: - name: {{ index $module "fullnameOverride" }} image: {{ index $module "registry" }}/{{ index $module "repo" }}:{{ index $module "tag" }} diff --git a/weaviate/templates/transformersInferenceDeployment.yaml b/weaviate/templates/transformersInferenceDeployment.yaml index 9ed34d4..9531cc5 100644 --- a/weaviate/templates/transformersInferenceDeployment.yaml +++ b/weaviate/templates/transformersInferenceDeployment.yaml @@ -31,6 +31,7 @@ spec: serviceAccountName: {{ index .Values "serviceAccountName" }} {{- end }} {{- include "image.pullSecrets" (dict "pullSecrets" (index $module "imagePullSecrets")) | nindent 6 }} + {{- include "pod.priorityClassName" ( dict "global" $.Values.globalPriorityClassName "priorityClassName" (index $module "priorityClassName")) | nindent 6 }} containers: - name: {{ index $module "fullnameOverride" }} image: {{ index $module "registry" }}/{{ index $module "repo" }}:{{ index $module "tag" }} @@ -129,6 +130,7 @@ spec: serviceAccountName: {{ index .Values "serviceAccountName" }} {{- end }} {{- include "image.pullSecrets" (dict "pullSecrets" (index $passage "imagePullSecrets")) | nindent 6 }} + {{- include "pod.priorityClassName" ( dict "global" $.Values.globalPriorityClassName "priorityClassName" (index $passage "priorityClassName")) | nindent 6 }} containers: - name: {{ index $passage "fullnameOverride" }} image: {{ index $passage "registry" }}/{{ index $passage "repo" }}:{{ index $passage "tag" }} @@ -216,6 +218,7 @@ spec: serviceAccountName: {{ index .Values "serviceAccountName" }} {{- end }} {{- include "image.pullSecrets" (dict "pullSecrets" (index $query "imagePullSecrets")) | nindent 6 }} + {{- include "pod.priorityClassName" ( dict "global" $.Values.globalPriorityClassName "priorityClassName" (index $query "priorityClassName")) | nindent 6 }} containers: - name: {{ index $query "fullnameOverride" }} image: {{ index $query "registry" }}/{{ index $query "repo" }}:{{ index $query "tag" }} diff --git a/weaviate/templates/weaviateStatefulset.yaml b/weaviate/templates/weaviateStatefulset.yaml index c529aab..b2078b0 100644 --- a/weaviate/templates/weaviateStatefulset.yaml +++ b/weaviate/templates/weaviateStatefulset.yaml @@ -37,6 +37,7 @@ spec: {{- end }} terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds }} {{- include "image.pullSecrets" (dict "pullSecrets" $.Values.image.pullSecrets) | nindent 6 }} + {{- include "pod.priorityClassName" ( dict "global" $.Values.globalPriorityClassName "priorityClassName" .Values.priorityClassName) | nindent 6 }} {{- if or (.Values.initContainers.sysctlInitContainer.enabled) (.Values.initContainers.extraInitContainers) }} initContainers: {{- if .Values.initContainers.sysctlInitContainer.enabled }} diff --git a/weaviate/values.yaml b/weaviate/values.yaml index 62e289f..819c278 100644 --- a/weaviate/values.yaml +++ b/weaviate/values.yaml @@ -409,6 +409,7 @@ modules: type: RollingUpdate imagePullPolicy: IfNotPresent imagePullSecrets: [] + priorityClassName: "" livenessProbe: initialDelaySeconds: 120 periodSeconds: 3 @@ -474,6 +475,7 @@ modules: type: RollingUpdate imagePullPolicy: IfNotPresent imagePullSecrets: [] + priorityClassName: "" fullnameOverride: transformers-inference # Deprecated setting use initialDelaySeconds instead in each probe instead # probeInitialDelaySeconds: 120 @@ -542,6 +544,7 @@ modules: registry: docker.io imagePullPolicy: IfNotPresent imagePullSecrets: [] + priorityClassName: "" replicas: 1 strategy: type: RollingUpdate @@ -611,6 +614,7 @@ modules: registry: docker.io imagePullPolicy: IfNotPresent imagePullSecrets: [] + priorityClassName: "" replicas: 1 strategy: type: RollingUpdate @@ -693,6 +697,7 @@ modules: type: RollingUpdate imagePullPolicy: IfNotPresent imagePullSecrets: [] + priorityClassName: "" fullnameOverride: gpt4all-inference livenessProbe: initialDelaySeconds: 120 @@ -832,6 +837,7 @@ modules: type: RollingUpdate imagePullPolicy: IfNotPresent imagePullSecrets: [] + priorityClassName: "" fullnameOverride: clip-inference livenessProbe: initialDelaySeconds: 120 @@ -903,6 +909,7 @@ modules: type: RollingUpdate imagePullPolicy: IfNotPresent imagePullSecrets: [] + priorityClassName: "" fullnameOverride: bind-inference livenessProbe: initialDelaySeconds: 120 @@ -971,6 +978,7 @@ modules: type: RollingUpdate imagePullPolicy: IfNotPresent imagePullSecrets: [] + priorityClassName: "" fullnameOverride: qna-transformers livenessProbe: initialDelaySeconds: 120 @@ -1097,6 +1105,7 @@ modules: type: RollingUpdate imagePullPolicy: IfNotPresent imagePullSecrets: [] + priorityClassName: "" fullnameOverride: img2vec-neural livenessProbe: initialDelaySeconds: 120 @@ -1185,6 +1194,7 @@ modules: type: RollingUpdate imagePullPolicy: IfNotPresent imagePullSecrets: [] + priorityClassName: "" fullnameOverride: reranker-transformers livenessProbe: initialDelaySeconds: 120 @@ -1258,6 +1268,7 @@ modules: type: RollingUpdate imagePullPolicy: IfNotPresent imagePullSecrets: [] + priorityClassName: "" fullnameOverride: text-spellcheck livenessProbe: initialDelaySeconds: 120 @@ -1314,6 +1325,7 @@ modules: type: RollingUpdate imagePullPolicy: IfNotPresent imagePullSecrets: [] + priorityClassName: "" fullnameOverride: ner-transformers livenessProbe: initialDelaySeconds: 120 @@ -1386,6 +1398,7 @@ modules: type: RollingUpdate imagePullPolicy: IfNotPresent imagePullSecrets: [] + priorityClassName: "" fullnameOverride: sum-transformers livenessProbe: initialDelaySeconds: 120 @@ -1471,3 +1484,9 @@ affinity: operator: In values: - weaviate + +## Optionally specify priorityClass name for the pod +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#pod-priority +## +priorityClassName: "" +globalPriorityClassName: ""