Skip to content

Commit

Permalink
Merge pull request #1148 from FutureMatt/tolerations-and-affinities
Browse files Browse the repository at this point in the history
Move DaemonSet affinities and tolerations to values.yaml to make them user manageable.
  • Loading branch information
k8s-ci-robot authored Jul 19, 2024
2 parents 5585c25 + fed63e1 commit b73bd12
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 27 deletions.
32 changes: 7 additions & 25 deletions charts/vsphere-cpi/templates/daemonset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,14 @@ spec:
{{- toYaml .Values.daemonset.podLabels | nindent 8 }}
{{- end }}
spec:
{{- if .Values.daemonset.tolerations }}
tolerations:
- key: node.cloudprovider.kubernetes.io/uninitialized
value: "true"
effect: NoSchedule
- key: node-role.kubernetes.io/master
effect: NoSchedule
operator: Exists
- key: node-role.kubernetes.io/control-plane
effect: NoSchedule
operator: Exists
- key: node.kubernetes.io/not-ready
effect: NoSchedule
operator: Exists
- key: CriticalAddonsOnly
effect: NoExecute
operator: Exists
{{- if .Values.daemonset.tolerations }}
{{- toYaml .Values.daemonset.tolerations | nindent 6 }}
{{- end }}
{{- toYaml .Values.daemonset.tolerations | nindent 8 }}
{{- end }}
{{- if .Values.daemonset.affinity }}
affinity:
{{- toYaml .Values.daemonset.affinity | nindent 8 }}
{{- end }}
{{- if .Values.securityContext.enabled }}
securityContext:
fsGroup: {{ .Values.securityContext.fsGroup }}
Expand Down Expand Up @@ -91,10 +80,3 @@ spec:
- name: vsphere-config-volume
configMap:
name: {{ if $config.enabled }}{{- $config.name }}{{- else }}cloud-config{{- end }}
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node-role.kubernetes.io/control-plane
operator: Exists
24 changes: 22 additions & 2 deletions charts/vsphere-cpi/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,25 @@ daemonset:
## Additional pod labels
## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/
podLabels: {}
## Allows for the default tolerations to be replaced with user-defined ones
tolerations: []
## Allows for the default tolerations to be updated or replaced with user-defined ones
tolerations:
- key: node.cloudprovider.kubernetes.io/uninitialized
value: "true"
effect: NoSchedule
- key: node-role.kubernetes.io/control-plane
effect: NoSchedule
operator: Exists
- key: node.kubernetes.io/not-ready
effect: NoSchedule
operator: Exists
- key: CriticalAddonsOnly
effect: NoExecute
operator: Exists
## Allows for the default affinities to be updated or replaced with user-defined ones
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: node-role.kubernetes.io/control-plane
operator: Exists

0 comments on commit b73bd12

Please sign in to comment.