From a9f7e19f8ab2303dd0d109f9b9ca69cf2d6a2ad8 Mon Sep 17 00:00:00 2001 From: Wainer dos Santos Moschetta Date: Tue, 20 Aug 2024 15:31:31 -0300 Subject: [PATCH] libvirt/kcli_cluster.sh: add support to CRI-O By exporting the CONTAINER_RUNTIME=crio variable, kcli will create a k8s cluster configured CRI-O: $ export CONTAINER_RUNTIME=crio $ ./src/cloud-api-adaptor/libvirt/kcli_cluster.sh create Fixes #1981 Signed-off-by: Wainer dos Santos Moschetta --- src/cloud-api-adaptor/libvirt/kcli_cluster.sh | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/cloud-api-adaptor/libvirt/kcli_cluster.sh b/src/cloud-api-adaptor/libvirt/kcli_cluster.sh index 8242bf7964..af29e214fa 100755 --- a/src/cloud-api-adaptor/libvirt/kcli_cluster.sh +++ b/src/cloud-api-adaptor/libvirt/kcli_cluster.sh @@ -15,6 +15,7 @@ CLUSTER_NAME="${CLUSTER_NAME:-peer-pods}" CLUSTER_IMAGE="${CLUSTER_IMAGE:-ubuntu2204}" CLUSTER_VERSION="${CLUSTER_VERSION:-1.30.0}" CLUSTER_WORKERS="${CLUSTER_WORKERS:-1}" +CONTAINER_RUNTIME="${CONTAINER_RUNTIME:-containerd}" # Either "containerd" or "crio" LIBVIRT_NETWORK="${LIBVIRT_NETWORK:-default}" LIBVIRT_POOL="${LIBVIRT_POOL:-default}" @@ -44,16 +45,22 @@ wait_for_process() { # Create the cluster. # create () { + local sdn="flannel" + # Networking services don't work fine with the flannel and crio combination + # See https://github.com/karmab/kcli/issues/744 + [ "$CONTAINER_RUNTIME" = "crio" ] && sdn="cilium" + parameters="-P domain=kata.com \ -P pool=$LIBVIRT_POOL \ -P ctlplanes=$CLUSTER_CONTROL_NODES \ -P workers=$CLUSTER_WORKERS \ -P network=$LIBVIRT_NETWORK \ -P image=$CLUSTER_IMAGE \ - -P sdn=flannel \ + -P sdn=$sdn \ -P nfs=false \ -P disk_size=$CLUSTER_DISK_SIZE \ - -P version=$CLUSTER_VERSION" + -P version=$CLUSTER_VERSION \ + -P engine=$CONTAINER_RUNTIME" # The autolabeller and multus images do not support s390x arch yet # disable them for s390x cluster if [[ ${TARGET_ARCH} == "s390x" ]]; then @@ -120,7 +127,8 @@ usage () { CLUSTER_VERSION (default "${CLUSTER_VERSION}") LIBVIRT_NETWORK (default "${LIBVIRT_NETWORK}") LIBVIRT_POOL (default "${LIBVIRT_POOL}") - CLUSTER_WORKERS (default "${CLUSTER_WORKERS}"). + CLUSTER_WORKERS (default "${CLUSTER_WORKERS}") + CONTAINER_RUNTIME (default "${CONTAINER_RUNTIME}") delete Delete the cluster. Specify the cluster name with CLUSTER_NAME (default "${CLUSTER_NAME}"). EOF