From f633555f16968610bf91cb3dcd6dee891e066adb Mon Sep 17 00:00:00 2001 From: "dt241s@att.com" Date: Tue, 28 Jan 2020 13:26:26 -0600 Subject: [PATCH] Enable Docker default Apparmor for Postgresql and prometheus-postgresql. Change-Id: I013ca5f99e5032c44f0d679e467da9e928c02a6b --- .../monitoring/prometheus/exporter-deployment.yaml | 3 +++ postgresql/templates/statefulset.yaml | 1 + postgresql/values_overrides/apparmor.yaml | 8 ++++++++ tools/deployment/apparmor/130-postgresql.sh | 1 + zuul.d/jobs.yaml | 1 + 5 files changed, 14 insertions(+) create mode 100644 postgresql/values_overrides/apparmor.yaml create mode 120000 tools/deployment/apparmor/130-postgresql.sh diff --git a/postgresql/templates/monitoring/prometheus/exporter-deployment.yaml b/postgresql/templates/monitoring/prometheus/exporter-deployment.yaml index ce82f258a..66d4c51c7 100644 --- a/postgresql/templates/monitoring/prometheus/exporter-deployment.yaml +++ b/postgresql/templates/monitoring/prometheus/exporter-deployment.yaml @@ -34,6 +34,9 @@ spec: labels: {{ tuple $envAll "prometheus_postgresql_exporter" "exporter" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} 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 }} 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/statefulset.yaml b/postgresql/templates/statefulset.yaml index 38a6af4a1..3379570b8 100644 --- a/postgresql/templates/statefulset.yaml +++ b/postgresql/templates/statefulset.yaml @@ -122,6 +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 }} 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 new file mode 100644 index 000000000..7025648f9 --- /dev/null +++ b/postgresql/values_overrides/apparmor.yaml @@ -0,0 +1,8 @@ +pod: + mandatory_access_control: + type: apparmor + postgresql: + postgresql: runtime/default + set-volume-perms: runtime/default + prometheus-postgresql-exporter: + postgresql-exporter: runtime/default diff --git a/tools/deployment/apparmor/130-postgresql.sh b/tools/deployment/apparmor/130-postgresql.sh new file mode 120000 index 000000000..bb8d4c2e7 --- /dev/null +++ b/tools/deployment/apparmor/130-postgresql.sh @@ -0,0 +1 @@ +../osh-infra-monitoring/130-postgresql.sh \ No newline at end of file diff --git a/zuul.d/jobs.yaml b/zuul.d/jobs.yaml index 87c6f433f..84ebc8d03 100644 --- a/zuul.d/jobs.yaml +++ b/zuul.d/jobs.yaml @@ -286,6 +286,7 @@ - ./tools/deployment/apparmor/100-fluentbit.sh - ./tools/deployment/apparmor/110-fluentd-daemonset.sh - ./tools/deployment/apparmor/120-openvswitch.sh + - ./tools/deployment/apparmor/130-postgresql.sh - job: name: openstack-helm-infra-openstack-support