Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/helm_lib/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v2
type: library
name: deckhouse_lib_helm
version: 1.72.6
version: 1.72.7
description: "Helm utils template definitions for Deckhouse modules."
8 changes: 2 additions & 6 deletions charts/helm_lib/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,10 @@ list:
.uid – int, runAsUser/runAsGroup (default 64535)
.runAsNonRoot – bool, run as Deckhouse user when true, root when false (default true)
.seccompProfile – bool, disable seccompProfile when false (default true)
.appArmorProfile – string, appArmorProfile.type, set to empty string to disable (default RuntimeDefault)
.appArmorProfileLocalhost – string, appArmorProfile.localhostProfile, used only when appArmorProfile is "Localhost" (default empty)

#### Usage

`include "helm_lib_application_container_security_context_pss_restricted_flexible" (dict "ro" false "caps" (list "NET_ADMIN" "SYS_TIME") "uid" 1001 "seccompProfile" false "runAsNonRoot" true "appArmorProfile" "Localhost" "appArmorProfileLocalhost" "k8s-apparmor-example-deny-write") `
`include "helm_lib_application_container_security_context_pss_restricted_flexible" (dict "ro" false "caps" (list "NET_ADMIN" "SYS_TIME") "uid" 1001 "seccompProfile" false "runAsNonRoot" true) `



Expand Down Expand Up @@ -1251,12 +1249,10 @@ list:
.uid – int, runAsUser/runAsGroup (default 64535)
.runAsNonRoot – bool, run as Deckhouse user when true, root when false (default true)
.seccompProfile – bool, disable seccompProfile when false (default true)
.appArmorProfile – string, appArmorProfile.type, set to empty string to disable (default RuntimeDefault)
.appArmorProfileLocalhost – string, appArmorProfile.localhostProfile, used only when appArmorProfile is "Localhost" (default empty)

#### Usage

`include "helm_lib_module_container_security_context_pss_restricted_flexible" (dict "ro" false "caps" (list "NET_ADMIN" "SYS_TIME") "uid" 1001 "seccompProfile" false "runAsNonRoot" true "appArmorProfile" "Localhost" "appArmorProfileLocalhost" "k8s-apparmor-example-deny-write") `
`include "helm_lib_module_container_security_context_pss_restricted_flexible" (dict "ro" false "caps" (list "NET_ADMIN" "SYS_TIME") "uid" 1001 "seccompProfile" false "runAsNonRoot" true) `



Expand Down
19 changes: 1 addition & 18 deletions charts/helm_lib/templates/_application_security_context.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ securityContext:
{{- /* .uid – int, runAsUser/runAsGroup (default 64535) */ -}}
{{- /* .runAsNonRoot – bool, run as Deckhouse user when true, root when false (default true) */ -}}
{{- /* .seccompProfile – bool, disable seccompProfile when false (default true) */ -}}
{{- /* .appArmorProfile – string, appArmorProfile.type, set to empty string to disable (default RuntimeDefault) */ -}}
{{- /* .appArmorProfileLocalhost – string, appArmorProfile.localhostProfile, used only when appArmorProfile is "Localhost" (default empty) */ -}}
{{- /* Usage: include "helm_lib_application_container_security_context_pss_restricted_flexible" (dict "ro" false "caps" (list "NET_ADMIN" "SYS_TIME") "uid" 1001 "seccompProfile" false "runAsNonRoot" true "appArmorProfile" "Localhost" "appArmorProfileLocalhost" "k8s-apparmor-example-deny-write") */ -}}
{{- /* Usage: include "helm_lib_application_container_security_context_pss_restricted_flexible" (dict "ro" false "caps" (list "NET_ADMIN" "SYS_TIME") "uid" 1001 "seccompProfile" false "runAsNonRoot" true) */ -}}
{{- define "helm_lib_application_container_security_context_pss_restricted_flexible" -}}
{{- $ro := true -}}
{{- if hasKey . "ro" -}}
Expand All @@ -88,14 +86,6 @@ securityContext:
{{- if hasKey . "seccompProfile" -}}
{{- $seccompProfile = .seccompProfile -}}
{{- end -}}
{{- $appArmorProfile := "RuntimeDefault" -}}
{{- if hasKey . "appArmorProfile" -}}
{{- $appArmorProfile = .appArmorProfile -}}
{{- end -}}
{{- $appArmorProfileLocalhost := "" -}}
{{- if hasKey . "appArmorProfileLocalhost" -}}
{{- $appArmorProfileLocalhost = .appArmorProfileLocalhost -}}
{{- end -}}
{{- $caps := default (list) .caps -}}
{{- $uid := default 64535 .uid -}}
{{- $runAsNonRoot := true -}}
Expand All @@ -122,13 +112,6 @@ securityContext:
seccompProfile:
type: RuntimeDefault
{{- end }}
{{- if $appArmorProfile }}
appArmorProfile:
type: {{ $appArmorProfile }}
{{- if and (eq $appArmorProfile "Localhost") $appArmorProfileLocalhost }}
localhostProfile: {{ $appArmorProfileLocalhost }}
{{- end }}
{{- end }}
{{- end }}


Expand Down
19 changes: 1 addition & 18 deletions charts/helm_lib/templates/_module_security_context.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,7 @@ securityContext:
{{- /* .uid – int, runAsUser/runAsGroup (default 64535) */ -}}
{{- /* .runAsNonRoot – bool, run as Deckhouse user when true, root when false (default true) */ -}}
{{- /* .seccompProfile – bool, disable seccompProfile when false (default true) */ -}}
{{- /* .appArmorProfile – string, appArmorProfile.type, set to empty string to disable (default RuntimeDefault) */ -}}
{{- /* .appArmorProfileLocalhost – string, appArmorProfile.localhostProfile, used only when appArmorProfile is "Localhost" (default empty) */ -}}
{{- /* Usage: include "helm_lib_module_container_security_context_pss_restricted_flexible" (dict "ro" false "caps" (list "NET_ADMIN" "SYS_TIME") "uid" 1001 "seccompProfile" false "runAsNonRoot" true "appArmorProfile" "Localhost" "appArmorProfileLocalhost" "k8s-apparmor-example-deny-write") */ -}}
{{- /* Usage: include "helm_lib_module_container_security_context_pss_restricted_flexible" (dict "ro" false "caps" (list "NET_ADMIN" "SYS_TIME") "uid" 1001 "seccompProfile" false "runAsNonRoot" true) */ -}}
{{- define "helm_lib_module_container_security_context_pss_restricted_flexible" -}}
{{- $ro := true -}}
{{- if hasKey . "ro" -}}
Expand All @@ -88,14 +86,6 @@ securityContext:
{{- if hasKey . "seccompProfile" -}}
{{- $seccompProfile = .seccompProfile -}}
{{- end -}}
{{- $appArmorProfile := "RuntimeDefault" -}}
{{- if hasKey . "appArmorProfile" -}}
{{- $appArmorProfile = .appArmorProfile -}}
{{- end -}}
{{- $appArmorProfileLocalhost := "" -}}
{{- if hasKey . "appArmorProfileLocalhost" -}}
{{- $appArmorProfileLocalhost = .appArmorProfileLocalhost -}}
{{- end -}}
{{- $caps := default (list) .caps -}}
{{- $uid := default 64535 .uid -}}
{{- $runAsNonRoot := true -}}
Expand All @@ -122,13 +112,6 @@ securityContext:
seccompProfile:
type: RuntimeDefault
{{- end }}
{{- if $appArmorProfile }}
appArmorProfile:
type: {{ $appArmorProfile }}
{{- if and (eq $appArmorProfile "Localhost") $appArmorProfileLocalhost }}
localhostProfile: {{ $appArmorProfileLocalhost }}
{{- end }}
{{- end }}
{{- end }}


Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ tests:
securityContext:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
appArmorProfile:
type: RuntimeDefault
capabilities:
drop:
- ALL
runAsUser: 64535
runAsGroup: 64535
runAsGroup: 64535
privileged: false
runAsNonRoot: true

Expand All @@ -45,8 +43,6 @@ tests:
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
appArmorProfile:
type: RuntimeDefault

- it: read_only_root_filesystem default options
asserts:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
suite: helm_lib_module_container_security_context_pss_restricted_flexible
templates:
- helm_lib_module_container_security_context_pss_restricted_flexible.yaml
- helm_lib_module_container_security_context_pss_restricted_flexible_seccomp_disabled.yaml
- helm_lib_module_container_security_context_pss_restricted_flexible_apparmor_custom.yaml
- helm_lib_module_container_security_context_pss_restricted_flexible_apparmor_disabled.yaml
tests:
- it: default options
template: helm_lib_module_container_security_context_pss_restricted_flexible.yaml
asserts:
- equal:
path: securityContext
Expand All @@ -22,35 +18,3 @@ tests:
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
appArmorProfile:
type: RuntimeDefault
- it: seccompProfile disabled still has appArmorProfile
template: helm_lib_module_container_security_context_pss_restricted_flexible_seccomp_disabled.yaml
asserts:
- equal:
path: securityContext
value:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
runAsUser: 64535
runAsGroup: 64535
privileged: false
runAsNonRoot: true
appArmorProfile:
type: RuntimeDefault
- it: custom appArmorProfile value
template: helm_lib_module_container_security_context_pss_restricted_flexible_apparmor_custom.yaml
asserts:
- equal:
path: securityContext.appArmorProfile
value:
type: Localhost
localhostProfile: k8s-apparmor-example-deny-write
- it: disable appArmorProfile with empty string
template: helm_lib_module_container_security_context_pss_restricted_flexible_apparmor_disabled.yaml
asserts:
- notExists:
path: securityContext.appArmorProfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
suite: helm_lib_module_container_security_context_pss_restricted_flexible
templates:
- helm_lib_module_container_security_context_pss_restricted_flexible_seccomp_disabled.yaml
tests:
- it: seccompProfile disabled
asserts:
- equal:
path: securityContext
value:
readOnlyRootFilesystem: true
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
runAsUser: 64535
runAsGroup: 64535
runAsNonRoot: true
2 changes: 0 additions & 2 deletions tests/tests/helm_lib_module_init_container_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,6 @@ tests:
ephemeral-storage: 50Mi
securityContext:
allowPrivilegeEscalation: false
appArmorProfile:
type: RuntimeDefault
capabilities:
drop:
- ALL
Expand Down
Loading