|
| 1 | +--- |
| 2 | +kind: Deployment |
| 3 | +apiVersion: apps/v1 |
| 4 | +metadata: |
| 5 | + name: {{ .Values.controller.name }} |
| 6 | + namespace: {{ .Release.Namespace }} |
| 7 | +{{ include "nfs.labels" . | indent 2 }} |
| 8 | +spec: |
| 9 | + replicas: {{ .Values.controller.replicas }} |
| 10 | + selector: |
| 11 | + matchLabels: |
| 12 | + app: {{ .Values.controller.name }} |
| 13 | + strategy: |
| 14 | + type: {{ .Values.controller.strategyType }} |
| 15 | + template: |
| 16 | + metadata: |
| 17 | +{{ include "nfs.labels" . | indent 6 }} |
| 18 | + app: {{ .Values.controller.name }} |
| 19 | + spec: |
| 20 | + {{- if .Values.imagePullSecrets }} |
| 21 | + imagePullSecrets: |
| 22 | +{{ toYaml .Values.imagePullSecrets | indent 8 }} |
| 23 | + {{- end }} |
| 24 | + hostNetwork: true # controller also needs to mount nfs to create dir |
| 25 | + dnsPolicy: {{ .Values.controller.dnsPolicy }} |
| 26 | + serviceAccountName: {{ .Values.serviceAccount.controller }} |
| 27 | + # runOnControlPlane=true or runOnMaster=true only takes effect if affinity is not set |
| 28 | + {{- if tpl "{{ .Values.controller.affinity }}" . | contains "nodeSelectorTerms" }} |
| 29 | + {{- with .Values.controller.affinity }} |
| 30 | + affinity: |
| 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 }} |
| 48 | + nodeSelector: |
| 49 | + kubernetes.io/os: linux |
| 50 | +{{- with .Values.controller.nodeSelector }} |
| 51 | +{{ toYaml . | indent 8 }} |
| 52 | +{{- end }} |
| 53 | + priorityClassName: {{ .Values.controller.priorityClassName }} |
| 54 | + securityContext: |
| 55 | + seccompProfile: |
| 56 | + type: RuntimeDefault |
| 57 | +{{- with .Values.controller.tolerations }} |
| 58 | + tolerations: |
| 59 | +{{ toYaml . | indent 8 }} |
| 60 | +{{- end }} |
| 61 | + containers: |
| 62 | + - name: csi-provisioner |
| 63 | +{{- if hasPrefix "/" .Values.image.csiProvisioner.repository }} |
| 64 | + image: "{{ .Values.image.baseRepo }}{{ .Values.image.csiProvisioner.repository }}:{{ .Values.image.csiProvisioner.tag }}" |
| 65 | +{{- else }} |
| 66 | + image: "{{ .Values.image.csiProvisioner.repository }}:{{ .Values.image.csiProvisioner.tag }}" |
| 67 | +{{- end }} |
| 68 | + args: |
| 69 | + - "-v=2" |
| 70 | + - "--csi-address=$(ADDRESS)" |
| 71 | + - "--leader-election" |
| 72 | + - "--leader-election-namespace={{ .Release.Namespace }}" |
| 73 | + - "--extra-create-metadata=true" |
| 74 | + - "--feature-gates=HonorPVReclaimPolicy=true,VolumeAttributesClass=false" |
| 75 | + - "--timeout=1200s" |
| 76 | + - "--retry-interval-max=30m" |
| 77 | + env: |
| 78 | + - name: ADDRESS |
| 79 | + value: /csi/csi.sock |
| 80 | + imagePullPolicy: {{ .Values.image.csiProvisioner.pullPolicy }} |
| 81 | + volumeMounts: |
| 82 | + - mountPath: /csi |
| 83 | + name: socket-dir |
| 84 | + resources: {{- toYaml .Values.controller.resources.csiProvisioner | nindent 12 }} |
| 85 | + securityContext: |
| 86 | + readOnlyRootFilesystem: true |
| 87 | + capabilities: |
| 88 | + drop: |
| 89 | + - ALL |
| 90 | + - name: csi-resizer |
| 91 | +{{- if hasPrefix "/" .Values.image.csiResizer.repository }} |
| 92 | + image: "{{ .Values.image.baseRepo }}{{ .Values.image.csiResizer.repository }}:{{ .Values.image.csiResizer.tag }}" |
| 93 | +{{- else }} |
| 94 | + image: "{{ .Values.image.csiResizer.repository }}:{{ .Values.image.csiResizer.tag }}" |
| 95 | +{{- end }} |
| 96 | + args: |
| 97 | + - "-csi-address=$(ADDRESS)" |
| 98 | + - "-v=2" |
| 99 | + - "-leader-election" |
| 100 | + - "--leader-election-namespace={{ .Release.Namespace }}" |
| 101 | + - '-handle-volume-inuse-error=false' |
| 102 | + - '-feature-gates=VolumeAttributesClass=false' |
| 103 | + env: |
| 104 | + - name: ADDRESS |
| 105 | + value: /csi/csi.sock |
| 106 | + imagePullPolicy: {{ .Values.image.csiResizer.pullPolicy }} |
| 107 | + volumeMounts: |
| 108 | + - name: socket-dir |
| 109 | + mountPath: /csi |
| 110 | + resources: {{- toYaml .Values.controller.resources.csiResizer | nindent 12 }} |
| 111 | + securityContext: |
| 112 | + capabilities: |
| 113 | + drop: |
| 114 | + - ALL |
| 115 | +{{- if .Values.controller.enableSnapshotter }} |
| 116 | + - name: csi-snapshotter |
| 117 | +{{- if hasPrefix "/" .Values.image.csiSnapshotter.repository }} |
| 118 | + image: "{{ .Values.image.baseRepo }}{{ .Values.image.csiSnapshotter.repository }}:{{ .Values.image.csiSnapshotter.tag }}" |
| 119 | +{{- else }} |
| 120 | + image: "{{ .Values.image.csiSnapshotter.repository }}:{{ .Values.image.csiSnapshotter.tag }}" |
| 121 | +{{- end }} |
| 122 | + args: |
| 123 | + - "--v=2" |
| 124 | + - "--csi-address=$(ADDRESS)" |
| 125 | + - "--leader-election-namespace={{ .Release.Namespace }}" |
| 126 | + - "--leader-election" |
| 127 | + - "--timeout=1200s" |
| 128 | + - "--retry-interval-max=30m" |
| 129 | + env: |
| 130 | + - name: ADDRESS |
| 131 | + value: /csi/csi.sock |
| 132 | + imagePullPolicy: {{ .Values.image.csiSnapshotter.pullPolicy }} |
| 133 | + resources: {{- toYaml .Values.controller.resources.csiSnapshotter | nindent 12 }} |
| 134 | + volumeMounts: |
| 135 | + - name: socket-dir |
| 136 | + mountPath: /csi |
| 137 | + securityContext: |
| 138 | + capabilities: |
| 139 | + drop: |
| 140 | + - ALL |
| 141 | +{{- end }} |
| 142 | + - name: liveness-probe |
| 143 | +{{- if hasPrefix "/" .Values.image.livenessProbe.repository }} |
| 144 | + image: "{{ .Values.image.baseRepo }}{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" |
| 145 | +{{- else }} |
| 146 | + image: "{{ .Values.image.livenessProbe.repository }}:{{ .Values.image.livenessProbe.tag }}" |
| 147 | +{{- end }} |
| 148 | + args: |
| 149 | + - --csi-address=/csi/csi.sock |
| 150 | + - --probe-timeout=3s |
| 151 | + - --http-endpoint=localhost:{{ .Values.controller.livenessProbe.healthPort }} |
| 152 | + - --v=2 |
| 153 | + imagePullPolicy: {{ .Values.image.livenessProbe.pullPolicy }} |
| 154 | + volumeMounts: |
| 155 | + - name: socket-dir |
| 156 | + mountPath: /csi |
| 157 | + resources: {{- toYaml .Values.controller.resources.livenessProbe | nindent 12 }} |
| 158 | + securityContext: |
| 159 | + readOnlyRootFilesystem: true |
| 160 | + capabilities: |
| 161 | + drop: |
| 162 | + - ALL |
| 163 | + - name: nfs |
| 164 | +{{- if hasPrefix "/" .Values.image.nfs.repository }} |
| 165 | + image: "{{ .Values.image.baseRepo }}{{ .Values.image.nfs.repository }}:{{ .Values.image.nfs.tag }}" |
| 166 | +{{- else }} |
| 167 | + image: "{{ .Values.image.nfs.repository }}:{{ .Values.image.nfs.tag }}" |
| 168 | +{{- end }} |
| 169 | + securityContext: |
| 170 | + privileged: true |
| 171 | + capabilities: |
| 172 | + add: ["SYS_ADMIN"] |
| 173 | + drop: |
| 174 | + - ALL |
| 175 | + allowPrivilegeEscalation: true |
| 176 | + imagePullPolicy: {{ .Values.image.nfs.pullPolicy }} |
| 177 | + args: |
| 178 | + - "--v={{ .Values.controller.logLevel }}" |
| 179 | + - "--nodeid=$(NODE_ID)" |
| 180 | + - "--endpoint=$(CSI_ENDPOINT)" |
| 181 | + - "--drivername={{ .Values.driver.name }}" |
| 182 | + - "--mount-permissions={{ .Values.driver.mountPermissions }}" |
| 183 | + - "--working-mount-dir={{ .Values.controller.workingMountDir }}" |
| 184 | + - "--default-ondelete-policy={{ .Values.controller.defaultOnDeletePolicy }}" |
| 185 | + - "--use-tar-command-in-snapshot={{ .Values.controller.useTarCommandInSnapshot }}" |
| 186 | + - "--enable-snapshot-compression={{ .Values.controller.enableSnapshotCompression }}" |
| 187 | + env: |
| 188 | + - name: NODE_ID |
| 189 | + valueFrom: |
| 190 | + fieldRef: |
| 191 | + fieldPath: spec.nodeName |
| 192 | + - name: CSI_ENDPOINT |
| 193 | + value: unix:///csi/csi.sock |
| 194 | + livenessProbe: |
| 195 | + failureThreshold: 5 |
| 196 | + httpGet: |
| 197 | + host: localhost |
| 198 | + path: /healthz |
| 199 | + port: {{ .Values.controller.livenessProbe.healthPort }} |
| 200 | + initialDelaySeconds: 30 |
| 201 | + timeoutSeconds: 10 |
| 202 | + periodSeconds: 30 |
| 203 | + volumeMounts: |
| 204 | + - name: pods-mount-dir |
| 205 | + mountPath: {{ .Values.kubeletDir }}/pods |
| 206 | + mountPropagation: "Bidirectional" |
| 207 | + - mountPath: /csi |
| 208 | + name: socket-dir |
| 209 | + resources: {{- toYaml .Values.controller.resources.nfs | nindent 12 }} |
| 210 | + volumes: |
| 211 | + - name: pods-mount-dir |
| 212 | + hostPath: |
| 213 | + path: {{ .Values.kubeletDir }}/pods |
| 214 | + type: Directory |
| 215 | + - name: socket-dir |
| 216 | + emptyDir: {} |
0 commit comments