Skip to content

Commit e02af61

Browse files
authored
Merge pull request #816 from andyzhangx/fix-runOnControlPlane
fix: runOnControlPlane chart config
2 parents 49ec91f + 51786a5 commit e02af61

File tree

5 files changed

+42
-20
lines changed

5 files changed

+42
-20
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ REGISTRY_NAME ?= $(shell echo $(REGISTRY) | sed "s/.azurecr.io//g")
4242
IMAGE_TAG = $(REGISTRY)/$(IMAGENAME):$(IMAGE_VERSION)
4343
IMAGE_TAG_LATEST = $(REGISTRY)/$(IMAGENAME):latest
4444

45-
E2E_HELM_OPTIONS ?= --set image.nfs.repository=$(REGISTRY)/$(IMAGENAME) --set image.nfs.tag=$(IMAGE_VERSION) --set image.nfs.pullPolicy=Always --set feature.enableInlineVolume=true --set externalSnapshotter.enabled=true
45+
E2E_HELM_OPTIONS ?= --set image.nfs.repository=$(REGISTRY)/$(IMAGENAME) --set image.nfs.tag=$(IMAGE_VERSION) --set image.nfs.pullPolicy=Always --set feature.enableInlineVolume=true --set externalSnapshotter.enabled=true --set controller.runOnControlPlane=true
4646
E2E_HELM_OPTIONS += ${EXTRA_HELM_OPTIONS}
4747

4848
# Output type of docker buildx build
148 Bytes
Binary file not shown.

charts/latest/csi-driver-nfs/templates/csi-nfs-controller.yaml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,29 @@ spec:
2424
hostNetwork: true # controller also needs to mount nfs to create dir
2525
dnsPolicy: {{ .Values.controller.dnsPolicy }}
2626
serviceAccountName: {{ .Values.serviceAccount.controller }}
27-
{{- with .Values.controller.affinity }}
27+
# runOnControlPlane=true or runOnMaster=true only takes effect if affinity is not set
28+
{{- if contains (tpl "{{ .Values.controller.affinity }}" .) "nodeSelectorTerms" }}
29+
{{- with .Values.controller.affinity }}
2830
affinity:
29-
{{ toYaml . | indent 8 }}
30-
{{- end }}
31+
{{ toYaml . | indent 8 }}
32+
{{- end }}
33+
{{- else if or .Values.controller.runOnControlPlane .Values.controller.runOnMaster}}
34+
affinity:
35+
nodeAffinity:
36+
requiredDuringSchedulingIgnoredDuringExecution:
37+
nodeSelectorTerms:
38+
- matchExpressions:
39+
{{- if .Values.controller.runOnControlPlane}}
40+
- key: node-role.kubernetes.io/control-plane
41+
operator: Exists
42+
{{- end}}
43+
{{- if .Values.controller.runOnMaster}}
44+
- key: node-role.kubernetes.io/master
45+
operator: Exists
46+
{{- end}}
47+
{{- end }}
3148
nodeSelector:
3249
kubernetes.io/os: linux
33-
{{- if .Values.controller.runOnMaster}}
34-
node-role.kubernetes.io/master: ""
35-
{{- end}}
36-
{{- if .Values.controller.runOnControlPlane}}
37-
node-role.kubernetes.io/control-plane: ""
38-
{{- end}}
3950
{{- with .Values.controller.nodeSelector }}
4051
{{ toYaml . | indent 8 }}
4152
{{- end }}
159 Bytes
Binary file not shown.

charts/v4.9.0/csi-driver-nfs/templates/csi-nfs-controller.yaml

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,29 @@ spec:
2424
hostNetwork: true # controller also needs to mount nfs to create dir
2525
dnsPolicy: {{ .Values.controller.dnsPolicy }}
2626
serviceAccountName: {{ .Values.serviceAccount.controller }}
27-
{{- with .Values.controller.affinity }}
27+
# runOnControlPlane=true or runOnMaster=true only takes effect if affinity is not set
28+
{{- if contains (tpl "{{ .Values.controller.affinity }}" .) "nodeSelectorTerms" }}
29+
{{- with .Values.controller.affinity }}
2830
affinity:
29-
{{ toYaml . | indent 8 }}
30-
{{- end }}
31+
{{ toYaml . | indent 8 }}
32+
{{- end }}
33+
{{- else if or .Values.controller.runOnControlPlane .Values.controller.runOnMaster}}
34+
affinity:
35+
nodeAffinity:
36+
requiredDuringSchedulingIgnoredDuringExecution:
37+
nodeSelectorTerms:
38+
- matchExpressions:
39+
{{- if .Values.controller.runOnControlPlane}}
40+
- key: node-role.kubernetes.io/control-plane
41+
operator: Exists
42+
{{- end}}
43+
{{- if .Values.controller.runOnMaster}}
44+
- key: node-role.kubernetes.io/master
45+
operator: Exists
46+
{{- end}}
47+
{{- end }}
3148
nodeSelector:
3249
kubernetes.io/os: linux
33-
{{- if .Values.controller.runOnMaster}}
34-
node-role.kubernetes.io/master: ""
35-
{{- end}}
36-
{{- if .Values.controller.runOnControlPlane}}
37-
node-role.kubernetes.io/control-plane: ""
38-
{{- end}}
3950
{{- with .Values.controller.nodeSelector }}
4051
{{ toYaml . | indent 8 }}
4152
{{- end }}
@@ -171,4 +182,4 @@ spec:
171182
path: {{ .Values.kubeletDir }}/pods
172183
type: Directory
173184
- name: socket-dir
174-
emptyDir: {}
185+
emptyDir: {}

0 commit comments

Comments
 (0)