From 7c5479fb83f80f0338c450e1c3c72af141022484 Mon Sep 17 00:00:00 2001 From: diwakar thyagaraj Date: Tue, 5 May 2020 22:07:36 +0000 Subject: [PATCH] Enable Apparmor to postgresql init containers Change-Id: If679428710dbb8c9c8a5da4248c48e05a2fb0844 Signed-off-by: diwakar thyagaraj --- .../templates/monitoring/prometheus/exporter-deployment.yaml | 2 +- .../monitoring/prometheus/exporter-job-create-user.yaml | 2 +- postgresql/templates/statefulset.yaml | 2 +- postgresql/values_overrides/apparmor.yaml | 3 +++ 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/postgresql/templates/monitoring/prometheus/exporter-deployment.yaml b/postgresql/templates/monitoring/prometheus/exporter-deployment.yaml index bc5b5bd5a..acf49d10f 100644 --- a/postgresql/templates/monitoring/prometheus/exporter-deployment.yaml +++ b/postgresql/templates/monitoring/prometheus/exporter-deployment.yaml @@ -36,7 +36,7 @@ spec: namespace: {{ .Values.endpoints.prometheus_postgresql_exporter.namespace }} annotations: {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }} -{{ dict "envAll" $envAll "podName" "prometheus-postgresql-exporter" "containerNames" (list "postgresql-exporter") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }} +{{ dict "envAll" $envAll "podName" "prometheus-postgresql-exporter" "containerNames" (list "postgresql-exporter" "init") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }} spec: {{ dict "envAll" $envAll "application" "prometheus_postgresql_exporter" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }} serviceAccountName: {{ $serviceAccountName }} diff --git a/postgresql/templates/monitoring/prometheus/exporter-job-create-user.yaml b/postgresql/templates/monitoring/prometheus/exporter-job-create-user.yaml index 6ff71f105..ca4e4ee74 100644 --- a/postgresql/templates/monitoring/prometheus/exporter-job-create-user.yaml +++ b/postgresql/templates/monitoring/prometheus/exporter-job-create-user.yaml @@ -31,7 +31,7 @@ spec: {{ tuple $envAll "prometheus_postgresql_exporter" "create_user" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} annotations: {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }} -{{ dict "envAll" $envAll "podName" "prometheus-postgresql-exporter-create-user" "containerNames" (list "prometheus-postgresql-exporter-create-user") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }} +{{ dict "envAll" $envAll "podName" "prometheus-postgresql-exporter-create-user" "containerNames" (list "prometheus-postgresql-exporter-create-user" "init") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }} spec: serviceAccountName: {{ $serviceAccountName }} restartPolicy: OnFailure diff --git a/postgresql/templates/statefulset.yaml b/postgresql/templates/statefulset.yaml index 3379570b8..ee9fc4812 100644 --- a/postgresql/templates/statefulset.yaml +++ b/postgresql/templates/statefulset.yaml @@ -122,7 +122,7 @@ spec: {{ tuple $envAll | include "helm-toolkit.snippets.release_uuid" | indent 8 }} configmap-bin-hash: {{ tuple "configmap-bin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-etc-hash: {{ tuple "configmap-etc.yaml" . | include "helm-toolkit.utils.hash" }} -{{ dict "envAll" $envAll "podName" "postgresql" "containerNames" (list "postgresql" "set-volume-perms") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }} +{{ dict "envAll" $envAll "podName" "postgresql" "containerNames" (list "postgresql" "set-volume-perms" "init") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }} configmap-admin-hash: {{ tuple "secret-admin.yaml" . | include "helm-toolkit.utils.hash" }} configmap-replica-hash: {{ tuple "secret-replica.yaml" . | include "helm-toolkit.utils.hash" }} configmap-secrets-etc-hash: {{ tuple "secrets-etc.yaml" . | include "helm-toolkit.utils.hash" }} diff --git a/postgresql/values_overrides/apparmor.yaml b/postgresql/values_overrides/apparmor.yaml index cdbdb8743..718a0fdf2 100644 --- a/postgresql/values_overrides/apparmor.yaml +++ b/postgresql/values_overrides/apparmor.yaml @@ -4,7 +4,10 @@ pod: postgresql: postgresql: runtime/default set-volume-perms: runtime/default + init: runtime/default prometheus-postgresql-exporter: postgresql-exporter: runtime/default + init: runtime/default prometheus-postgresql-exporter-create-user: prometheus-postgresql-exporter-create-user: runtime/default + init: runtime/default \ No newline at end of file