diff --git a/charts/ceph-csi-cephfs/templates/provisioner-deployment.yaml b/charts/ceph-csi-cephfs/templates/provisioner-deployment.yaml index 13c083aba..30f375824 100644 --- a/charts/ceph-csi-cephfs/templates/provisioner-deployment.yaml +++ b/charts/ceph-csi-cephfs/templates/provisioner-deployment.yaml @@ -48,6 +48,14 @@ spec: values: - {{ .Values.provisioner.name }} topologyKey: "kubernetes.io/hostname" +{{- 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-cephfs.serviceAccountName.provisioner" . }} hostNetwork: {{ .Values.provisioner.enableHostNetwork }} @@ -228,10 +236,6 @@ spec: emptyDir: { medium: "Memory" } -{{- if .Values.provisioner.affinity }} - affinity: -{{ toYaml .Values.provisioner.affinity | indent 8 -}} -{{- end -}} {{- if .Values.provisioner.nodeSelector }} nodeSelector: {{ toYaml .Values.provisioner.nodeSelector | indent 8 -}} diff --git a/charts/ceph-csi-rbd/templates/provisioner-deployment.yaml b/charts/ceph-csi-rbd/templates/provisioner-deployment.yaml index fc1f28cdf..76db4e452 100644 --- a/charts/ceph-csi-rbd/templates/provisioner-deployment.yaml +++ b/charts/ceph-csi-rbd/templates/provisioner-deployment.yaml @@ -48,6 +48,14 @@ spec: values: - {{ .Values.provisioner.name }} topologyKey: "kubernetes.io/hostname" +{{- 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 }} @@ -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 -}}