diff --git a/charts/generic-service/ci/scheduling-values.yaml b/charts/generic-service/ci/scheduling-values.yaml index 8c6d4a9..7d4b37d 100644 --- a/charts/generic-service/ci/scheduling-values.yaml +++ b/charts/generic-service/ci/scheduling-values.yaml @@ -12,7 +12,15 @@ scheduling: someKey: [someValue1, someValue2] nodeExclusions: otherKey: [otherValue1, otherValue2] - tolerations: [someTaint] + tolerations: + - taint1 + - key: taint2 + operator: Equal + value: "value1" + effect: NoSchedule + - key: taint2 + operator: Exists + effect: NoSchedule podAffinity: someKey: someValue podAntiAffinity: diff --git a/charts/generic-service/templates/controller.yaml b/charts/generic-service/templates/controller.yaml index 65b97d1..2fb72c2 100644 --- a/charts/generic-service/templates/controller.yaml +++ b/charts/generic-service/templates/controller.yaml @@ -269,9 +269,21 @@ spec: {{- with .Values.scheduling.tolerations }} tolerations: - {{- range $key:= . }} - - key: {{ $key | quote }} + {{- range . }} + {{- if kindIs "string" . }} + - key: {{ . | quote }} operator: Exists + {{- else }} + {{- $toleration := . }} + - key: {{ $toleration.key | quote }} + operator: {{ $toleration.operator | default "Exists" | quote }} + {{- if $toleration.value }} + value: {{ $toleration.value | quote }} + {{- end }} + {{- if $toleration.effect }} + effect: {{ $toleration.effect | quote }} + {{- end }} + {{- end }} {{- end }} {{- end }} diff --git a/charts/generic-service/values.schema.json b/charts/generic-service/values.schema.json index 51adab4..e5e70a0 100644 --- a/charts/generic-service/values.schema.json +++ b/charts/generic-service/values.schema.json @@ -558,7 +558,46 @@ "tolerations": { "type": "array", "items": { - "type": "string" + "type": "object", + "oneOf": [ + { + "type": "object", + "properties": { + "operator": { + "type": [ + "string", + "null" + ], + "description": "Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category." + }, + "value": { + "type": [ + "string", + "null" + ], + "description": "Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string." + }, + "effect": { + "type": [ + "string", + "null" + ], + "description": "Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute." + }, + "key": { + "type": [ + "string", + "null" + ], + "description": "Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys." + } + } + }, + { + "type": "string", + "description": "Key of the taint. The operator is automatically set to Exists and the other fields would be set to null." + } + ] }, "description": "Taints on nodes this service can tolerate" }, diff --git a/charts/generic-service/values.yaml b/charts/generic-service/values.yaml index 50ed7e6..9b6d28d 100644 --- a/charts/generic-service/values.yaml +++ b/charts/generic-service/values.yaml @@ -87,6 +87,13 @@ scheduling: nodePreferences: {} nodeExclusions: {} tolerations: [] + ## Example: + ## tolerations: ["node.deepl.dev/k8s-kubevirt"] + ## Or you can add more complex tolerations as objects here + ## tolerations: + ## - key: "node.deepl.dev/k8s-gpu-worker" + ## effect: NoSchedule + ## value: "true" podAffinity: {} podAntiAffinity: {} replicaSpread: BestEffort