Skip to content

Commit

Permalink
Add kubevirt addon
Browse files Browse the repository at this point in the history
The addon installs kubvirt v1.0.0 (corresponds to OpenShift 4.14) in
the managed clusters. We may switch later to latest release, starting
with something more stable.

Signed-off-by: Nir Soffer <nsoffer@redhat.com>
  • Loading branch information
nirs committed Oct 12, 2023
1 parent eba5349 commit 57fbcbd
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
67 changes: 67 additions & 0 deletions test/addons/kubevirt/start
Original file line number Diff line number Diff line change
@@ -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.0.0"
BASE_URL = "https://github.com/kubevirt/kubevirt/releases/download"
NAMESPACE = "kubevirt"


def deploy(cluster):
print("Deploying kubevirt operator")
kubectl.apply(
f"--filename={BASE_URL}/{VERSION}/kubevirt-operator.yaml",
context=cluster,
)

print("Waiting until virt-operator is rolled out")
kubectl.rollout(
"status",
"deploy/virt-operator",
f"--namespace={NAMESPACE}",
context=cluster,
)

print("Deploying kubevirt cr")
kubectl.apply(
f"--filename={BASE_URL}/{VERSION}/kubevirt-cr.yaml",
context=cluster,
)


def wait(cluster):
print("Waiting until kubevirt cr reports phase")
drenv.wait_for(
"kubevirt.kubevirt.io/kubevirt",
namespace=NAMESPACE,
output="jsonpath={.status.phase}",
timeout=60,
profile=cluster,
)

print("Waiting until kubevirt cr phase is deployed")
kubectl.wait(
"kubevirt.kubevirt.io/kubevirt",
"--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)
1 change: 1 addition & 0 deletions test/envs/regional-dr-kubevirt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ templates:
- name: olm
- name: minio
- name: velero
- name: kubevirt
- name: "hub-cluster"
driver: "$vm"
container_runtime: containerd
Expand Down

0 comments on commit 57fbcbd

Please sign in to comment.