Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add configurable container security #461

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ spec:
- name: init-mysql
image: "{{ .Values.initContainerImage.repository }}:{{ .Values.initContainerImage.tag }}"
imagePullPolicy: {{ .Values.initContainerImage.imagePullPolicy }}
{{- if .Values.mattermostApp.containerSecurityContext }}
securityContext:
{{- toYaml .Values.mattermostApp.containerSecurityContext | nindent 10 }}
{{- end }}
command: [
"sh",
"-c",
Expand Down Expand Up @@ -161,6 +165,10 @@ spec:
httpGet:
path: /api/v4/system/ping
port: {{ .Values.mattermostApp.service.internalPort }}
{{- if .Values.mattermostApp.containerSecurityContext }}
securityContext:
{{- toYaml .Values.mattermostApp.containerSecurityContext | nindent 10 }}
{{- end }}
volumeMounts:
{{- if .Values.global.existingLicenseSecret.name }}
- mountPath: /mattermost/{{.Values.global.existingLicenseSecret.key }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ spec:
"-c",
"until curl --max-time 5 http://{{ include "mattermost-enterprise-edition.fullname" . }}.{{ .Release.Namespace }}:{{ .Values.mattermostApp.service.internalPort }}/api/v4/system/ping ; do echo waiting for Mattermost App come up; sleep 5; done; echo init-mattermost-app finished"
]
{{- if .Values.mattermostApp.containerSecurityContext }}
securityContext:
{{- toYaml .Values.mattermostApp.containerSecurityContext | nindent 10 }}
{{- end }}
containers:
- name: {{ include "mattermost-enterprise-edition.name" . }}-jobserver
image: "{{ .Values.mattermostApp.image.repository }}:{{ .Values.mattermostApp.image.tag }}"
Expand All @@ -79,6 +83,10 @@ spec:
{{- with .Values.global.features.jobserver.extraEnv }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.mattermostApp.containerSecurityContext }}
securityContext:
{{- toYaml .Values.mattermostApp.containerSecurityContext | nindent 10 }}
{{- end }}
volumeMounts:
{{- if .Values.global.existingLicenseSecret.name }}
- mountPath: /mattermost/{{.Values.global.existingLicenseSecret.key }}
Expand Down
8 changes: 8 additions & 0 deletions charts/mattermost-enterprise-edition/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,14 @@ mattermostApp:
# runAsGroup: 2000
# runAsUser: 2000

## Container Security Context
## Ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
containerSecurityContext:
# runAsNonRoot: true
# allowPrivilegeEscalation: false
# capabilities:
# drop: ['ALL']

resources: {}
# limits:
# cpu: 100m
Expand Down
8 changes: 8 additions & 0 deletions charts/mattermost-team-edition/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ spec:
image: "{{ .Values.initContainerImage.repository }}:{{ .Values.initContainerImage.tag }}"
imagePullPolicy: {{ .Values.initContainerImage.imagePullPolicy }}
command: ["sh", "-c", "until curl --max-time 10 http://{{ .Release.Name }}-mysql:3306; do echo waiting for {{ .Release.Name }}-mysql; sleep 5; done;"]
{{- if .Values.containerSecurityContext }}
securityContext:
{{- toYaml .Values.containerSecurityContext | nindent 10 }}
{{- end }}
{{- end }}
{{- if .Values.extraInitContainers }}
{{- .Values.extraInitContainers | toYaml | nindent 6 }}
Expand Down Expand Up @@ -95,6 +99,10 @@ spec:
httpGet:
path: /api/v4/system/ping
port: http
{{- if .Values.containerSecurityContext }}
securityContext:
{{- toYaml .Values.containerSecurityContext | nindent 10 }}
{{- end }}
volumeMounts:
- mountPath: /mattermost/config
name: mattermost-config
Expand Down
8 changes: 8 additions & 0 deletions charts/mattermost-team-edition/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,14 @@ securityContext:
# runAsGroup: 2000
# runAsUser: 2000

## Container Security Context
## Ref: https://kubernetes.io/docs/tasks/configure-pod-container/security-context/
containerSecurityContext:
# runAsNonRoot: true
# allowPrivilegeEscalation: false
# capabilities:
# drop: ['ALL']

serviceAccount:
create: false
name:
Expand Down