Skip to content

Commit 4833296

Browse files
authored
Merge pull request #308 from andyzhangx/tolerations
feat: support customization tolerations in chart
2 parents be08a54 + 6528a46 commit 4833296

File tree

7 files changed

+26
-20
lines changed

7 files changed

+26
-20
lines changed

charts/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ The following table lists the configurable parameters of the latest SMB CSI Driv
9696
| `node.resources.smb.requests.memory` | smb-csi-driver memory requests limits | 20Mi |
9797
| `node.affinity` | node pod affinity | {} |
9898
| `node.nodeSelector` | node pod node selector | {} |
99-
| `node.tolerations` | node pod tolerations | [] |
10099
| `podAnnotations` | collection of annotations to add to all the pods | {} |
101100
| `podLabels` | collection of labels to add to all the pods | {} |
102101
| `priorityClassName` | priority class name to be added to pods | system-cluster-critical |
-2 Bytes
Binary file not shown.

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,8 @@ spec:
3737
kubernetes.io/role: master
3838
{{- end}}
3939
priorityClassName: system-cluster-critical
40-
tolerations:
41-
- key: "node-role.kubernetes.io/master"
42-
operator: "Equal"
43-
value: "true"
44-
effect: "NoSchedule"
45-
- key: "node-role.kubernetes.io/controlplane"
46-
operator: "Equal"
47-
value: "true"
48-
effect: "NoSchedule"
4940
{{- with .Values.controller.tolerations }}
41+
tolerations:
5042
{{ toYaml . | indent 8 }}
5143
{{- end }}
5244
{{- include "smb.pullSecrets" . | indent 6 }}

charts/latest/csi-driver-smb/templates/csi-smb-node-windows.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ spec:
1414
{{ include "smb.labels" . | indent 6 }}
1515
app: csi-smb-node-win
1616
spec:
17+
{{- with .Values.windows.tolerations }}
1718
tolerations:
18-
- key: "node.kubernetes.io/os"
19-
operator: "Exists"
20-
effect: "NoSchedule"
19+
{{ toYaml . | indent 8 }}
20+
{{- end }}
2121
nodeSelector:
2222
kubernetes.io/os: windows
2323
priorityClassName: system-node-critical

charts/latest/csi-driver-smb/templates/csi-smb-node.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,11 @@ spec:
3232
{{- toYaml .Values.node.affinity | nindent 8 }}
3333
{{- end }}
3434
priorityClassName: {{ .Values.priorityClassName | quote }}
35+
{{- with .Values.linux.tolerations }}
3536
tolerations:
36-
- operator: "Exists"
37+
{{ toYaml . | indent 8 }}
38+
{{- end }}
3739
{{- include "smb.pullSecrets" . | indent 6 }}
38-
{{- if .Values.node.tolerations }}
39-
{{- toYaml .Values.node.tolerations | nindent 8 }}
40-
{{- end }}
4140
containers:
4241
- name: liveness-probe
4342
volumeMounts:

charts/latest/csi-driver-smb/values.yaml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,15 @@ controller:
5454
memory: 20Mi
5555
affinity: {}
5656
nodeSelector: {}
57-
tolerations: []
57+
tolerations:
58+
- key: "node-role.kubernetes.io/master"
59+
operator: "Equal"
60+
value: "true"
61+
effect: "NoSchedule"
62+
- key: "node-role.kubernetes.io/controlplane"
63+
operator: "Equal"
64+
value: "true"
65+
effect: "NoSchedule"
5866

5967
node:
6068
metricsPort: 29645
@@ -85,11 +93,12 @@ node:
8593
memory: 20Mi
8694
affinity: {}
8795
nodeSelector: {}
88-
tolerations: []
8996

9097
linux:
9198
enabled: true
9299
kubelet: /var/lib/kubelet
100+
tolerations:
101+
- operator: "Exists"
93102

94103
windows:
95104
enabled: false
@@ -103,7 +112,10 @@ windows:
103112
repository: mcr.microsoft.com/oss/kubernetes-csi/csi-node-driver-registrar
104113
tag: v2.2.0
105114
pullPolicy: IfNotPresent
106-
115+
tolerations:
116+
- key: "node.kubernetes.io/os"
117+
operator: "Exists"
118+
effect: "NoSchedule"
107119

108120
## Collection of annotations to add to all the pods
109121
podAnnotations: {}

pkg/smb/controllerserver.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ func (d *Driver) CreateVolume(ctx context.Context, req *csi.CreateVolumeRequest)
107107
return nil, status.Errorf(codes.Internal, "failed to make subdirectory: %v", err.Error())
108108
}
109109
parameters[sourceField] = parameters[sourceField] + "/" + smbVol.subDir
110+
} else {
111+
klog.Infof("CreateVolume(%s) does not provide secrets", name)
110112
}
111113
return &csi.CreateVolumeResponse{Volume: d.smbVolToCSI(smbVol, parameters)}, nil
112114
}
@@ -142,6 +144,8 @@ func (d *Driver) DeleteVolume(ctx context.Context, req *csi.DeleteVolumeRequest)
142144
if err = os.RemoveAll(internalVolumePath); err != nil {
143145
return nil, status.Errorf(codes.Internal, "failed to delete subdirectory: %v", err.Error())
144146
}
147+
} else {
148+
klog.Infof("DeleteVolume(%s) does not provide secrets", volumeID)
145149
}
146150

147151
return &csi.DeleteVolumeResponse{}, nil

0 commit comments

Comments
 (0)