From aeda85c642dbde56d5061d05b83376517bdbdd66 Mon Sep 17 00:00:00 2001 From: Rahul Khiyani Date: Mon, 18 Mar 2019 15:52:54 -0400 Subject: [PATCH] prometheus-alertmanager: Add container security context This adds the container security context to set readOnlyRootFilesystem to true Change-Id: Ic8d33ae817ace49bf5ead40b2b41c6002217aa5e --- prometheus-alertmanager/templates/statefulset.yaml | 5 +---- prometheus-alertmanager/values.yaml | 9 +++++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/prometheus-alertmanager/templates/statefulset.yaml b/prometheus-alertmanager/templates/statefulset.yaml index b12ecf89c..248f0a22c 100644 --- a/prometheus-alertmanager/templates/statefulset.yaml +++ b/prometheus-alertmanager/templates/statefulset.yaml @@ -47,8 +47,6 @@ spec: configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} {{ dict "envAll" $envAll "podName" "alertmanager" "containerNames" (list "alertmanager") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }} spec: - securityContext: - readOnlyRootFilesystem: true {{ dict "envAll" $envAll "application" "alertmanager" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} serviceAccountName: {{ $serviceAccountName }} affinity: @@ -75,8 +73,7 @@ spec: - name: alertmanager {{ tuple $envAll "alertmanager" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.alertmanager | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} - securityContext: - allowPrivilegeEscalation: false +{{ dict "envAll" $envAll "application" "alertmanager" "container" "alertmanager" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} command: - /tmp/alertmanager.sh - start diff --git a/prometheus-alertmanager/values.yaml b/prometheus-alertmanager/values.yaml index 8528f712f..bd866f1c1 100644 --- a/prometheus-alertmanager/values.yaml +++ b/prometheus-alertmanager/values.yaml @@ -42,9 +42,14 @@ pod: type: apparmor alertmanager: alertmanager: localhost/docker-default - user: + security_context: alertmanager: - uid: 65534 + pod: + runAsUser: 65534 + container: + alertmanager: + allowPrivilegeEscalation: false + readOnlyRootFilesystem: true affinity: anti: type: