Skip to content

Commit c56dffe

Browse files
authored
Changes for CSI NFS controller and nodes (#55)
Signed-off-by: v.oleynikov <[email protected]>
1 parent cdead9a commit c56dffe

File tree

5 files changed

+56
-3
lines changed

5 files changed

+56
-3
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.20.0
4+
version: 1.21.0
55
description: "Helm utils template definitions for Deckhouse modules."

charts/helm_lib/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,12 @@
4747
| [helm_lib_module_pod_security_context_run_as_user_deckhouse](#helm_lib_module_pod_security_context_run_as_user_deckhouse) |
4848
| [helm_lib_module_pod_security_context_run_as_user_deckhouse_with_writable_fs](#helm_lib_module_pod_security_context_run_as_user_deckhouse_with_writable_fs) |
4949
| [helm_lib_module_pod_security_context_run_as_user_root](#helm_lib_module_pod_security_context_run_as_user_root) |
50+
| [helm_lib_module_pod_security_context_runtime_default](#helm_lib_module_pod_security_context_runtime_default) |
5051
| [helm_lib_module_container_security_context_not_allow_privilege_escalation](#helm_lib_module_container_security_context_not_allow_privilege_escalation) |
5152
| [helm_lib_module_container_security_context_read_only_root_filesystem_with_selinux](#helm_lib_module_container_security_context_read_only_root_filesystem_with_selinux) |
5253
| [helm_lib_module_container_security_context_read_only_root_filesystem](#helm_lib_module_container_security_context_read_only_root_filesystem) |
5354
| [helm_lib_module_container_security_context_privileged](#helm_lib_module_container_security_context_privileged) |
55+
| [helm_lib_module_container_security_context_escalated_sys_admin_privileged](#helm_lib_module_container_security_context_escalated_sys_admin_privileged) |
5456
| [helm_lib_module_container_security_context_privileged_read_only_root_filesystem](#helm_lib_module_container_security_context_privileged_read_only_root_filesystem) |
5557
| [helm_lib_module_container_security_context_read_only_root_filesystem_capabilities_drop_all](#helm_lib_module_container_security_context_read_only_root_filesystem_capabilities_drop_all) |
5658
| [helm_lib_module_container_security_context_read_only_root_filesystem_capabilities_drop_all_and_add](#helm_lib_module_container_security_context_read_only_root_filesystem_capabilities_drop_all_and_add) |
@@ -529,6 +531,19 @@ list:
529531
- Template context with .Values, .Chart, etc
530532

531533

534+
### helm_lib_module_pod_security_context_runtime_default
535+
536+
returns PodSecurityContext parameters for Pod with seccomp profile RuntimeDefault
537+
538+
#### Usage
539+
540+
`{{ include "helm_lib_module_pod_security_context_runtime_default" . }} `
541+
542+
#### Arguments
543+
544+
- Template context with .Values, .Chart, etc
545+
546+
532547
### helm_lib_module_container_security_context_not_allow_privilege_escalation
533548

534549
returns SecurityContext parameters for Container with allowPrivilegeEscalation false
@@ -575,6 +590,16 @@ list:
575590

576591

577592

593+
### helm_lib_module_container_security_context_escalated_sys_admin_privileged
594+
595+
returns SecurityContext parameters for Container running privileged with escalation and sys_admin
596+
597+
#### Usage
598+
599+
`{{ include "helm_lib_module_container_security_context_escalated_sys_admin_privileged" . }} `
600+
601+
602+
578603
### helm_lib_module_container_security_context_privileged_read_only_root_filesystem
579604

580605
returns SecurityContext parameters for Container running privileged with read only root filesystem

charts/helm_lib/templates/_csi_controller.tpl

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,11 @@ spec:
172172
{{- include "helm_lib_priority_class" (tuple $context "system-cluster-critical") | nindent 6 }}
173173
{{- include "helm_lib_node_selector" (tuple $context "master") | nindent 6 }}
174174
{{- include "helm_lib_tolerations" (tuple $context "any-node" "with-uninitialized") | nindent 6 }}
175+
{{- if $context.Values.global.enabledModules | has "csi-nfs" }}
176+
{{- include "helm_lib_module_pod_security_context_runtime_default" . | nindent 6 }}
177+
{{- else }}
175178
{{- include "helm_lib_module_pod_security_context_run_as_user_deckhouse" . | nindent 6 }}
179+
{{- end }}
176180
serviceAccountName: csi
177181
containers:
178182
- name: provisioner
@@ -324,7 +328,11 @@ spec:
324328
{{- include "livenessprobe_resources" $context | nindent 12 }}
325329
{{- end }}
326330
- name: controller
331+
{{- if $context.Values.global.enabledModules | has "csi-nfs" }}
332+
{{- include "helm_lib_module_container_security_context_escalated_sys_admin_privileged" . | nindent 8 }}
333+
{{- else }}
327334
{{- include "helm_lib_module_container_security_context_read_only_root_filesystem" . | nindent 8 }}
335+
{{- end }}
328336
image: {{ $controllerImage | quote }}
329337
args:
330338
{{- if $additionalControllerArgs }}

charts/helm_lib/templates/_csi_node.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ memory: 25Mi
2828
{{- $driverRegistrarImageName := join "" (list "csiNodeDriverRegistrar" $kubernetesSemVer.Major $kubernetesSemVer.Minor) }}
2929
{{- $driverRegistrarImage := include "helm_lib_module_common_image_no_fail" (list $context $driverRegistrarImageName) }}
3030
{{- if $driverRegistrarImage }}
31-
{{- if or (include "_helm_lib_cloud_or_hybrid_cluster" $context) ($context.Values.global.enabledModules | has "ceph-csi") }}
31+
{{- if or (include "_helm_lib_cloud_or_hybrid_cluster" $context) ($context.Values.global.enabledModules | has "ceph-csi") ($context.Values.global.enabledModules | has "csi-nfs") }}
3232
{{- if ($context.Values.global.enabledModules | has "vertical-pod-autoscaler-crd") }}
3333
---
3434
apiVersion: autoscaling.k8s.io/v1
@@ -88,7 +88,7 @@ spec:
8888
- CloudEphemeral
8989
- CloudPermanent
9090
- CloudStatic
91-
{{- if or (eq $fullname "csi-node-rbd") (eq $fullname "csi-node-cephfs") }}
91+
{{- if or (eq $fullname "csi-node-rbd") (eq $fullname "csi-node-cephfs") (eq $fullname "csi-nfs") }}
9292
- Static
9393
{{- end }}
9494
imagePullSecrets:

charts/helm_lib/templates/_module_security_context.tpl

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,15 @@ securityContext:
6262
runAsGroup: 0
6363
{{- end }}
6464

65+
{{- /* Usage: {{ include "helm_lib_module_pod_security_context_runtime_default" . }} */ -}}
66+
{{- /* returns PodSecurityContext parameters for Pod with seccomp profile RuntimeDefault */ -}}
67+
{{- define "helm_lib_module_pod_security_context_runtime_default" -}}
68+
{{- /* Template context with .Values, .Chart, etc */ -}}
69+
securityContext:
70+
seccompProfile:
71+
type: RuntimeDefault
72+
{{- end }}
73+
6574
{{- /* Usage: {{ include "helm_lib_module_container_security_context_not_allow_privilege_escalation" . }} */ -}}
6675
{{- /* returns SecurityContext parameters for Container with allowPrivilegeEscalation false */ -}}
6776
{{- define "helm_lib_module_container_security_context_not_allow_privilege_escalation" -}}
@@ -97,6 +106,17 @@ securityContext:
97106
privileged: true
98107
{{- end }}
99108

109+
{{- /* Usage: {{ include "helm_lib_module_container_security_context_escalated_sys_admin_privileged" . }} */ -}}
110+
{{- /* returns SecurityContext parameters for Container running privileged with escalation and sys_admin */ -}}
111+
{{- define "helm_lib_module_container_security_context_escalated_sys_admin_privileged" -}}
112+
securityContext:
113+
allowPrivilegeEscalation: true
114+
capabilities:
115+
add:
116+
- SYS_ADMIN
117+
privileged: true
118+
{{- end }}
119+
100120
{{- /* Usage: {{ include "helm_lib_module_container_security_context_privileged_read_only_root_filesystem" . }} */ -}}
101121
{{- /* returns SecurityContext parameters for Container running privileged with read only root filesystem */ -}}
102122
{{- define "helm_lib_module_container_security_context_privileged_read_only_root_filesystem" -}}

0 commit comments

Comments
 (0)