Skip to content

Commit

Permalink
ccruntime: Manage runtime class creation / deletion
Browse files Browse the repository at this point in the history
Kata Containers moved to managing the runtime class creation / deletion,
leading to making the Operator "dumber", removing all the runtime class
management from there.

Let's adapt to it on the Enclave CC side as well.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
  • Loading branch information
fidencio committed Aug 7, 2023
1 parent 6577d8a commit 3088f81
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions tools/packaging/build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ ARG ENCLAVE_CC_ARTIFACTS=./enclave-cc-static.tar.xz
ARG DESTINATION=/opt/enclave-cc-artifacts

COPY ${ENCLAVE_CC_ARTIFACTS} ${WORKDIR}
COPY runtimeclass ${DESTINATION}/runtimeclass

ENV DEBIAN_FRONTEND=noninteractive
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
Expand Down
1 change: 1 addition & 0 deletions tools/packaging/build/build_payload.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ install -D ${SCRIPT_ROOT}/../deploy/enclave-cc-deploy.sh ${PAYLOAD_ARTIFACTS}/sc
pushd $PAYLOAD_ARTIFACTS
tar cfJ enclave-cc-static.tar.xz *
cp ${SCRIPT_ROOT}/Dockerfile .
cp -a ${SCRIPT_ROOT}/runtimeclass .
docker build . -t ${IMAGE} -t ${DEFAULT_LATEST_IMAGE}
if [ "${PUSH}" == "yes" ]; then
docker push ${IMAGE}
Expand Down
6 changes: 6 additions & 0 deletions tools/packaging/build/runtimeclass/enclave-cc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
kind: RuntimeClass
apiVersion: node.k8s.io/v1
metadata:
name: enclave-cc
handler: enclave-cc
12 changes: 12 additions & 0 deletions tools/packaging/deploy/enclave-cc-deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ function print_usage() {
echo "Usage: $0 [install/cleanup/reset]"
}

function create_runtimeclass() {
echo "Creating the runtime classes"
kubectl apply -f /runtimeclass/enclave-cc.yaml
}

function delete_runtimeclass() {
echo "Deleting the runtime classes"
kubectl delete -f /runtimeclass/enclave-cc.yaml
}

function get_container_runtime() {

local runtime=$(kubectl get node $NODE_NAME -o jsonpath='{.status.nodeInfo.containerRuntimeVersion}')
Expand Down Expand Up @@ -167,10 +177,12 @@ function main() {
install)
install_artifacts
configure_cri_runtime "$runtime"
create_runtimeclass
kubectl label node "$NODE_NAME" --overwrite confidentialcontainers.org/enclave-cc=true
;;
cleanup)
cleanup_cri_runtime "$runtime"
delete_runtimeclass
kubectl label node "$NODE_NAME" --overwrite confidentialcontainers.org/enclave-cc=cleanup
remove_artifacts
;;
Expand Down

0 comments on commit 3088f81

Please sign in to comment.