kubernetes-sigs / cluster-api-provider-gcp

The GCP provider implementation for Cluster API
Apache License 2.0
178 stars 194 forks source link

Figure out how to publish images #152

Open vincepri opened 5 years ago

vincepri commented 5 years ago

/kind design

Describe the solution you'd like Currently, the image building lives in https://github.com/kubernetes-sigs/image-builder/tree/master/images/capi/packer/gce. We don't have a good way to share images with users yet and I'm not totally sure if it's possible in GCP to make images of a project public.

This issue needs a little bit more investigation, in the mean time, we can ask users to build their own images as part of the quick start.

/cc @justinsb

sara4dev commented 5 years ago

we could create a virtual disk and share it from public GCS bucket. And users can create custom images by importing the virtual disks - https://cloud.google.com/compute/docs/import/importing-virtual-disks

alejandrox1 commented 5 years ago

I'd like to help out with this one /assign

vincepri commented 5 years ago

/assign @justinsb

fejta-bot commented 4 years ago

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close.

If this issue is safe to close now please do so with /close.

Send feedback to sig-testing, kubernetes/test-infra and/or fejta. /lifecycle stale

vincepri commented 4 years ago

/lifecycle frozen

asatish commented 3 years ago

I found a way to mark images for public consumption and how to use public images

To mark an image for public consumption: https://cloud.google.com/compute/docs/images/managing-access-custom-images#share-images-publicly

gcloud compute images add-iam-policy-binding image-name \ --member='allAuthenticatedUsers' \ --role='roles/compute.imageUser'

To use an image which is public: https://cloud.google.com/compute/docs/images/managing-access-custom-images#accessing_images

The project which has the image needs to be explicitly specified gcloud compute instances create test-instance \ --image database-image-a --image-project database-images

cpanato commented 3 years ago

i'm doing some work on this

/assign

tpdownes commented 2 years ago

Here's a basic example of how to do this with post-processors:

  post-processor "manifest" {}

  post-processor "shell-local" {
    inline = [
      "IMAGE=$(jq -r \".builds[-1].artifact_id\" packer-manifest.json)",
      "gcloud compute images add-iam-policy-binding $${IMAGE} --project=${var.project_id} --member='allAuthenticatedUsers' --role='roles/compute.imageUser'",
    ]

You can specify the manifest file using output in the first block.

sathieu commented 2 years ago

What is the status of this? Any image publicly available?

cpanato commented 2 years ago

we publish some nightly images that we rebuild everyday, if you want i can share the project and maybe you can copy from there for your own project

sathieu commented 2 years ago

@cpanato Thanks. Could the image be made public as per https://github.com/kubernetes-sigs/cluster-api-provider-gcp/issues/152#issuecomment-738339787?

cpanato commented 2 years ago

@sathieu sorry for the delay, the images are public in the gcp project k8s-staging-cluster-api-gcp i will check how we can make that a general available inside the gcp cloud

sathieu commented 2 years ago

Thanks @cpanato. I've not found (yet) how to access those images ...

cpanato commented 2 years ago

you can check here https://github.com/kubernetes-sigs/cluster-api-provider-gcp/blob/main/scripts/ci-e2e.sh#L56 we export the IMAGE_ID and then you can use to bootstrap the cluster