Skip to content

Commit 9adb701

Browse files
committed
fixed based on cr
1 parent 8c9cfb3 commit 9adb701

File tree

3 files changed

+66
-7
lines changed

3 files changed

+66
-7
lines changed

wiz-outpost-lite/templates/_helpers.tpl

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,23 @@ wiz.io/runner: {{ .runner | quote }}
6666
{{- $runner = $runner | kebabcase }}
6767
{{- $runnerID := get $values "runnerID" | default $runner }}
6868

69+
{{/* Get module type based on runner name - using a variable since we can't define a template inside another template */}}
70+
{{- $moduleType := "" }}
71+
{{- if hasPrefix "remediation-" $runner -}}
72+
{{- $moduleType = "remediation" }}
73+
{{- else if eq $runner "container-registry" -}}
74+
{{- $moduleType = "container-registry" }}
75+
{{- else if hasPrefix "vcs-" $runner -}}
76+
{{- $moduleType = "vcs" }}
77+
{{- else -}}
78+
{{- fail (printf "Invalid runner name: %s. Runner name must start with 'remediation-', 'vcs-', or be 'container-registry'" $runner) -}}
79+
{{- end }}
80+
6981
{{/* e.g. remediation-aws-rds-003 -> outpost-lite-runner-remediation
7082
container-registry -> outpost-lite-runner-container-registry
7183
*/}}
7284
{{- $imageName := "" }}
73-
{{- if hasPrefix "remediation" $runner }}
85+
{{- if eq $moduleType "remediation" }}
7486
{{- $imageName = "outpost-lite-runner-remediation" }}
7587
{{- else }}
7688
{{- $imageName = dig "image" "name" (printf "outpost-lite-runner-%s" $runner) $values }}
@@ -79,6 +91,9 @@ container-registry -> outpost-lite-runner-container-registry
7991
{{- $values = deepCopy $values }}
8092
{{- $values = merge $values (dict "image" (dict "name" $imageName)) }}
8193
94+
{{/* Unify with module specific values */}}
95+
{{- $values = merge $values (index $.Values.modules $moduleType) }}
96+
8297
{{/* Unify with global .Values to be used inside a "with" statement */}}
8398
{{- $values = dict "runner" $runner "runnerID" $runnerID "Values" (merge $values (omit $.Values "runners")) -}}
8499
{{- $runnerValues = set $runnerValues $runner $values }}

wiz-outpost-lite/templates/deployment.yaml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ spec:
2828
{{- if .Values.serviceAccount.create }}
2929
serviceAccountName: sa-{{ .runner }}
3030
{{- end }}
31+
{{- if or (hasKey .Values "podSecurityContext") (hasKey .Values "podSecurityContextOverride") }}
32+
securityContext:
33+
{{- if hasKey .Values "podSecurityContextOverride"}}
34+
{{- toYaml .Values.podSecurityContextOverride | nindent 8 }}
35+
{{- else }}
36+
{{- toYaml .Values.podSecurityContext | nindent 8 }}
37+
{{- end }}
38+
{{- end }}
3139
restartPolicy: Always
3240
{{- if .Values.affinity }}
3341
affinity:
@@ -142,12 +150,14 @@ spec:
142150
{{- end }}
143151
resources:
144152
{{- toYaml .Values.resources | nindent 12 }}
153+
{{- if or (hasKey .Values "containerSecurityContext") (hasKey .Values "containerSecurityContextOverride") }}
145154
securityContext:
146-
capabilities:
147-
add:
148-
- SYS_ADMIN
149-
seLinuxOptions:
150-
type: spc_t
155+
{{- if hasKey .Values "containerSecurityContextOverride"}}
156+
{{- toYaml .Values.containerSecurityContextOverride | nindent 12 }}
157+
{{- else }}
158+
{{- toYaml .Values.containerSecurityContext | nindent 12 }}
159+
{{- end }}
160+
{{- end}}
151161
volumeMounts:
152162
- mountPath: /var/wiz
153163
name: working-dir

wiz-outpost-lite/values.yaml

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,41 @@ httpProxyConfiguration:
7272
terminationGracePeriodSeconds: 30
7373

7474
serviceAccount:
75-
create: false
75+
create: false
76+
77+
modules:
78+
vcs:
79+
containerSecurityContext:
80+
capabilities:
81+
add:
82+
- SYS_ADMIN
83+
seLinuxOptions:
84+
type: spc_t
85+
container-registry:
86+
containerSecurityContext:
87+
capabilities:
88+
add:
89+
- SYS_ADMIN
90+
seLinuxOptions:
91+
type: spc_t
92+
remediation:
93+
podSecurityContext:
94+
runAsNonRoot: true
95+
runAsUser: 1000
96+
runAsGroup: 1000
97+
fsGroup: 1000
98+
containerSecurityContext:
99+
capabilities:
100+
drop:
101+
- ALL
102+
runAsNonRoot: true
103+
runAsUser: 1000
104+
runAsGroup: 1000
105+
allowPrivilegeEscalation: false
106+
privileged: false
107+
readOnlyRootFilesystem: true
108+
seLinuxOptions:
109+
type: container_t
76110

77111
runners:
78112
container-registry:

0 commit comments

Comments
 (0)