Skip to content
This repository has been archived by the owner on Jun 28, 2024. It is now read-only.

Commit

Permalink
ci/openshift-ci: Enable selinux in CI runs
Browse files Browse the repository at this point in the history
as kata-deploy does not currently handles selinux, this requires manual
relabel of the /opt/kata folder where custom binaries are deployed.

Signed-off-by: Lukáš Doktor <[email protected]>
  • Loading branch information
ldoktor committed Dec 4, 2023
1 parent ef6a9c7 commit fa0f24c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
22 changes: 22 additions & 0 deletions .ci/openshift-ci/cluster/deployments/relable_selinux.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: restorecon-daemonset
namespace: kube-system
spec:
selector:
matchLabels:
app: restorecon
template:
metadata:
labels:
app: restorecon
spec:
serviceAccountName: kata-deploy-sa
hostPID: true
containers:
- name: restorecon-container
image: alpine
securityContext:
privileged: true
command: ["/bin/sh", "-c", "nsenter --target 1 --mount bash -c \"ls -alZ /opt/kata/bin; semanage fcontext -a -t bin_t '/opt/kata/bin(/.*)?'; semanage fcontext -a -t bin_t '/opt/kata/libexec(/.*)?'; semanage fcontext -a -t bin_t '/opt/kata/runtime-rs/bin(/.*)?'; restorecon -Rv /opt/kata; ls -alZ /opt/kata/bin\""]
4 changes: 4 additions & 0 deletions .ci/openshift-ci/cluster/install_kata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -181,3 +181,7 @@ if [ ${SELINUX_PERMISSIVE} == "yes" ]; then
# The new SELinux configuration will trigger another reboot.
wait_for_reboot
fi

# FIXME: Remove when https://github.com/kata-containers/kata-containers/pull/8417 is resolved
# Selinux context is currently not handled by kata-deploy
oc apply -f ${deployments_dir} relable_selinux.yaml
2 changes: 1 addition & 1 deletion .ci/openshift-ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export PATH=/tmp/shared:$PATH
oc version || die "Test cluster is unreachable"

info "Install and configure kata into the test cluster"
export SELINUX_PERMISSIVE="yes"
export SELINUX_PERMISSIVE="no"
${script_dir}/cluster/install_kata.sh || die "Failed to install kata-containers"

info "Run test suite: $suite"
Expand Down

0 comments on commit fa0f24c

Please sign in to comment.