Skip to content

Commit e5eefd1

Browse files
daniil-nedostupMykolaMarusenko
authored andcommitted
chore: Allow overriding securityContext (#88)
1 parent 6a9c25a commit e5eefd1

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
@@ -65,9 +65,11 @@ A Helm chart for KubeRocketCI Gerrit Operator
6565
| imagePullSecrets | list | `[]` | Optional array of imagePullSecrets containing private registry credentials # Ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry |
6666
| name | string | `"gerrit-operator"` | component name |
6767
| nodeSelector | object | `{}` | |
68+
| podSecurityContext | object | `{"runAsNonRoot":true}` | Pod Security Context Ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ |
6869
| projectSyncInterval | string | `"1h"` | Format: golang time.Duration-formatted string |
6970
| resources.limits.memory | string | `"192Mi"` | |
7071
| resources.requests.cpu | string | `"50m"` | |
7172
| resources.requests.memory | string | `"64Mi"` | |
73+
| securityContext | object | `{"allowPrivilegeEscalation":false}` | Container Security Context Ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/ |
7274
| tolerations | list | `[]` | |
7375

deploy-templates/templates/operator_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 }}
@@ -31,8 +32,9 @@ spec:
3132
imagePullPolicy: "{{ .Values.imagePullPolicy }}"
3233
command:
3334
- {{ .Values.name }}
34-
securityContext:
35-
allowPrivilegeEscalation: false
35+
{{- if .Values.securityContext }}
36+
securityContext: {{ toYaml .Values.securityContext | nindent 12 }}
37+
{{- end }}
3638
env:
3739
- name: WATCH_NAMESPACE
3840
valueFrom:

deploy-templates/values.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,16 @@ resources:
5050
cpu: 50m
5151
memory: 64Mi
5252

53+
# -- Pod Security Context
54+
# Ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
55+
podSecurityContext:
56+
runAsNonRoot: true
57+
58+
# -- Container Security Context
59+
# Ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
60+
securityContext:
61+
allowPrivilegeEscalation: false
62+
5363
gerrit:
5464
# -- Flag to enable/disable Gerrit deploy
5565
deploy: true

0 commit comments

Comments
 (0)