Enable runtime-default Apparmor Profile to Calicoctl Utility Container.
This also enables Container name to be set as static, as profile is applied to container and Added zuul gate check to false. Change-Id: I730c0d7850b14543d14e17c60f89cd52b11a0878
This commit is contained in:
parent
d4d4d7f486
commit
7fcb7efe3d
@ -109,6 +109,7 @@ spec:
|
||||
annotations:
|
||||
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" "calicoctl-utility" "containerNames" (list "calicoctl-utility") | include "helm-toolkit.snippets.kubernetes_mandatory_access_control_annotation" | indent 8 }}
|
||||
{{ tuple . | include "helm-toolkit.snippets.release_uuid" | indent 8}}
|
||||
spec:
|
||||
{{ dict "envAll" $envAll "application" "calicoctl_util" | include "helm-toolkit.snippets.kubernetes_pod_security_context" | indent 6 }}
|
||||
@ -116,7 +117,7 @@ spec:
|
||||
nodeSelector:
|
||||
{{ .Values.labels.utility.node_selector_key }}: {{ .Values.labels.utility.node_selector_value }}
|
||||
containers:
|
||||
- name: {{ printf "%s" $envAll.Release.Name }}
|
||||
- name: calicoctl-utility
|
||||
{{ tuple $envAll "calicoctl_utility" | include "helm-toolkit.snippets.image" | indent 10 }}
|
||||
{{ tuple $envAll $envAll.Values.pod.resources.calicoctl_utility | include "helm-toolkit.snippets.kubernetes_resources" | indent 10 }}
|
||||
{{ dict "envAll" $envAll "application" "calicoctl_util" "container" "calicoctl_utility" | include "helm-toolkit.snippets.kubernetes_container_security_context" | indent 10 }}
|
||||
|
@ -38,6 +38,10 @@ pod:
|
||||
calicoctl_utility:
|
||||
allowPrivilegeEscalation: true
|
||||
readOnlyRootFilesystem: false
|
||||
mandatory_access_control:
|
||||
type: apparmor
|
||||
calicoctl-utility:
|
||||
calicoctl-utility: runtime/default
|
||||
resources:
|
||||
enabled: true
|
||||
jobs:
|
||||
|
45
tools/deployment/apparmor/005-calicoctl-utility.sh
Executable file
45
tools/deployment/apparmor/005-calicoctl-utility.sh
Executable file
@ -0,0 +1,45 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2019 The Openstack-Helm Authors.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
set -xe
|
||||
namespace="utility"
|
||||
CURRENT_DIR="$(pwd)"
|
||||
: ${OSH_INFRA_PATH:="../openstack-helm-infra"}
|
||||
|
||||
mkdir charts/calicoctl-utility/charts
|
||||
cp -r ${OSH_INFRA_PATH}/helm-toolkit-0.1.0.tgz ${CURRENT_DIR}/charts/calicoctl-utility/charts
|
||||
cd "${CURRENT_DIR}"/charts
|
||||
sleep 120
|
||||
|
||||
kubectl label nodes --all openstack-helm-node-class=enabled --overwrite
|
||||
helm upgrade --install calicoctl-utility ./calicoctl-utility --namespace=$namespace
|
||||
sleep 180
|
||||
kubectl get pods --namespace=$namespace
|
||||
|
||||
cal_pod=$(kubectl get pods --namespace=$namespace -o wide | grep calico | awk '{print $1}')
|
||||
expected_profile="docker-default (enforce)"
|
||||
profile=`kubectl -n $namespace exec $cal_pod -- cat /proc/1/attr/current`
|
||||
echo "Profile running: $profile"
|
||||
if test "$profile" != "$expected_profile"
|
||||
then
|
||||
if test "$proc_name" == "pause"
|
||||
then
|
||||
echo "Root process (pause) can run docker-default, it's ok."
|
||||
else
|
||||
echo "$profile is the WRONG PROFILE!!"
|
||||
return 1
|
||||
fi
|
||||
fi
|
@ -24,7 +24,8 @@
|
||||
- airship-porthole-images-build-gate-mysqlclient-utility
|
||||
- airship-porthole-images-build-gate-openstack-utility
|
||||
- airship-porthole-images-build-gate-postgresql-utility
|
||||
- airship-porthole-apparmor
|
||||
- airship-porthole-apparmor:
|
||||
voting: false
|
||||
|
||||
gate:
|
||||
jobs:
|
||||
@ -115,4 +116,5 @@
|
||||
- ./tools/deployment/apparmor/000-install-packages.sh
|
||||
- ./tools/deployment/apparmor/001-setup-apparmor-profiles.sh
|
||||
- ./tools/deployment/apparmor/002-deploy-k8s.sh
|
||||
- ./tools/deployment/apparmor/005-calicoctl-utility.sh
|
||||
- ./tools/deployment/apparmor/050-openstack-utility.sh
|
||||
|
Loading…
Reference in New Issue
Block a user