From 71ee7ef0deaef63bbb6961b4d0a82dd6e8364bca Mon Sep 17 00:00:00 2001 From: Bella Khizgiyaev Date: Tue, 17 Oct 2023 16:20:03 +0300 Subject: [PATCH 1/4] Introduce the e2e test setup for OVA providers. Signed-off-by: Bella Khizgiyaev --- BUILD_AND_INSTALL_FORKLIFT_ON_KIND.md | 2 ++ build_forklift_bazel.sh | 9 ++++++++- cluster/providers/install-provider.sh | 17 ++++++++++++---- cluster/providers/ova/setup.sh | 20 +++++++++++++++++++ .../{openstack => utils}/install_nfs.sh | 0 5 files changed, 43 insertions(+), 5 deletions(-) create mode 100755 cluster/providers/ova/setup.sh rename cluster/providers/{openstack => utils}/install_nfs.sh (100%) diff --git a/BUILD_AND_INSTALL_FORKLIFT_ON_KIND.md b/BUILD_AND_INSTALL_FORKLIFT_ON_KIND.md index 36a4c30..2603ec8 100644 --- a/BUILD_AND_INSTALL_FORKLIFT_ON_KIND.md +++ b/BUILD_AND_INSTALL_FORKLIFT_ON_KIND.md @@ -46,6 +46,7 @@ it is possible to install the following source providers as part of k8s kind clu - [VMware - vcsim](https://github.com/vmware/govmomi/blob/main/vcsim/README.md) - [OpenStack - packstack](https://github.com/kubev2v/packstack-img) - [oVirt - fakeovirt and ovirt-imageio](https://github.com/kubev2v/fakeovirt) +- [OVA - NFS share setup and copying OVA files]() Run the script: @@ -63,6 +64,7 @@ when `` can be one of those: | INSTALL_NFS | install nfs server locally | | - vsphere +- ova - all diff --git a/build_forklift_bazel.sh b/build_forklift_bazel.sh index 8b3c5e0..085332d 100755 --- a/build_forklift_bazel.sh +++ b/build_forklift_bazel.sh @@ -68,12 +68,19 @@ if [ "${PROVIDER_NAME}" = "vsphere" ]; then --action_env VIRT_V2V_DONT_REQUEST_KVM=true " fi +if [ "${PROVIDER_NAME}" = "ova" ]; then + ACTION_ENV="$ACTION_ENV --action_env VIRT_V2V_IMAGE=quay.io/kubev2v/forklift-virt-v2v-stub:${REGISTRY_TAG} \ + --action_env VIRT_V2V_DONT_REQUEST_KVM=true \ + --action_env OVA_PROVIDER_SERVER_IMAGE=${REGISTRY}/forklift-ova-provider-server:${REGISTRY_TAG}" +fi + if [ "${PROVIDER_NAME}" = "all" ]; then ACTION_ENV="$ACTION_ENV --action_env VIRT_V2V_IMAGE=quay.io/kubev2v/forklift-virt-v2v-stub:${REGISTRY_TAG} \ --action_env VIRT_V2V_DONT_REQUEST_KVM=true \ --action_env OVIRT_POPULATOR_IMAGE=${REGISTRY}/ovirt-populator:${REGISTRY_TAG} \ --action_env OPENSTACK_POPULATOR_IMAGE=${REGISTRY}/openstack-populator:${REGISTRY_TAG} \ - --action_env POPULATOR_CONTROLLER_IMAGE=${REGISTRY}/populator-controller:${REGISTRY_TAG}" + --action_env POPULATOR_CONTROLLER_IMAGE=${REGISTRY}/populator-controller:${REGISTRY_TAG} \ + --action_env OVA_PROVIDER_SERVER_IMAGE=${REGISTRY}/forklift-ova-provider-server:${REGISTRY_TAG}" fi bazel run push-forklift-operator-bundle \ diff --git a/cluster/providers/install-provider.sh b/cluster/providers/install-provider.sh index cec33a2..1f3b754 100755 --- a/cluster/providers/install-provider.sh +++ b/cluster/providers/install-provider.sh @@ -18,16 +18,18 @@ case $PROVIDER_NAME in k8s_apply_volume_populator ${SCRIPT_DIR}/vmware/setup.sh ${SCRIPT_DIR}/ovirt/setup.sh - [ ! -z "${INSTALL_NFS}" ] && ${SCRIPT_DIR}/openstack/install_nfs.sh + [ ! -z "${INSTALL_NFS}" ] && ${SCRIPT_DIR}/utils/install_nfs.sh ${SCRIPT_DIR}/openstack/setup.sh ${SCRIPT_DIR}/openstack/create_test_vms.sh + ${SCRIPT_DIR}/ova/setup.sh + ;; "vsphere") echo "installing vsphere providers" # installs NFS for CSI - [ ! -z "${INSTALL_NFS}" ] && ${SCRIPT_DIR}/openstack/install_nfs.sh + [ ! -z "${INSTALL_NFS}" ] && ${SCRIPT_DIR}/utils/install_nfs.sh ${SCRIPT_DIR}/vmware/setup.sh ;; @@ -37,7 +39,7 @@ case $PROVIDER_NAME in k8s_apply_volume_populator # installs NFS for CSI - [ ! -z "${INSTALL_NFS}" ] && ${SCRIPT_DIR}/openstack/install_nfs.sh + [ ! -z "${INSTALL_NFS}" ] && ${SCRIPT_DIR}/utils/install_nfs.sh ${SCRIPT_DIR}/ovirt/setup.sh @@ -48,7 +50,7 @@ case $PROVIDER_NAME in k8s_apply_volume_populator #installs nfs for CSI and opentack volumes - [ ! -z "${INSTALL_NFS}" ] && ${SCRIPT_DIR}/openstack/install_nfs.sh + [ ! -z "${INSTALL_NFS}" ] && ${SCRIPT_DIR}/utils/install_nfs.sh #create openstack - packstack deployment ${SCRIPT_DIR}/openstack/setup.sh @@ -56,6 +58,13 @@ case $PROVIDER_NAME in #create sample VMs and volume disks for the tests ${SCRIPT_DIR}/openstack/create_test_vms.sh ;; + "ova") + echo "installing ova providers" + # installs NFS for CSI + [ ! -z "${INSTALL_NFS}" ] && ${SCRIPT_DIR}/utils/install_nfs.sh + + ${SCRIPT_DIR}/ova/setup.sh + ;; *) echo "provider ${PROVIDER_NAME} set incorrectly" exit 5 diff --git a/cluster/providers/ova/setup.sh b/cluster/providers/ova/setup.sh new file mode 100755 index 0000000..b78fa2a --- /dev/null +++ b/cluster/providers/ova/setup.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -ex + +export NFS_IP_ADDRESS=$(ip route get 8.8.8.8 | awk '{ print $7 }' | head -1) +export NFS_SHARE="/home/nfsshare" + +ova_file_url="https://github.com/kubev2v/forkliftci/releases/download/v8.0/vm.ova" + +# Download the file and check if the copy was successful +echo "The VM ova file download started." +wget -P "$NFS_SHARE" "$ova_file_url" +if [ $? -eq 0 ]; then + echo "OVA file copied successfully to NFS share." +else + echo "Error: OVA file copy failed." +fi + +# deploy csi-driver-nfs +cluster/providers/utils/deploy_csi_driver_nfs.sh "${NFS_IP_ADDRESS}" "${NFS_SHARE}" \ No newline at end of file diff --git a/cluster/providers/openstack/install_nfs.sh b/cluster/providers/utils/install_nfs.sh similarity index 100% rename from cluster/providers/openstack/install_nfs.sh rename to cluster/providers/utils/install_nfs.sh From ac5e7c1d35192aee8981ffb395bdd49ed6e2d804 Mon Sep 17 00:00:00 2001 From: Bella Khizgiyaev Date: Tue, 24 Oct 2023 12:36:43 +0300 Subject: [PATCH 2/4] Fix ova CI setup Signed-off-by: Bella Khizgiyaev --- BUILD_AND_INSTALL_FORKLIFT_ON_KIND.md | 2 +- build_forklift_bazel.sh | 2 +- cluster/providers/ova/setup.sh | 27 +++++++++++++++++++++++---- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/BUILD_AND_INSTALL_FORKLIFT_ON_KIND.md b/BUILD_AND_INSTALL_FORKLIFT_ON_KIND.md index 2603ec8..526573f 100644 --- a/BUILD_AND_INSTALL_FORKLIFT_ON_KIND.md +++ b/BUILD_AND_INSTALL_FORKLIFT_ON_KIND.md @@ -46,7 +46,7 @@ it is possible to install the following source providers as part of k8s kind clu - [VMware - vcsim](https://github.com/vmware/govmomi/blob/main/vcsim/README.md) - [OpenStack - packstack](https://github.com/kubev2v/packstack-img) - [oVirt - fakeovirt and ovirt-imageio](https://github.com/kubev2v/fakeovirt) -- [OVA - NFS share setup and copying OVA files]() +- OVA - NFS share setup and copying OVA files Run the script: diff --git a/build_forklift_bazel.sh b/build_forklift_bazel.sh index 085332d..d277009 100755 --- a/build_forklift_bazel.sh +++ b/build_forklift_bazel.sh @@ -69,7 +69,7 @@ if [ "${PROVIDER_NAME}" = "vsphere" ]; then fi if [ "${PROVIDER_NAME}" = "ova" ]; then - ACTION_ENV="$ACTION_ENV --action_env VIRT_V2V_IMAGE=quay.io/kubev2v/forklift-virt-v2v-stub:${REGISTRY_TAG} \ + ACTION_ENV="$ACTION_ENV --action_env VIRT_V2V_IMAGE=quay.io/kubev2v/forklift-virt-v2v:${REGISTRY_TAG} \ --action_env VIRT_V2V_DONT_REQUEST_KVM=true \ --action_env OVA_PROVIDER_SERVER_IMAGE=${REGISTRY}/forklift-ova-provider-server:${REGISTRY_TAG}" fi diff --git a/cluster/providers/ova/setup.sh b/cluster/providers/ova/setup.sh index b78fa2a..732c958 100755 --- a/cluster/providers/ova/setup.sh +++ b/cluster/providers/ova/setup.sh @@ -2,19 +2,38 @@ set -ex -export NFS_IP_ADDRESS=$(ip route get 8.8.8.8 | awk '{ print $7 }' | head -1) -export NFS_SHARE="/home/nfsshare" +[ -z "${NFS_IP_ADDRESS}" ] && { echo "Provider cannot be installed - NFS_IP_ADDRESS env required" ; return 2 ;} +[ -z "${NFS_SHARE}" ] && { echo "Provider cannot be installed - NFS_SHARE env required" ; return 2 ;} +nfs_mount_point="/tmp/ova" ova_file_url="https://github.com/kubev2v/forkliftci/releases/download/v8.0/vm.ova" -# Download the file and check if the copy was successful +# Check if the mount point exists, and if not, create it +if [ ! -d "$nfs_mount_point" ]; then + mkdir -p "$nfs_mount_point" +fi + +# Mount the NFS share and check if the mount was successful +sudo mount -t nfs "$NFS_IP_ADDRESS:$NFS_SHARE" "$nfs_mount_point" +if [ $? -eq 0 ]; then + echo "NFS share mounted successfully." +else + echo "Error: NFS share mount failed." + exit 1 +fi + + +# Downloaded the file and check if the copy was successful echo "The VM ova file download started." -wget -P "$NFS_SHARE" "$ova_file_url" +sudo wget -P "$nfs_mount_point" "$ova_file_url" if [ $? -eq 0 ]; then echo "OVA file copied successfully to NFS share." else echo "Error: OVA file copy failed." fi +# Unmount the NFS share +umount "$nfs_mount_point" + # deploy csi-driver-nfs cluster/providers/utils/deploy_csi_driver_nfs.sh "${NFS_IP_ADDRESS}" "${NFS_SHARE}" \ No newline at end of file From 81b82ff38e8012f2a2b9ea27a2f47e15e2be6e5e Mon Sep 17 00:00:00 2001 From: Arik Hadas Date: Sun, 29 Oct 2023 10:06:01 +0200 Subject: [PATCH 3/4] OVA setup: fix unmount Signed-off-by: Arik Hadas --- cluster/providers/ova/setup.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cluster/providers/ova/setup.sh b/cluster/providers/ova/setup.sh index 732c958..6d3a6f8 100755 --- a/cluster/providers/ova/setup.sh +++ b/cluster/providers/ova/setup.sh @@ -24,7 +24,7 @@ fi # Downloaded the file and check if the copy was successful -echo "The VM ova file download started." +echo "Starting to download OVA file." sudo wget -P "$nfs_mount_point" "$ova_file_url" if [ $? -eq 0 ]; then echo "OVA file copied successfully to NFS share." @@ -33,7 +33,7 @@ else fi # Unmount the NFS share -umount "$nfs_mount_point" +sudo umount "$nfs_mount_point" # deploy csi-driver-nfs -cluster/providers/utils/deploy_csi_driver_nfs.sh "${NFS_IP_ADDRESS}" "${NFS_SHARE}" \ No newline at end of file +cluster/providers/utils/deploy_csi_driver_nfs.sh "${NFS_IP_ADDRESS}" "${NFS_SHARE}" From 1c5d247f886255b6d74acdc198b8d5f65371b0d8 Mon Sep 17 00:00:00 2001 From: Arik Hadas Date: Sun, 29 Oct 2023 10:26:51 +0200 Subject: [PATCH 4/4] OVA: download OVA file from forkliftci v9.0 Signed-off-by: Arik Hadas --- cluster/providers/ova/setup.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cluster/providers/ova/setup.sh b/cluster/providers/ova/setup.sh index 6d3a6f8..f4a4d44 100755 --- a/cluster/providers/ova/setup.sh +++ b/cluster/providers/ova/setup.sh @@ -6,7 +6,7 @@ set -ex [ -z "${NFS_SHARE}" ] && { echo "Provider cannot be installed - NFS_SHARE env required" ; return 2 ;} nfs_mount_point="/tmp/ova" -ova_file_url="https://github.com/kubev2v/forkliftci/releases/download/v8.0/vm.ova" +ova_file_url="https://github.com/kubev2v/forkliftci/releases/download/v9.0/vm.ova" # Check if the mount point exists, and if not, create it if [ ! -d "$nfs_mount_point" ]; then