Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ccruntime: Manage runtime class creation / deletion #195

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading