Skip to content

Commit db4f43f

Browse files
authoredJun 6, 2024··
fix(security): 🐛 🔒️ mount service account token on pod level
1 parent f8f2da2 commit db4f43f

File tree

4 files changed

+22
-17
lines changed

4 files changed

+22
-17
lines changed
 

‎traefik/templates/_podtemplate.tpl

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
{{- toYaml . | nindent 8 }}
2323
{{- end }}
2424
serviceAccountName: {{ include "traefik.serviceAccountName" . }}
25+
automountServiceAccountToken: true
2526
terminationGracePeriodSeconds: {{ default 60 .Values.deployment.terminationGracePeriodSeconds }}
2627
hostNetwork: {{ .Values.hostNetwork }}
2728
{{- with .Values.deployment.dnsPolicy }}

‎traefik/templates/rbac/serviceaccount.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ metadata:
1010
{{- with .Values.serviceAccountAnnotations }}
1111
{{- toYaml . | nindent 4 }}
1212
{{- end }}
13+
automountServiceAccountToken: false
1314
{{- end -}}

‎traefik/tests/deployment-config_test.yaml

+16-17
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,26 @@ suite: Deployment configuration
22
templates:
33
- deployment.yaml
44
tests:
5-
- it: should have 1 replica by default
5+
- it: should provide expected defaults
66
asserts:
77
- equal:
88
path: spec.replicas
99
value: 1
10+
- equal:
11+
path: spec.template.spec.automountServiceAccountToken
12+
value: true
13+
- equal:
14+
path: spec.strategy.type
15+
value: RollingUpdate
16+
- equal:
17+
path: spec.strategy.rollingUpdate.maxUnavailable
18+
value: 0
19+
- equal:
20+
path: spec.strategy.rollingUpdate.maxSurge
21+
value: 1
22+
- equal:
23+
path: metadata.namespace
24+
value: NAMESPACE
1025
- it: should have the specified amount of replicas when specified via values
1126
set:
1227
deployment:
@@ -23,17 +38,6 @@ tests:
2338
- equal:
2439
path: spec.revisionHistoryLimit
2540
value: 1
26-
- it: should have a rollingUpdate strategy with default values
27-
asserts:
28-
- equal:
29-
path: spec.strategy.type
30-
value: RollingUpdate
31-
- equal:
32-
path: spec.strategy.rollingUpdate.maxUnavailable
33-
value: 0
34-
- equal:
35-
path: spec.strategy.rollingUpdate.maxSurge
36-
value: 1
3741
- it: should have a custom merged rollingUpdate strategy with specified values
3842
set:
3943
updateStrategy:
@@ -160,11 +164,6 @@ tests:
160164
- equal:
161165
path: spec.strategy.type
162166
value: OnDelete
163-
- it: should use helm managed namespace as default behavior
164-
asserts:
165-
- equal:
166-
path: metadata.namespace
167-
value: NAMESPACE
168167
- it: should accept overridden namespace
169168
set:
170169
namespaceOverride: "traefik-ns-override"

‎traefik/tests/rbac-config_test.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ tests:
2828
path: metadata.name
2929
value: RELEASE-NAME-traefik
3030
template: rbac/serviceaccount.yaml
31+
- equal:
32+
path: automountServiceAccountToken
33+
value: false
34+
template: rbac/serviceaccount.yaml
3135
- equal:
3236
path: spec.template.spec.serviceAccountName
3337
value: RELEASE-NAME-traefik

0 commit comments

Comments
 (0)
Please sign in to comment.