From 98dbc6dfefea1f0b07885afd440aea586a546036 Mon Sep 17 00:00:00 2001 From: "KHIYANI, RAHUL (rk0850)" Date: Mon, 24 Aug 2020 17:14:57 -0500 Subject: [PATCH] Add security context template to prometheus-blackbox-exporter This change adds security context template at pod level to implement runAsUser flag This change adds security context template at container level to implement readOnly-fs flag Change-Id: Icbea3487c058d88188061d0d5a77458dce910884 --- prometheus-blackbox-exporter/templates/deployment.yaml | 2 ++ prometheus-blackbox-exporter/values.yaml | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/prometheus-blackbox-exporter/templates/deployment.yaml b/prometheus-blackbox-exporter/templates/deployment.yaml index d492488d2..e63620992 100644 --- a/prometheus-blackbox-exporter/templates/deployment.yaml +++ b/prometheus-blackbox-exporter/templates/deployment.yaml @@ -34,12 +34,14 @@ spec: annotations: {{ dict "envAll" $envAll "podName" "prometheus-blackbox-exporter" "containerNames" (list "blackbox-exporter") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }} spec: +{{ dict "envAll" $envAll "application" "prometheus_blackbox_exporter" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} nodeSelector: {{ .Values.labels.blackbox_exporter.node_selector_key }}: {{ .Values.labels.blackbox_exporter.node_selector_value | quote }} containers: - name: blackbox-exporter {{ tuple $envAll "prometheus_blackbox_exporter" | include "helm-toolkit.snippets.image" | indent 8 }} {{ tuple $envAll $envAll.Values.pod.resources.prometheus_blackbox_exporter | include "helm-toolkit.snippets.kubernetes_resources" | indent 8 }} +{{ dict "envAll" $envAll "application" "prometheus_blackbox_exporter" "container" "blackbox_exporter" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 8 }} args: - "--config.file=/config/blackbox.yaml" ports: diff --git a/prometheus-blackbox-exporter/values.yaml b/prometheus-blackbox-exporter/values.yaml index 470478f55..e0b6087cb 100644 --- a/prometheus-blackbox-exporter/values.yaml +++ b/prometheus-blackbox-exporter/values.yaml @@ -47,6 +47,14 @@ endpoints: default: 9115 pod: + security_context: + prometheus_blackbox_exporter: + pod: + runAsUser: 65534 + container: + blackbox_exporter: + allowPrivilegeEscalation: false + readOnlyRootFilesystem: true replicas: prometheus_blackbox_exporter: 1 annotations: