Skip to content

Commit e68e524

Browse files
Merge pull request #1538 from snyk/fix/pod-security-context-indentation
fix: correct pod security context block indentation
2 parents 12d4b46 + 96c1d40 commit e68e524

File tree

4 files changed

+29
-13
lines changed

4 files changed

+29
-13
lines changed

.snyk

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,10 @@ ignore:
1414
Waiting for a patch: https://security.snyk.io/vuln/SNYK-JS-MICROMATCH-6838728
1515
expires: 2024-12-19T12:00:00.000Z
1616
created: 2024-05-16T12:00:00.000Z
17+
SNYK-JS-JSONPATHPLUS-7945884:
18+
- '*':
19+
reason: >-
20+
Waiting for transient dependency to update
21+
expires: 2024-12-19T12:00:00.000Z
22+
created: 2024-10-23T12:00:00.000Z
1723
patch: {}

snyk-monitor/templates/deployment.yaml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -33,19 +33,19 @@ spec:
3333
{{- toYaml . | nindent 8 }}
3434
{{- end }}
3535
spec:
36-
{{- with .Values.podSecurityContext }}
37-
securityContext:
38-
{{- $fsGroupOverride := dict }}
39-
{{- if hasKey $.Values.securityContext "fsGroup" }}
40-
{{- $fsGroupOverride = dict "fsGroup" (int $.Values.securityContext.fsGroup) }}
41-
{{- end }}
42-
{{- merge $fsGroupOverride . | toYaml | nindent 8 }}
43-
{{- else }}
44-
{{- if .Values.securityContext.fsGroup }}
45-
securityContext:
46-
fsGroup: {{ int .Values.securityContext.fsGroup }}
47-
{{- end }}
48-
{{- end }}
36+
{{- with .Values.podSecurityContext }}
37+
securityContext:
38+
{{- $fsGroupOverride := dict }}
39+
{{- if hasKey $.Values.securityContext "fsGroup" }}
40+
{{- $fsGroupOverride = dict "fsGroup" (int $.Values.securityContext.fsGroup) }}
41+
{{- end }}
42+
{{- merge $fsGroupOverride . | toYaml | nindent 8 }}
43+
{{- else }}
44+
{{- if .Values.securityContext.fsGroup }}
45+
securityContext:
46+
fsGroup: {{ int .Values.securityContext.fsGroup }}
47+
{{- end }}
48+
{{- end }}
4949
affinity:
5050
nodeAffinity:
5151
requiredDuringSchedulingIgnoredDuringExecution:

test/integration/kubernetes.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -776,6 +776,15 @@ test('snyk-monitor secure configuration is as expected', async () => {
776776
namespace,
777777
);
778778
const deployment = response.body;
779+
expect(deployment.spec?.template.spec).toEqual(
780+
expect.objectContaining({
781+
securityContext: {
782+
fsGroup: 65534,
783+
fsGroupChangePolicy: 'Always',
784+
},
785+
}),
786+
);
787+
779788
expect(deployment.spec?.template?.spec?.containers?.[0]).toEqual(
780789
expect.objectContaining({
781790
securityContext: {

test/setup/deployers/helm.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ async function deployKubernetesMonitor(
3939
'--set rbac.serviceAccount.annotations."foo"="bar" ' +
4040
'--set volumes.projected.serviceAccountToken=true ' +
4141
'--set securityContext.fsGroup=65534 ' +
42+
'--set podSecurityContext.fsGroupChangePolicy="Always" ' +
4243
'--set skopeo.compression.level=1 ' +
4344
'--set workers.count=5 ' +
4445
'--set sysdig.enabled=true ',

0 commit comments

Comments
 (0)