Skip to content

Commit

Permalink
Add security context to moon containers.
Browse files Browse the repository at this point in the history
  • Loading branch information
aandryashin committed Jul 23, 2024
1 parent adc72df commit 13f74a9
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
42 changes: 42 additions & 0 deletions moon2/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ spec:
{{- else -}}
{{- $def -}}
{{- end }}
{{- if .Values.deployment -}}
{{- with .Values.deployment.containerSecurityContext }}
securityContext:
{{ toYaml . | nindent 10 }}
{{- end }}
{{- end }}
ports:
- containerPort: 4545
volumeMounts:
Expand Down Expand Up @@ -165,6 +171,12 @@ spec:
{{- else -}}
{{- $def -}}
{{- end }}
{{- if .Values.deployment -}}
{{- with .Values.deployment.containerSecurityContext }}
securityContext:
{{ toYaml . | nindent 10 }}
{{- end }}
{{- end }}
ports:
- containerPort: 4444
- name: moon-conf
Expand Down Expand Up @@ -202,6 +214,12 @@ spec:
{{- else -}}
{{- $def -}}
{{- end }}
{{- if .Values.deployment -}}
{{- with .Values.deployment.containerSecurityContext }}
securityContext:
{{ toYaml . | nindent 10 }}
{{- end }}
{{- end }}
{{- if $basicAuth }}
{{- if not (eq $basicAuth "kubernetes") }}
- name: moon-ui-basic-auth
Expand Down Expand Up @@ -244,6 +262,12 @@ spec:
{{- else -}}
{{- $def -}}
{{- end }}
{{- if .Values.deployment -}}
{{- with .Values.deployment.containerSecurityContext }}
securityContext:
{{ toYaml . | nindent 10 }}
{{- end }}
{{- end }}
ports:
- containerPort: 8181
volumeMounts:
Expand Down Expand Up @@ -294,6 +318,12 @@ spec:
{{- else -}}
{{- $def -}}
{{- end }}
{{- if .Values.deployment -}}
{{- with .Values.deployment.containerSecurityContext }}
securityContext:
{{ toYaml . | nindent 10 }}
{{- end }}
{{- end }}
ports:
- containerPort: 9191
volumeMounts:
Expand Down Expand Up @@ -339,6 +369,12 @@ spec:
{{- else -}}
{{- $def -}}
{{- end }}
{{- if .Values.deployment -}}
{{- with .Values.deployment.containerSecurityContext }}
securityContext:
{{ toYaml . | nindent 10 }}
{{- end }}
{{- end }}
ports:
- containerPort: 9090
{{- end }}
Expand Down Expand Up @@ -380,6 +416,12 @@ spec:
{{- else -}}
{{- $def -}}
{{- end }}
{{- if .Values.deployment -}}
{{- with .Values.deployment.containerSecurityContext }}
securityContext:
{{ toYaml . | nindent 10 }}
{{- end }}
{{- end }}
ports:
- containerPort: 8080
volumes:
Expand Down
15 changes: 15 additions & 0 deletions moon2/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,21 @@ deployment:
securityContext: {}
# runAsUser: 1000

##
## Security context for containers running in Moon pod.
##
containerSecurityContext: {}
# allowPrivilegeEscalation: false
# capabilities:
# drop:
# - ALL
# privileged: false
# runAsGroup: 1000
# runAsNonRoot: true
# runAsUser: 1000
# seccompProfile:
# type: RuntimeDefault

##
## Optional fields that specifies the maximum number of pods that can be created over the desired number of pods
## and that can be unavailable during the update. You can use both int and percent values.
Expand Down

0 comments on commit 13f74a9

Please sign in to comment.