Skip to content

Commit 68fb041

Browse files
authored
Merge pull request #378 from bpradipt/podvm-builder
Adapt the scripts and Dockerfile for downstream builds
2 parents 721edad + 7d3ef54 commit 68fb041

File tree

2 files changed

+40
-9
lines changed

2 files changed

+40
-9
lines changed

Diff for: config/peerpods/podvm/Dockerfile

+3-6
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ FROM quay.io/openshift_sandboxed_containers/openshift-sandboxed-containers-paylo
44
# azure-podvm-image-handler.sh script under /scripts/azure-podvm-image-handler.sh
55
# aws-podvm-image-handler.sh script under /scripts/aws-podvm-image-handler.sh
66
# sources for cloud-api-adaptor under /src/cloud-api-adaptor
7-
# Binaries like kubectl, packer and yq under /usr/local/bin
7+
# Binaries like kubectl, packer and yq under /usr/local/bin will be installed by the scripts
88

99

1010
FROM registry.access.redhat.com/ubi9/ubi:9.3
@@ -18,12 +18,9 @@ COPY --from=payload /podvm-binaries.tar.gz /payload/
1818
ADD lib.sh aws-podvm-image-handler.sh azure-podvm-image-handler.sh /scripts/
1919

2020
RUN /scripts/azure-podvm-image-handler.sh -- install_rpms
21-
RUN /scripts/azure-podvm-image-handler.sh -- install_cli
22-
RUN /scripts/aws-podvm-image-handler.sh -- install_cli
23-
RUN /scripts/aws-podvm-image-handler.sh -- install_binaries
2421

25-
ARG CAA_SRC
26-
ARG CAA_REF
22+
ARG CAA_SRC=https://github.com/confidential-containers/cloud-api-adaptor
23+
ARG CAA_REF=main
2724
ENV CAA_SRC=$CAA_SRC
2825
ENV CAA_REF=$CAA_REF
2926
RUN git clone ${CAA_SRC} -b ${CAA_REF} /src/cloud-api-adaptor

Diff for: config/peerpods/podvm/podvm-builder.sh

+37-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,22 @@
11
#!/bin/bash
22
#
33

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+
420
# Function to check if peer-pods-cm configmap exists
521
function check_peer_pods_cm_exists() {
622
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() {
8298

8399
case "${CLOUD_PROVIDER}" in
84100
azure)
85-
86101
# If IMAGE_ID is not set, then exit
87102
if [ -z "${IMAGE_ID}" ]; then
88103
echo "IMAGE_ID is not set. Skipping the deletion of Azure image"
@@ -173,8 +188,27 @@ function delete_podvm_image_gallery() {
173188
fi
174189
}
175190

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+
}
177194

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
178212
case "$1" in
179213
create)
180214
create_podvm_image
@@ -186,7 +220,7 @@ delete-gallery)
186220
delete_podvm_image_gallery "$2"
187221
;;
188222
*)
189-
echo "Usage: $0 {create|delete [-f]|delete-gallery [-f]}"
223+
display_usage
190224
exit 1
191225
;;
192226
esac

0 commit comments

Comments
 (0)