Skip to content

Commit

Permalink
Fix CI setup for OVA provider
Browse files Browse the repository at this point in the history
Signed-off-by: Bella Khizgiyaev <[email protected]>
  • Loading branch information
bkhizgiy authored and bennyz committed Nov 16, 2023
1 parent c0c9d01 commit 83811b6
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions cluster/providers/ova/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,10 @@ 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"
# Create a temporary directory for the NFS mount point
nfs_mount_point=$(mktemp -d)
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
Expand All @@ -22,9 +18,8 @@ else
exit 1
fi


# Downloaded the file and check if the copy was successful
echo "Starting to download OVA file."
# Download the file and check if the copy was successful
echo "The VM ova file download started."
sudo wget -P "$nfs_mount_point" "$ova_file_url"
if [ $? -eq 0 ]; then
echo "OVA file copied successfully to NFS share."
Expand All @@ -35,5 +30,8 @@ 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}"
# Remove the temporary directory
rm -rf "$nfs_mount_point"

# Deploy csi-driver-nfs
kubectl get StorageClass nfs-csi 2>/dev/null || cluster/providers/utils/deploy_csi_driver_nfs.sh "${NFS_IP_ADDRESS}" "${NFS_SHARE}"

0 comments on commit 83811b6

Please sign in to comment.