Skip to content

Commit

Permalink
Add option to define PriorityClassName (#173)
Browse files Browse the repository at this point in the history
* Add option to define PriorityClassName

* Add option to define PriorityClassName on passageQueryServices

* Add priorityClassName definition check in the test script
  • Loading branch information
ahsanemon authored Nov 29, 2023
1 parent 49c93ac commit d5480b4
Show file tree
Hide file tree
Showing 15 changed files with 57 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .cicd/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
20 changes: 20 additions & 0 deletions weaviate/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 -}}
1 change: 1 addition & 0 deletions weaviate/templates/contextionaryDeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }}
Expand Down
1 change: 1 addition & 0 deletions weaviate/templates/gpt4allInferenceDeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }}
Expand Down
1 change: 1 addition & 0 deletions weaviate/templates/img2vecNeuralDeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }}
Expand Down
1 change: 1 addition & 0 deletions weaviate/templates/multi2vecBindDeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }}
Expand Down
1 change: 1 addition & 0 deletions weaviate/templates/multi2vecClipDeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }}
Expand Down
1 change: 1 addition & 0 deletions weaviate/templates/nerTransformersDeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }}
Expand Down
1 change: 1 addition & 0 deletions weaviate/templates/qnaTransformersDeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }}
Expand Down
1 change: 1 addition & 0 deletions weaviate/templates/rerankerTransformersDeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }}
Expand Down
1 change: 1 addition & 0 deletions weaviate/templates/sumTransformersDeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }}
Expand Down
1 change: 1 addition & 0 deletions weaviate/templates/textSpellcheckDeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }}
Expand Down
3 changes: 3 additions & 0 deletions weaviate/templates/transformersInferenceDeployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }}
Expand Down Expand Up @@ -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" }}
Expand Down Expand Up @@ -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" }}
Expand Down
1 change: 1 addition & 0 deletions weaviate/templates/weaviateStatefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
19 changes: 19 additions & 0 deletions weaviate/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,7 @@ modules:
type: RollingUpdate
imagePullPolicy: IfNotPresent
imagePullSecrets: []
priorityClassName: ""
livenessProbe:
initialDelaySeconds: 120
periodSeconds: 3
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -542,6 +544,7 @@ modules:
registry: docker.io
imagePullPolicy: IfNotPresent
imagePullSecrets: []
priorityClassName: ""
replicas: 1
strategy:
type: RollingUpdate
Expand Down Expand Up @@ -611,6 +614,7 @@ modules:
registry: docker.io
imagePullPolicy: IfNotPresent
imagePullSecrets: []
priorityClassName: ""
replicas: 1
strategy:
type: RollingUpdate
Expand Down Expand Up @@ -693,6 +697,7 @@ modules:
type: RollingUpdate
imagePullPolicy: IfNotPresent
imagePullSecrets: []
priorityClassName: ""
fullnameOverride: gpt4all-inference
livenessProbe:
initialDelaySeconds: 120
Expand Down Expand Up @@ -832,6 +837,7 @@ modules:
type: RollingUpdate
imagePullPolicy: IfNotPresent
imagePullSecrets: []
priorityClassName: ""
fullnameOverride: clip-inference
livenessProbe:
initialDelaySeconds: 120
Expand Down Expand Up @@ -903,6 +909,7 @@ modules:
type: RollingUpdate
imagePullPolicy: IfNotPresent
imagePullSecrets: []
priorityClassName: ""
fullnameOverride: bind-inference
livenessProbe:
initialDelaySeconds: 120
Expand Down Expand Up @@ -971,6 +978,7 @@ modules:
type: RollingUpdate
imagePullPolicy: IfNotPresent
imagePullSecrets: []
priorityClassName: ""
fullnameOverride: qna-transformers
livenessProbe:
initialDelaySeconds: 120
Expand Down Expand Up @@ -1097,6 +1105,7 @@ modules:
type: RollingUpdate
imagePullPolicy: IfNotPresent
imagePullSecrets: []
priorityClassName: ""
fullnameOverride: img2vec-neural
livenessProbe:
initialDelaySeconds: 120
Expand Down Expand Up @@ -1185,6 +1194,7 @@ modules:
type: RollingUpdate
imagePullPolicy: IfNotPresent
imagePullSecrets: []
priorityClassName: ""
fullnameOverride: reranker-transformers
livenessProbe:
initialDelaySeconds: 120
Expand Down Expand Up @@ -1258,6 +1268,7 @@ modules:
type: RollingUpdate
imagePullPolicy: IfNotPresent
imagePullSecrets: []
priorityClassName: ""
fullnameOverride: text-spellcheck
livenessProbe:
initialDelaySeconds: 120
Expand Down Expand Up @@ -1314,6 +1325,7 @@ modules:
type: RollingUpdate
imagePullPolicy: IfNotPresent
imagePullSecrets: []
priorityClassName: ""
fullnameOverride: ner-transformers
livenessProbe:
initialDelaySeconds: 120
Expand Down Expand Up @@ -1386,6 +1398,7 @@ modules:
type: RollingUpdate
imagePullPolicy: IfNotPresent
imagePullSecrets: []
priorityClassName: ""
fullnameOverride: sum-transformers
livenessProbe:
initialDelaySeconds: 120
Expand Down Expand Up @@ -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: ""

0 comments on commit d5480b4

Please sign in to comment.