Skip to content

Commit

Permalink
Added scheduling.nodeExclusions
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianeicher committed May 16, 2023
1 parent ddefa6d commit d6f7dc2
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 1 deletion.
1 change: 1 addition & 0 deletions charts/generic-service/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ app:
| `autoscaling.behavior` | `{}` | Scaling behavior configuration (see `HorizontalPodAutoscalerBehavior`) |
| `scheduling.nodeSelector` | `{}` | Labels to select nodes this service may be run on |
| `scheduling.nodePeferences` | `{}` | Sets of label values to select nodes this service should be run on if possible |
| `scheduling.nodeExclusions` | `{}` | Sets of label values to select nodes this service must not run on. |
| `scheduling.podAffinity` | `{}` | Labels to select other pods this service should share nodes with if possible |
| `scheduling.enforceReplicaSpread` | `false` | Make even spread of replicas across nodes mandatory |
| `persistence.enabled` | `false` | Enables persistent storage for the service |
Expand Down
2 changes: 2 additions & 0 deletions charts/generic-service/ci/scheduling-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ image:
scheduling:
nodePreferences:
someKey: [someValue1, someValue2]
nodeExclusions:
otherKey: [otherValue1, otherValue2]
podAffinity:
someKey: someValue
14 changes: 13 additions & 1 deletion charts/generic-service/templates/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,9 @@ spec:
matchLabels: {{- .Values.scheduling.podAffinity | toYaml | nindent 20 }}
{{- end }}

{{- if .Values.scheduling.nodePreferences }}
{{- if or .Values.scheduling.nodePreferences .Values.scheduling.nodeExclusions }}
nodeAffinity:
{{- if .Values.scheduling.nodePreferences }}
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
preference:
Expand All @@ -214,6 +215,17 @@ spec:
operator: In
values: {{- $values | toYaml | nindent 22 }}
{{- end }}
{{- end }}
{{- if .Values.scheduling.nodeExclusions }}
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
{{- range $key, $values := .Values.scheduling.nodeExclusions }}
- key: {{ $key | quote }}
operator: NotIn
values: {{- $values | toYaml | nindent 22 }}
{{- end }}
{{- end }}
{{- end }}

{{- if .Values.scheduling.nodeSelector }}
Expand Down
8 changes: 8 additions & 0 deletions charts/generic-service/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,14 @@
},
"description": "Sets of label values to select nodes this service should be run on if possible"
},
"nodeExclusions": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {"type": "string"}
},
"description": "Sets of label values to select nodes this service must not run on"
},
"podAffinity": {
"type": "object",
"additionalProperties": {"type": "string"},
Expand Down
1 change: 1 addition & 0 deletions charts/generic-service/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ autoscaling:
scheduling:
nodeSelector: {}
nodePreferences: {}
nodeExclusions: {}
podAffinity: {}
enforceReplicaSpread: false

Expand Down

0 comments on commit d6f7dc2

Please sign in to comment.