Skip to content

Adapt the scripts and Dockerfile for downstream builds #378

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

Merged
merged 1 commit into from
Mar 17, 2024
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
9 changes: 3 additions & 6 deletions config/peerpods/podvm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ FROM quay.io/openshift_sandboxed_containers/openshift-sandboxed-containers-paylo
# azure-podvm-image-handler.sh script under /scripts/azure-podvm-image-handler.sh
# aws-podvm-image-handler.sh script under /scripts/aws-podvm-image-handler.sh
# sources for cloud-api-adaptor under /src/cloud-api-adaptor
# Binaries like kubectl, packer and yq under /usr/local/bin
# Binaries like kubectl, packer and yq under /usr/local/bin will be installed by the scripts


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

RUN /scripts/azure-podvm-image-handler.sh -- install_rpms
RUN /scripts/azure-podvm-image-handler.sh -- install_cli
RUN /scripts/aws-podvm-image-handler.sh -- install_cli
RUN /scripts/aws-podvm-image-handler.sh -- install_binaries

ARG CAA_SRC
ARG CAA_REF
ARG CAA_SRC=https://github.com/confidential-containers/cloud-api-adaptor
ARG CAA_REF=main
ENV CAA_SRC=$CAA_SRC
ENV CAA_REF=$CAA_REF
RUN git clone ${CAA_SRC} -b ${CAA_REF} /src/cloud-api-adaptor
Expand Down
40 changes: 37 additions & 3 deletions config/peerpods/podvm/podvm-builder.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
#!/bin/bash
#

# Function to install Azure deps
function install_azure_deps() {
echo "Installing Azure deps"
# Install the required packages
/scripts/azure-podvm-image-handler.sh -- install_cli
/scripts/azure-podvm-image-handler.sh -- install_binaries
}

# Function to install AWS deps
function install_aws_deps() {
echo "Installing AWS deps"
# Install the required packages
/scripts/aws-podvm-image-handler.sh -- install_cli
/scripts/aws-podvm-image-handler.sh -- install_binaries
}

# Function to check if peer-pods-cm configmap exists
function check_peer_pods_cm_exists() {
if kubectl get configmap peer-pods-cm -n openshift-sandboxed-containers-operator >/dev/null 2>&1; then
Expand Down Expand Up @@ -82,7 +98,6 @@ function delete_podvm_image() {

case "${CLOUD_PROVIDER}" in
azure)

# If IMAGE_ID is not set, then exit
if [ -z "${IMAGE_ID}" ]; then
echo "IMAGE_ID is not set. Skipping the deletion of Azure image"
Expand Down Expand Up @@ -173,8 +188,27 @@ function delete_podvm_image_gallery() {
fi
}

# Call the function to create or delete podvm image based on argument
function display_usage() {
echo "Usage: $0 {create|delete [-f]|delete-gallery [-f]}"
}

# Check if CLOUD_PROVIDER is set to azure or aws
# Install the required dependencies
case "${CLOUD_PROVIDER}" in
azure)
install_azure_deps
;;
aws)
install_aws_deps
;;
*)
echo "CLOUD_PROVIDER is not set to azure or aws"
display_usage
exit 1
;;
esac

# Call the function to create or delete podvm image based on argument
case "$1" in
create)
create_podvm_image
Expand All @@ -186,7 +220,7 @@ delete-gallery)
delete_podvm_image_gallery "$2"
;;
*)
echo "Usage: $0 {create|delete [-f]|delete-gallery [-f]}"
display_usage
exit 1
;;
esac