1
1
#! /bin/bash
2
2
#
3
3
4
+ # Function to install Azure deps
5
+ function install_azure_deps() {
6
+ echo " Installing Azure deps"
7
+ # Install the required packages
8
+ /scripts/azure-podvm-image-handler.sh -- install_cli
9
+ /scripts/azure-podvm-image-handler.sh -- install_binaries
10
+ }
11
+
12
+ # Function to install AWS deps
13
+ function install_aws_deps() {
14
+ echo " Installing AWS deps"
15
+ # Install the required packages
16
+ /scripts/aws-podvm-image-handler.sh -- install_cli
17
+ /scripts/aws-podvm-image-handler.sh -- install_binaries
18
+ }
19
+
4
20
# Function to check if peer-pods-cm configmap exists
5
21
function check_peer_pods_cm_exists() {
6
22
if kubectl get configmap peer-pods-cm -n openshift-sandboxed-containers-operator > /dev/null 2>&1 ; then
@@ -82,7 +98,6 @@ function delete_podvm_image() {
82
98
83
99
case " ${CLOUD_PROVIDER} " in
84
100
azure)
85
-
86
101
# If IMAGE_ID is not set, then exit
87
102
if [ -z " ${IMAGE_ID} " ]; then
88
103
echo " IMAGE_ID is not set. Skipping the deletion of Azure image"
@@ -173,8 +188,27 @@ function delete_podvm_image_gallery() {
173
188
fi
174
189
}
175
190
176
- # Call the function to create or delete podvm image based on argument
191
+ function display_usage() {
192
+ echo " Usage: $0 {create|delete [-f]|delete-gallery [-f]}"
193
+ }
177
194
195
+ # Check if CLOUD_PROVIDER is set to azure or aws
196
+ # Install the required dependencies
197
+ case " ${CLOUD_PROVIDER} " in
198
+ azure)
199
+ install_azure_deps
200
+ ;;
201
+ aws)
202
+ install_aws_deps
203
+ ;;
204
+ * )
205
+ echo " CLOUD_PROVIDER is not set to azure or aws"
206
+ display_usage
207
+ exit 1
208
+ ;;
209
+ esac
210
+
211
+ # Call the function to create or delete podvm image based on argument
178
212
case " $1 " in
179
213
create)
180
214
create_podvm_image
@@ -186,7 +220,7 @@ delete-gallery)
186
220
delete_podvm_image_gallery " $2 "
187
221
;;
188
222
* )
189
- echo " Usage: $0 {create|delete [-f]|delete-gallery [-f]} "
223
+ display_usage
190
224
exit 1
191
225
;;
192
226
esac
0 commit comments