diff --git a/Makefile b/Makefile index 74856c5afe..82bf876c6f 100755 --- a/Makefile +++ b/Makefile @@ -28,7 +28,7 @@ CSI_IMAGE_TAG ?= $(REGISTRY)/$(IMAGE_NAME):$(IMAGE_VERSION) CSI_IMAGE_TAG_LATEST = $(REGISTRY)/$(IMAGE_NAME):latest BUILD_DATE ?= $(shell date -u +"%Y-%m-%dT%H:%M:%SZ") LDFLAGS ?= "-X ${PKG}/pkg/azurefile.driverVersion=${IMAGE_VERSION} -X ${PKG}/pkg/azurefile.gitCommit=${GIT_COMMIT} -X ${PKG}/pkg/azurefile.buildDate=${BUILD_DATE} -s -w -extldflags '-static'" -E2E_HELM_OPTIONS ?= --set image.azurefile.repository=$(REGISTRY)/$(IMAGE_NAME) --set image.azurefile.tag=$(IMAGE_VERSION) --set node.enableKataCCMount=true --set linux.dnsPolicy=ClusterFirstWithHostNet --set driver.userAgentSuffix="e2e-test" +E2E_HELM_OPTIONS ?= --set image.azurefile.repository=$(REGISTRY)/$(IMAGE_NAME) --set image.azurefile.tag=$(IMAGE_VERSION) --set node.enableKataCCMount=true --set linux.dnsPolicy=ClusterFirstWithHostNet --set driver.userAgentSuffix="e2e-test" --set controller.runOnControlPlane=true --set controller.replicas=1 --set snapshot.snapshotController.replicas=1 E2E_HELM_OPTIONS += ${EXTRA_HELM_OPTIONS} ifdef KUBERNETES_VERSION # disable kubelet-registration-probe on capz cluster testing E2E_HELM_OPTIONS += --set linux.enableRegistrationProbe=false --set windows.enableRegistrationProbe=false diff --git a/charts/latest/azurefile-csi-driver-1.31.0.tgz b/charts/latest/azurefile-csi-driver-1.31.0.tgz index d3654bc2d2..60d2169b07 100644 Binary files a/charts/latest/azurefile-csi-driver-1.31.0.tgz and b/charts/latest/azurefile-csi-driver-1.31.0.tgz differ diff --git a/charts/latest/azurefile-csi-driver/templates/csi-azurefile-controller.yaml b/charts/latest/azurefile-csi-driver/templates/csi-azurefile-controller.yaml index 61cfa51470..0024ace83a 100644 --- a/charts/latest/azurefile-csi-driver/templates/csi-azurefile-controller.yaml +++ b/charts/latest/azurefile-csi-driver/templates/csi-azurefile-controller.yaml @@ -44,12 +44,27 @@ spec: {{- with .Values.controller.nodeSelector }} {{ toYaml . | indent 8 }} {{- end }} - {{- if .Values.controller.runOnMaster}} - node-role.kubernetes.io/master: "" - {{- end}} - {{- if .Values.controller.runOnControlPlane}} - node-role.kubernetes.io/control-plane: "" - {{- end}} + # runOnControlPlane=true or runOnMaster=true only takes effect if affinity is not set + {{- if contains (tpl "{{ .Values.controller.affinity }}" .) "nodeSelectorTerms" }} + {{- with .Values.controller.affinity }} + affinity: + {{ toYaml . | indent 8 }} + {{- end }} + {{- else if or .Values.controller.runOnControlPlane .Values.controller.runOnMaster}} + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + {{- if .Values.controller.runOnControlPlane}} + - key: node-role.kubernetes.io/control-plane + operator: Exists + {{- end}} + {{- if .Values.controller.runOnMaster}} + - key: node-role.kubernetes.io/master + operator: Exists + {{- end}} + {{- end }} priorityClassName: system-cluster-critical securityContext: seccompProfile: @@ -57,10 +72,6 @@ spec: {{- with .Values.controller.tolerations }} tolerations: {{ toYaml . | indent 8 }} -{{- end }} -{{- with .Values.controller.affinity }} - affinity: -{{ toYaml . | indent 8 }} {{- end }} {{- if .Values.imagePullSecrets }} imagePullSecrets: diff --git a/charts/latest/azurefile-csi-driver/templates/csi-snapshot-controller.yaml b/charts/latest/azurefile-csi-driver/templates/csi-snapshot-controller.yaml index b1ab6336ab..8b343c066b 100644 --- a/charts/latest/azurefile-csi-driver/templates/csi-snapshot-controller.yaml +++ b/charts/latest/azurefile-csi-driver/templates/csi-snapshot-controller.yaml @@ -45,6 +45,27 @@ spec: serviceAccountName: {{ .Values.serviceAccount.snapshotController }} nodeSelector: kubernetes.io/os: linux + # runOnControlPlane=true or runOnMaster=true only takes effect if affinity is not set + {{- if contains (tpl "{{ .Values.controller.affinity }}" .) "nodeSelectorTerms" }} + {{- with .Values.controller.affinity }} + affinity: + {{ toYaml . | indent 8 }} + {{- end }} + {{- else if or .Values.controller.runOnControlPlane .Values.controller.runOnMaster}} + affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + {{- if .Values.controller.runOnControlPlane}} + - key: node-role.kubernetes.io/control-plane + operator: Exists + {{- end}} + {{- if .Values.controller.runOnMaster}} + - key: node-role.kubernetes.io/master + operator: Exists + {{- end}} + {{- end }} priorityClassName: system-cluster-critical securityContext: seccompProfile: @@ -52,10 +73,6 @@ spec: {{- with .Values.controller.tolerations }} tolerations: {{ toYaml . | indent 8 }} -{{- end }} -{{- with .Values.controller.affinity }} - affinity: -{{ toYaml . | indent 8 }} {{- end }} {{- if .Values.imagePullSecrets }} imagePullSecrets: