Skip to content

Commit 1adab15

Browse files
committed
add security context to container spec
1 parent 9130003 commit 1adab15

File tree

10 files changed

+137
-5
lines changed

10 files changed

+137
-5
lines changed

charts/ingest/templates/deployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ spec:
4040
- name: {{ .Chart.Name }}
4141
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
4242
imagePullPolicy: {{ .Values.image.pullPolicy }}
43+
{{- if .Values.containerSecurityContext }}
44+
securityContext:
45+
{{- toYaml .Values.containerSecurityContext | nindent 12 }}
46+
{{- end }}
4347
command: ["/cmd"]
4448
args: ["ingest", "--interval", "60"]
4549
ports:

charts/ingest/values.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# Default values for convoy ingest.
22
# This is a YAML-formatted file.
33
# Declare variables to be passed into your templates.
4+
global:
5+
externalDatabase:
6+
enabled: false
7+
8+
nativeRedis:
9+
enabled: false
10+
11+
externalRedis:
12+
enabled: false
413

514
enabled: true
615
app:
@@ -57,3 +66,16 @@ podDisruptionBudget: {}
5766
nodeSelector: {}
5867
tolerations: []
5968
affinity: {}
69+
70+
# containerSecurityContext holds container level security attributes.
71+
containerSecurityContext:
72+
runAsNonRoot: true
73+
runAsUser: 1000
74+
allowPrivilegeEscalation: false
75+
privileged: false
76+
readOnlyRootFilesystem: true
77+
seccompProfile:
78+
type: RuntimeDefault
79+
capabilities:
80+
drop:
81+
- ALL

charts/migrate/templates/job.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ kind: Job
33
metadata:
44
name: {{ include "convoy-migrate.fullname" . }}
55
annotations:
6-
{{- toYaml .Values.jobAnnotations | nindent 4 }}
6+
{{- if .Values.jobAnnotations }}
7+
annotations:
8+
{{- toYaml .Values.jobAnnotations | nindent 4 }}
9+
{{- end }}
710
"helm.sh/hook": post-install,post-upgrade
811
"helm.sh/hook-weight": "0"
912
"helm.sh/hook-delete-policy": before-hook-creation
@@ -21,6 +24,10 @@ spec:
2124
- name: {{ .Chart.Name }}
2225
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
2326
imagePullPolicy: "{{ .Values.image.pullPolicy }}"
27+
{{- if .Values.containerSecurityContext }}
28+
securityContext:
29+
{{- toYaml .Values.containerSecurityContext | nindent 12 }}
30+
{{- end }}
2431
command: ["/cmd"]
2532
args: ["migrate", "up"]
2633
env:

charts/migrate/values.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# Default values for convoy-migrate.
22
# This is a YAML-formatted file.
33
# Declare variables to be passed into your templates.
4+
global:
5+
externalDatabase:
6+
enabled: false
7+
8+
nativeRedis:
9+
enabled: false
10+
11+
externalRedis:
12+
enabled: false
413

514
app:
615
replicaCount: 1
@@ -29,3 +38,16 @@ tolerations: []
2938
affinity: {}
3039

3140
jobAnnotations: {}
41+
42+
# containerSecurityContext holds container level security attributes.
43+
containerSecurityContext:
44+
runAsNonRoot: true
45+
runAsUser: 1000
46+
allowPrivilegeEscalation: false
47+
privileged: false
48+
readOnlyRootFilesystem: true
49+
seccompProfile:
50+
type: RuntimeDefault
51+
capabilities:
52+
drop:
53+
- ALL

charts/server/templates/deployment.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ spec:
4040
- name: {{ .Chart.Name }}
4141
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
4242
imagePullPolicy: {{ .Values.image.pullPolicy }}
43-
43+
{{- if .Values.containerSecurityContext }}
44+
securityContext:
45+
{{- toYaml .Values.containerSecurityContext | nindent 12 }}
46+
{{- end }}
4447
command: ["/cmd"]
4548
args: ["server"]
4649
ports:

charts/server/values.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
# This is a YAML-formatted file.
33
# Declare variables to be passed into your templates.
44

5+
global:
6+
externalDatabase:
7+
enabled: false
8+
9+
nativeRedis:
10+
enabled: false
11+
12+
externalRedis:
13+
enabled: false
14+
515
app:
616
replicaCount: 1
717
port: 5005
@@ -90,3 +100,16 @@ podDisruptionBudget: {}
90100
nodeSelector: {}
91101
tolerations: []
92102
affinity: {}
103+
104+
# containerSecurityContext holds container level security attributes.
105+
containerSecurityContext:
106+
runAsNonRoot: true
107+
runAsUser: 1000
108+
allowPrivilegeEscalation: false
109+
privileged: false
110+
readOnlyRootFilesystem: true
111+
seccompProfile:
112+
type: RuntimeDefault
113+
capabilities:
114+
drop:
115+
- ALL

charts/stream/templates/deployment.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ spec:
4141
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
4242
imagePullPolicy: {{ .Values.image.pullPolicy }}
4343
command: ["/cmd"]
44+
{{- if .Values.containerSecurityContext }}
45+
securityContext:
46+
{{- toYaml .Values.containerSecurityContext | nindent 12 }}
47+
{{- end }}
4448
args: ["stream"]
4549
ports:
4650
- name: http

charts/stream/values.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
# This is a YAML-formatted file.
33
# Declare variables to be passed into your templates.
44

5+
global:
6+
externalDatabase:
7+
enabled: false
8+
9+
nativeRedis:
10+
enabled: false
11+
12+
externalRedis:
13+
enabled: false
14+
515
enabled: true
616
app:
717
replicaCount: 1
@@ -58,3 +68,16 @@ ingress:
5868
nodeSelector: {}
5969
tolerations: []
6070
affinity: {}
71+
72+
# containerSecurityContext holds container level security attributes.
73+
containerSecurityContext:
74+
runAsNonRoot: true
75+
runAsUser: 1000
76+
allowPrivilegeEscalation: false
77+
privileged: false
78+
readOnlyRootFilesystem: true
79+
seccompProfile:
80+
type: RuntimeDefault
81+
capabilities:
82+
drop:
83+
- ALL

charts/worker/templates/deployment.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,15 @@ spec:
4141
imagePullPolicy: {{ .Values.image.pullPolicy }}
4242
command: ["/cmd"]
4343
args: ["worker"]
44+
{{- if .Values.containerSecurityContext }}
45+
securityContext:
46+
{{- toYaml .Values.containerSecurityContext | nindent 12 }}
47+
{{- end }}
4448
ports:
4549
- name: http
4650
containerPort: {{ .Values.app.port }}
4751
protocol: TCP
4852
env:
49-
5053
- name: SERVICE_NAME
5154
value: {{ .Chart.Name }}
5255
- name: PORT
@@ -59,8 +62,6 @@ spec:
5962
value: {{ .Values.env.environment | quote }}
6063
- name: CONVOY_SIGNUP_ENABLED
6164
value: {{ .Values.env.sign_up_enabled | quote }}
62-
63-
6465
{{- if .Values.global.externalDatabase.enabled }}
6566
- name: CONVOY_DB_SCHEME
6667
value: {{ .Values.global.externalDatabase.scheme | quote }}

charts/worker/values.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22
# This is a YAML-formatted file.
33
# Declare variables to be passed into your templates.
44

5+
global:
6+
externalDatabase:
7+
enabled: false
8+
9+
nativeRedis:
10+
enabled: false
11+
12+
externalRedis:
13+
enabled: false
14+
515
app:
616
replicaCount: 1
717
port: 5006
@@ -77,3 +87,16 @@ podDisruptionBudget: {}
7787
nodeSelector: {}
7888
tolerations: []
7989
affinity: {}
90+
91+
# containerSecurityContext holds container level security attributes.
92+
containerSecurityContext:
93+
runAsNonRoot: true
94+
runAsUser: 1000
95+
allowPrivilegeEscalation: false
96+
privileged: false
97+
readOnlyRootFilesystem: true
98+
seccompProfile:
99+
type: RuntimeDefault
100+
capabilities:
101+
drop:
102+
- ALL

0 commit comments

Comments
 (0)