Skip to content

Commit 49a268d

Browse files
authored
Merge pull request #872 from snyk/feat/service-account-token
fix: allow configuring fsGroup and projected volumes for AWS EKS
2 parents c19f074 + 11904ef commit 49a268d

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

snyk-monitor/templates/deployment.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ spec:
2727
{{- toYaml . | nindent 8 }}
2828
{{- end }}
2929
spec:
30+
{{- with .Values.securityContext.fsGroup }}
31+
securityContext:
32+
fsGroup: {{ int . }}
33+
{{- end }}
3034
affinity:
3135
nodeAffinity:
3236
requiredDuringSchedulingIgnoredDuringExecution:
@@ -172,6 +176,13 @@ spec:
172176
name: {{ .Values.defaultWorkloadPoliciesMap }}
173177
{{- end }}
174178
optional: true
179+
{{- if .Values.volumes.projected.serviceAccountToken }}
180+
- name: token-vol
181+
projected:
182+
sources:
183+
- serviceAccountToken:
184+
path: token
185+
{{- end }}
175186
- name: registries-conf
176187
configMap:
177188
name: {{ .Values.registriesConfConfigMap }}

snyk-monitor/values.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,18 @@ psp:
108108

109109
# Override the excluded namespaces
110110
excludedNamespaces:
111+
112+
# Allow specifying a fsGroup in the PodSpec securityContext:
113+
# spec:
114+
# template:
115+
# spec:
116+
# securityContext:
117+
# fsGroup: <-- here
118+
securityContext:
119+
fsGroup:
120+
121+
# A projected volume maps several existing volume sources into the same directory.
122+
# https://kubernetes.io/docs/concepts/storage/volumes/#projected
123+
volumes:
124+
projected:
125+
serviceAccountToken: false

test/setup/deployers/helm.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ async function deployKubernetesMonitor(
3535
'--set pvc.enabled=true ' +
3636
'--set pvc.create=true ' +
3737
'--set log_level="INFO" ' +
38-
'--set rbac.serviceAccount.annotations."foo"="bar"',
38+
'--set rbac.serviceAccount.annotations."foo"="bar" ' +
39+
'--set volumes.projected.serviceAccountToken=true ' +
40+
'--set securityContext.fsGroup=65534 ',
3941
);
4042
console.log(
4143
`Deployed ${imageOptions.nameAndTag} with pull policy ${imageOptions.pullPolicy}`,

0 commit comments

Comments
 (0)