Skip to content

Commit cb6fa8b

Browse files
daniil-nedostupMykolaMarusenko
authored andcommitted
chore: Allow overriding securityContext fields (#212)
1 parent 2df1b40 commit cb6fa8b

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

deploy-templates/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ A Helm chart for KubeRocketCI Codebase Operator
3939
| jira.rootUrl | string | `"https://jiraeu.example.com"` | URL to Jira server |
4040
| name | string | `"codebase-operator"` | component name |
4141
| nodeSelector | object | `{}` | |
42+
| podSecurityContext | object | `{"runAsNonRoot":true}` | Pod Security Context Ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ |
4243
| resources.limits.memory | string | `"192Mi"` | |
4344
| resources.requests.cpu | string | `"50m"` | |
4445
| resources.requests.memory | string | `"64Mi"` | |
46+
| securityContext | object | `{"allowPrivilegeEscalation":false}` | Container Security Context Ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ |
4547
| telemetryEnabled | bool | `true` | Flag to enable/disable telemetry |
4648
| tolerations | list | `[]` | |
4749

deploy-templates/templates/deployment.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ spec:
1919
name: {{ .Values.name }}
2020
spec:
2121
serviceAccountName: edp-{{ .Values.name }}
22-
securityContext:
23-
runAsNonRoot: true
22+
{{- if .Values.podSecurityContext }}
23+
securityContext: {{ toYaml .Values.podSecurityContext | nindent 8 }}
24+
{{- end }}
2425
{{- if .Values.imagePullSecrets }}
2526
imagePullSecrets: {{ toYaml .Values.imagePullSecrets | nindent 8 }}
2627
{{- end }}
@@ -36,8 +37,9 @@ spec:
3637
name: cert
3738
readOnly: true
3839
imagePullPolicy: "{{ .Values.imagePullPolicy }}"
39-
securityContext:
40-
allowPrivilegeEscalation: false
40+
{{- if .Values.securityContext }}
41+
securityContext: {{ toYaml .Values.securityContext | nindent 12 }}
42+
{{- end }}
4143
env:
4244
- name: WATCH_NAMESPACE
4345
valueFrom:

deploy-templates/values.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@ resources:
3333
cpu: 50m
3434
memory: 64Mi
3535

36+
# -- Pod Security Context
37+
# Ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
38+
podSecurityContext:
39+
runAsNonRoot: true
40+
41+
# -- Container Security Context
42+
# Ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
43+
securityContext:
44+
allowPrivilegeEscalation: false
45+
3646
jira:
3747
# -- Flag to enable/disable Jira integration
3848
integration: false

0 commit comments

Comments
 (0)