From 0f4267b5c9442436dbdc559d26b59b72bf51063a Mon Sep 17 00:00:00 2001 From: diwakar thyagaraj Date: Tue, 19 Nov 2019 17:10:33 +0000 Subject: [PATCH] Enable runtime-default Apparmor Profile to Ceph Utility Container. Change-Id: If814aba2ec5bd457f55e38ce5024922b72d32187 --- .../templates/deployment-utility.yaml | 3 +- charts/ceph-utility/values.yaml | 4 + tools/deployment/apparmor/010-ceph-utility.sh | 278 ++++++++++++++++++ zuul.d/base.yaml | 1 + 4 files changed, 285 insertions(+), 1 deletion(-) create mode 100755 tools/deployment/apparmor/010-ceph-utility.sh diff --git a/charts/ceph-utility/templates/deployment-utility.yaml b/charts/ceph-utility/templates/deployment-utility.yaml index 116e7cde..bba18058 100644 --- a/charts/ceph-utility/templates/deployment-utility.yaml +++ b/charts/ceph-utility/templates/deployment-utility.yaml @@ -65,6 +65,7 @@ spec: name: {{ printf "%s" $envAll.Release.Name }} annotations: {{ tuple . | include "helm-toolkit.snippets.release_uuid" }} +{{ dict "envAll" $envAll "podName" "ceph-utility" "containerNames" (list "ceph-utility") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }} labels: {{ tuple $envAll "ceph" "utility" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 8 }} spec: @@ -75,7 +76,7 @@ spec: nodeSelector: {{ .Values.labels.utility.node_selector_key }}: {{ .Values.labels.utility.node_selector_value }} containers: - - name: {{ printf "%s" $envAll.Release.Name }} + - name: ceph-utility {{ tuple $envAll "ceph_utility" | include "helm-toolkit.snippets.image" | indent 10 }} {{ tuple $envAll $envAll.Values.pod.resources.ceph_utility | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }} {{ dict "envAll" $envAll "application" "ceph" "container" "ceph_utility" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }} diff --git a/charts/ceph-utility/values.yaml b/charts/ceph-utility/values.yaml index 5c910702..bd500344 100644 --- a/charts/ceph-utility/values.yaml +++ b/charts/ceph-utility/values.yaml @@ -56,6 +56,10 @@ pod: default: preferredDuringSchedulingIgnoredDuringExecution topologyKey: default: kubernetes.io/hostname + mandatory_access_control: + type: apparmor + ceph-utility: + ceph-utility: runtime/default resources: enabled: false utility: diff --git a/tools/deployment/apparmor/010-ceph-utility.sh b/tools/deployment/apparmor/010-ceph-utility.sh new file mode 100755 index 00000000..202eabb9 --- /dev/null +++ b/tools/deployment/apparmor/010-ceph-utility.sh @@ -0,0 +1,278 @@ +#!/bin/bash +set -xe +namespace="utility" +CURRENT_DIR="$(pwd)" +kubectl get pods --all-namespaces + +: ${OSH_INFRA_PATH:="../../openstack-helm-infra"} +cd ${OSH_INFRA_PATH} + +for CHART in ceph-mon ceph-client ceph-provisioners; do + make "${CHART}" +done + +#NOTE: Deploy command +: ${OSH_EXTRA_HELM_ARGS:=""} +[ -s /tmp/ceph-fs-uuid.txt ] || uuidgen > /tmp/ceph-fs-uuid.txt +CEPH_FS_ID="$(cat /tmp/ceph-fs-uuid.txt)" +#NOTE(portdirect): to use RBD devices with Ubuntu kernels < 4.5 this +# should be set to 'hammer' +. /etc/os-release +if [ "x${ID}" == "xubuntu" ] && \ + [ "$(uname -r | awk -F "." '{ print $2 }')" -lt "5" ]; then + CRUSH_TUNABLES=hammer +else + CRUSH_TUNABLES=null +fi +tee /tmp/ceph.yaml <