diff --git a/charts/ceph-csi-rbd/templates/provisioner-deployment.yaml b/charts/ceph-csi-rbd/templates/provisioner-deployment.yaml index fc1f28cdf8d4..565500eb2e93 100644 --- a/charts/ceph-csi-rbd/templates/provisioner-deployment.yaml +++ b/charts/ceph-csi-rbd/templates/provisioner-deployment.yaml @@ -48,7 +48,15 @@ spec: values: - {{ .Values.provisioner.name }} topologyKey: "kubernetes.io/hostname" -{{- end }} +{{- if .Values.provisioner.affinity }} +{{ toYaml .Values.provisioner.affinity | indent 8 -}} +{{- end -}} +{{- else -}} +{{- if .Values.provisioner.affinity }} + affinity: +{{ toYaml .Values.provisioner.affinity | indent 8 -}} +{{- end -}} +{{- end}} serviceAccountName: {{ include "ceph-csi-rbd.serviceAccountName.provisioner" . }} hostNetwork: {{ .Values.provisioner.enableHostNetwork }} {{- if .Values.provisioner.priorityClassName }} @@ -309,10 +317,6 @@ spec: path: oidc-token expirationSeconds: 3600 audience: ceph-csi-kms -{{- if .Values.provisioner.affinity }} - affinity: -{{ toYaml .Values.provisioner.affinity | indent 8 -}} -{{- end -}} {{- if .Values.provisioner.nodeSelector }} nodeSelector: {{ toYaml .Values.provisioner.nodeSelector | indent 8 -}}