From 95bb1252074443d8959e101864b6aa55ec606d37 Mon Sep 17 00:00:00 2001 From: RAHUL KHIYANI Date: Mon, 22 Apr 2019 11:31:39 -0500 Subject: [PATCH] prometheus-alertmanager: Fix security context This PS fixes the pod application name and also adds security context to initcontainer Change-Id: Ia7cd5057247b0a07f88406259d41601659688f1a --- prometheus-alertmanager/templates/statefulset.yaml | 7 +++---- prometheus-alertmanager/values.yaml | 5 ++++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/prometheus-alertmanager/templates/statefulset.yaml b/prometheus-alertmanager/templates/statefulset.yaml index c874edce1..8d69884c1 100644 --- a/prometheus-alertmanager/templates/statefulset.yaml +++ b/prometheus-alertmanager/templates/statefulset.yaml @@ -47,7 +47,7 @@ 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: -{{ dict "envAll" $envAll "application" "alertmanager" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} +{{ dict "envAll" $envAll "application" "server" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} serviceAccountName: {{ $serviceAccountName }} affinity: {{ tuple $envAll "alertmanager" "server" | include "helm-toolkit.snippets.kubernetes_pod_anti_affinity" | indent 8 }} @@ -59,8 +59,7 @@ spec: - name: alertmanager-perms {{ 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: - runAsUser: 0 +{{ dict "envAll" $envAll "application" "server" "container" "alertmanager_perms" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} command: - chown - -R @@ -75,7 +74,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 }} -{{ dict "envAll" $envAll "application" "alertmanager" "container" "alertmanager" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} +{{ dict "envAll" $envAll "application" "server" "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 bd866f1c1..b3527050e 100644 --- a/prometheus-alertmanager/values.yaml +++ b/prometheus-alertmanager/values.yaml @@ -43,10 +43,13 @@ pod: alertmanager: alertmanager: localhost/docker-default security_context: - alertmanager: + server: pod: runAsUser: 65534 container: + alertmanager_perms: + runAsUser: 0 + readOnlyRootFilesystem: true alertmanager: allowPrivilegeEscalation: false readOnlyRootFilesystem: true