kata-deploy: Configure Kata & containerd for CCv0

Introduce kata-cc runtime class, shim & config
- Specify cri_handler in containerd config
- Specify to use initrd
- Specify kernel_params according to guest config
- Specify service_offload

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
This commit is contained in:
Jakob Naucke 2021-12-10 16:44:57 +01:00
parent a570b6a0a6
commit f5e6961dcb
No known key found for this signature in database
GPG Key ID: 45FA1C7D310C0EBE
2 changed files with 17 additions and 1 deletions

View File

@ -28,6 +28,8 @@ spec:
valueFrom: valueFrom:
fieldRef: fieldRef:
fieldPath: spec.nodeName fieldPath: spec.nodeName
- name: CONFIGURE_CC
value: "yes"
securityContext: securityContext:
privileged: false privileged: false
volumeMounts: volumeMounts:

View File

@ -18,6 +18,7 @@ shims=(
"qemu" "qemu"
"clh" "clh"
) )
[ "${CONFIGURE_CC:-}" == "yes" ] && shims+=("cc")
# If we fail for any reason a message will be displayed # If we fail for any reason a message will be displayed
die() { die() {
@ -171,7 +172,8 @@ function configure_containerd_runtime() {
else else
cat <<EOT | tee -a "$containerd_conf_file" cat <<EOT | tee -a "$containerd_conf_file"
[$runtime_table] [$runtime_table]
runtime_type = "${runtime_type}" runtime_type = "${runtime_type}" \
$([ "$runtime" == "kata-cc" ] && printf '\n cri_handler = "cc"')
privileged_without_host_devices = true privileged_without_host_devices = true
pod_annotations = ["io.katacontainers.*"] pod_annotations = ["io.katacontainers.*"]
EOT EOT
@ -207,6 +209,17 @@ function configure_containerd() {
done done
} }
function configure_kata() {
if [ "${CONFIGURE_CC:-}" == "yes" ]; then
sed -E \
-e 's#^image = .+#initrd = "/opt/kata/share/kata-containers/kata-containers-initrd.img"#' \
-e 's#^(kernel_params = .+)"#\1 agent.config_file=/etc/kata-config.toml"#' \
-e 's#.*service_offload = .+#service_offload = true#' \
"/opt/kata/share/defaults/kata-containers/configuration-qemu.toml" > \
"/opt/kata/share/defaults/kata-containers/configuration-cc.toml"
fi
}
function remove_artifacts() { function remove_artifacts() {
echo "deleting kata artifacts" echo "deleting kata artifacts"
rm -rf /opt/kata/ rm -rf /opt/kata/
@ -287,6 +300,7 @@ function main() {
install_artifacts install_artifacts
configure_cri_runtime "$runtime" configure_cri_runtime "$runtime"
configure_kata
kubectl label node "$NODE_NAME" --overwrite katacontainers.io/kata-runtime=true kubectl label node "$NODE_NAME" --overwrite katacontainers.io/kata-runtime=true
;; ;;
cleanup) cleanup)