Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce the e2e test setup for OVA providers. #111

Merged
merged 4 commits into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions BUILD_AND_INSTALL_FORKLIFT_ON_KIND.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -63,6 +64,7 @@ when `<provider-name>` can be one of those:
| INSTALL_NFS | install nfs server locally | |

- vsphere
- ova
- all


Expand Down
9 changes: 8 additions & 1 deletion build_forklift_bazel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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:${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 \
Expand Down
17 changes: 13 additions & 4 deletions cluster/providers/install-provider.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
;;
Expand All @@ -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

Expand All @@ -48,14 +50,21 @@ 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

#create sample VMs and volume disks for the tests
${SCRIPT_DIR}/openstack/create_test_vms.sh
;;
"ova")
bkhizgiy marked this conversation as resolved.
Show resolved Hide resolved
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
Expand Down
39 changes: 39 additions & 0 deletions cluster/providers/ova/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

set -ex

[ -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/v9.0/vm.ova"

# 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
bkhizgiy marked this conversation as resolved.
Show resolved Hide resolved
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."
else
echo "Error: OVA file copy failed."
fi

# Unmount the NFS share
sudo umount "$nfs_mount_point"

# deploy csi-driver-nfs
cluster/providers/utils/deploy_csi_driver_nfs.sh "${NFS_IP_ADDRESS}" "${NFS_SHARE}"