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

GCP image generation #519

Draft
wants to merge 5 commits into
base: devel
Choose a base branch
from

Conversation

beraldoleal
Copy link
Member

- Description of the problem which is fixed/What is the use case

In order to support GCP with the next release, we need to generate the images automatically in case image is not configured by the user.

- What I did
I followed the same approach used by aws and azure. This is a WiP.

- How to verify it

WiP

- Description for the changelog

Added support for a new cloud provider: Google Cloud Platform (GCP).

@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 31, 2025
Copy link

openshift-ci bot commented Jan 31, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@beraldoleal beraldoleal force-pushed the gcp-image-generation branch 2 times, most recently from 65ab1f5 to be748fd Compare February 4, 2025 22:39
@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 4, 2025
Those scripts are needed the same way we do with azure and aws.

Signed-off-by: Beraldo Leal <[email protected]>
This is not installing when running the docker locally. Propably I will
drop this commit.

Signed-off-by: Beraldo Leal <[email protected]>
Those methods will be duplicated again with GCP, lets centralize them
inside lib.sh.

Signed-off-by: Beraldo Leal <[email protected]>
This is temporary, podman-docker doesn't have docker buildx ...

Signed-off-by: Beraldo Leal <[email protected]>
Signed-off-by: Beraldo Leal <[email protected]>
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 4, 2025

# TODO: This means we are installing the azure rpms for all providers?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no, by following it you'll see it's actually installing general set of binaries, i'm not sure it's implemented like, it may need a fix

# Ensure CLOUD_PROVIDER is set to gcp
[[ -z "${CLOUD_PROVIDER}" || "${CLOUD_PROVIDER}" != "gcp" ]] && error_exit "CLOUD_PROVIDER is empty or not set to gcp"

[[ -z "${AWS_ACCESS_KEY_ID}" ]] && error_exit "AWS_ACCESS_KEY_ID is not set"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove all the aws related vars


# Download gcloud cli
# TODO
tee -a /etc/yum.repos.d/google-cloud-sdk.repo << EOM
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent left?

tar -cvzf build/disk.tar.gz -C build disk.raw

# Create bucket if doesn't exist
export GCP_REGION="us-central1"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the only region supported or bucket is available in all regions?

echo "${GCP_IMAGE_NAME} created successfully"
}

# Function to create or update podvm-images configmap with all the amis
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be removed i suppose..

# Create bucket if doesn't exist
export GCP_REGION="us-central1"
export GCP_BUCKET_NAME="peerpods-bucket"
if ! gsutil ls -b "gs://${GCP_BUCKET_NAME}/" &>/dev/null; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd encapsulate the uploading part and image creation part to different function as it may be useful to the uploading disk images that comes from other sources (bootc, user's image etc..)

Copy link
Contributor

@snir911 snir911 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this!, I added a few comments

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants