diff --git a/charts/karpenter/templates/controller/deployment.yaml b/charts/karpenter/templates/controller/deployment.yaml index 5817b04b4789..5d94a1480cdc 100644 --- a/charts/karpenter/templates/controller/deployment.yaml +++ b/charts/karpenter/templates/controller/deployment.yaml @@ -59,10 +59,19 @@ spec: nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.controller.affinity }} affinity: - {{- toYaml . | nindent 8 }} - {{- end }} + {{- if .Values.controller.affinity }} + {{- toYaml .Values.controller.affinity | nindent 8 }} + {{- else }} + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/os + operator: In + values: + - linux + {{- end }} {{- with .Values.controller.tolerations }} tolerations: {{- toYaml . | nindent 8 }} diff --git a/charts/karpenter/templates/webhook/deployment.yaml b/charts/karpenter/templates/webhook/deployment.yaml index d8b79c09e899..7eef68ece21e 100644 --- a/charts/karpenter/templates/webhook/deployment.yaml +++ b/charts/karpenter/templates/webhook/deployment.yaml @@ -61,10 +61,19 @@ spec: nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.webhook.affinity }} affinity: - {{- toYaml . | nindent 8 }} - {{- end }} + {{- if .Values.webhook.affinity }} + {{- toYaml .Values.webhook.affinity | nindent 8 }} + {{- else }} + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: kubernetes.io/os + operator: In + values: + - linux + {{- end }} {{- with .Values.webhook.tolerations }} tolerations: {{- toYaml . | nindent 8 }}