From a6b68907a492d3b483f49b1fa436b7afe292c181 Mon Sep 17 00:00:00 2001 From: Nir Soffer Date: Thu, 12 Oct 2023 20:08:47 +0300 Subject: [PATCH] Add CDI addon CDI is used to populate PVCs with VM images. Signed-off-by: Nir Soffer --- test/addons/cdi/start | 67 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100755 test/addons/cdi/start diff --git a/test/addons/cdi/start b/test/addons/cdi/start new file mode 100755 index 0000000000..8d2ba14a2b --- /dev/null +++ b/test/addons/cdi/start @@ -0,0 +1,67 @@ +#!/usr/bin/env python3 + +# SPDX-FileCopyrightText: The RamenDR authors +# SPDX-License-Identifier: Apache-2.0 + +import os +import sys + +import drenv +from drenv import kubectl + +VERSION = "v1.57.0" +BASE_URL = "https://github.com/kubevirt/containerized-data-importer/releases/download" +NAMESPACE = "cdi" + + +def deploy(cluster): + print("Deploying cdi operator") + kubectl.apply( + f"--filename={BASE_URL}/{VERSION}/cdi-operator.yaml", + context=cluster, + ) + + print("Waiting until cdi-operator is rolled out") + kubectl.rollout( + "status", + "deploy/cdi-operator", + f"--namespace={NAMESPACE}", + context=cluster, + ) + + print("Deploying cdi cr") + kubectl.apply( + f"--filename={BASE_URL}/{VERSION}/cdi-cr.yaml", + context=cluster, + ) + + +def wait(cluster): + print("Waiting until cdi cr reports phase") + drenv.wait_for( + "cdi.cdi.kubevirt.io/cdi", + namespace=NAMESPACE, + output="jsonpath={.status.phase}", + timeout=60, + profile=cluster, + ) + + print("Waiting until cdi cr phase is deployed") + kubectl.wait( + "cdi.cdi.kubevirt.io/cdi", + "--for=jsonpath={.status.phase}=Deployed", + f"--namespace={NAMESPACE}", + "--timeout=300s", + context=cluster, + ) + + +if len(sys.argv) != 2: + print(f"Usage: {sys.argv[0]} cluster") + sys.exit(1) + +os.chdir(os.path.dirname(__file__)) +cluster = sys.argv[1] + +deploy(cluster) +wait(cluster)