Skip to content

Commit 0b77374

Browse files
authored
add syncer sidecar for vspehere csi (#61)
Signed-off-by: Nikolay Gorbatov <[email protected]>
1 parent 21068d4 commit 0b77374

File tree

3 files changed

+55
-2
lines changed

3 files changed

+55
-2
lines changed

charts/helm_lib/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
apiVersion: v2
22
type: library
33
name: deckhouse_lib_helm
4-
version: 1.25.0
4+
version: 1.26.0
55
description: "Helm utils template definitions for Deckhouse modules."

charts/helm_lib/templates/_csi_controller.tpl

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ cpu: 10m
1313
memory: 25Mi
1414
{{- end }}
1515

16+
{{- define "syncer_resources" }}
17+
cpu: 10m
18+
memory: 25Mi
19+
{{- end }}
20+
1621
{{- define "snapshotter_resources" }}
1722
cpu: 10m
1823
memory: 25Mi
@@ -36,6 +41,7 @@ memory: 50Mi
3641
{{- $fullname := $config.fullname | default "csi-controller" }}
3742
{{- $snapshotterEnabled := dig "snapshotterEnabled" true $config }}
3843
{{- $resizerEnabled := dig "resizerEnabled" true $config }}
44+
{{- $syncerEnabled := dig "syncerEnabled" false $config }}
3945
{{- $topologyEnabled := dig "topologyEnabled" true $config }}
4046
{{- $extraCreateMetadataEnabled := dig "extraCreateMetadataEnabled" false $config }}
4147
{{- $controllerImage := $config.controllerImage | required "$config.controllerImage is required" }}
@@ -48,6 +54,7 @@ memory: 50Mi
4854
{{- $resizerWorkers := $config.resizerWorkers | default "10" }}
4955
{{- $snapshotterWorkers := $config.snapshotterWorkers | default "10" }}
5056
{{- $additionalControllerEnvs := $config.additionalControllerEnvs }}
57+
{{- $additionalSyncerEnvs := $config.additionalSyncerEnvs }}
5158
{{- $additionalControllerArgs := $config.additionalControllerArgs }}
5259
{{- $additionalControllerVolumes := $config.additionalControllerVolumes }}
5360
{{- $additionalControllerVolumeMounts := $config.additionalControllerVolumeMounts }}
@@ -65,6 +72,9 @@ memory: 50Mi
6572
{{- $resizerImageName := join "" (list "csiExternalResizer" $kubernetesSemVer.Major $kubernetesSemVer.Minor) }}
6673
{{- $resizerImage := include "helm_lib_module_common_image_no_fail" (list $context $resizerImageName) }}
6774

75+
{{- $syncerImageName := join "" (list "csiVsphereSyncer" $kubernetesSemVer.Major $kubernetesSemVer.Minor) }}
76+
{{- $syncerImage := include "helm_lib_module_common_image_no_fail" (list $context $syncerImageName) }}
77+
6878
{{- $snapshotterImageName := join "" (list "csiExternalSnapshotter" $kubernetesSemVer.Major $kubernetesSemVer.Minor) }}
6979
{{- $snapshotterImage := include "helm_lib_module_common_image_no_fail" (list $context $snapshotterImageName) }}
7080

@@ -109,6 +119,14 @@ spec:
109119
cpu: 20m
110120
memory: 50Mi
111121
{{- end }}
122+
{{- if $syncerEnabled }}
123+
- containerName: "syncer"
124+
minAllowed:
125+
{{- include "syncer_resources" $context | nindent 8 }}
126+
maxAllowed:
127+
cpu: 20m
128+
memory: 50Mi
129+
{{- end }}
112130
{{- if $snapshotterEnabled }}
113131
- containerName: "snapshotter"
114132
minAllowed:
@@ -278,6 +296,33 @@ spec:
278296
{{- include "helm_lib_module_ephemeral_storage_logs_with_extra" 10 | nindent 12 }}
279297
{{- if not ( $context.Values.global.enabledModules | has "vertical-pod-autoscaler-crd") }}
280298
{{- include "resizer_resources" $context | nindent 12 }}
299+
{{- end }}
300+
{{- end }}
301+
{{- if $syncerEnabled }}
302+
- name: syncer
303+
{{- include "helm_lib_module_container_security_context_read_only_root_filesystem" . | nindent 8 }}
304+
image: {{ $syncerImage | quote }}
305+
args:
306+
- "--leader-election"
307+
- "--leader-election-lease-duration=30s"
308+
- "--leader-election-renew-deadline=20s"
309+
- "--leader-election-retry-period=10s"
310+
{{- if $additionalControllerArgs }}
311+
{{- $additionalControllerArgs | toYaml | nindent 8 }}
312+
{{- end }}
313+
{{- if $additionalSyncerEnvs }}
314+
env:
315+
{{- $additionalSyncerEnvs | toYaml | nindent 8 }}
316+
{{- end }}
317+
{{- if $additionalControllerVolumeMounts }}
318+
volumeMounts:
319+
{{- $additionalControllerVolumeMounts | toYaml | nindent 8 }}
320+
{{- end }}
321+
resources:
322+
requests:
323+
{{- include "helm_lib_module_ephemeral_storage_logs_with_extra" 10 | nindent 12 }}
324+
{{- if not ( $context.Values.global.enabledModules | has "vertical-pod-autoscaler-crd") }}
325+
{{- include "syncer_resources" $context | nindent 12 }}
281326
{{- end }}
282327
{{- end }}
283328
{{- if $snapshotterEnabled }}

charts/helm_lib/templates/_csi_node.tpl

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ memory: 25Mi
2121
{{- $additionalNodeArgs := $config.additionalNodeArgs }}
2222
{{- $additionalNodeVolumes := $config.additionalNodeVolumes }}
2323
{{- $additionalNodeVolumeMounts := $config.additionalNodeVolumeMounts }}
24+
{{- $additionalNodeLivenessProbesCmd := $config.additionalNodeLivenessProbesCmd }}
2425
{{- $initContainerCommand := $config.initContainerCommand }}
2526
{{- $initContainerImage := $config.initContainerImage }}
2627

@@ -100,7 +101,7 @@ spec:
100101
dnsPolicy: ClusterFirstWithHostNet
101102
containers:
102103
- name: node-driver-registrar
103-
{{- include "helm_lib_module_container_security_context_read_only_root_filesystem_capabilities_drop_all" $context | nindent 8 }}
104+
{{- include "helm_lib_module_container_security_context_not_allow_privilege_escalation" $context | nindent 8 }}
104105
image: {{ $driverRegistrarImage | quote }}
105106
args:
106107
- "--v=5"
@@ -115,6 +116,13 @@ spec:
115116
valueFrom:
116117
fieldRef:
117118
fieldPath: spec.nodeName
119+
{{- if $additionalNodeLivenessProbesCmd }}
120+
livenessProbe:
121+
initialDelaySeconds: 3
122+
exec:
123+
command:
124+
{{- $additionalNodeLivenessProbesCmd | toYaml | nindent 12 }}
125+
{{- end }}
118126
volumeMounts:
119127
- name: plugin-dir
120128
mountPath: /csi

0 commit comments

Comments
 (0)