vmware-labs / distribution-tooling-for-helm

Helm Distribution plugin is is a set of utilities and Helm Plugin for making offline work with Helm Charts easier. It is meant to be used for creating reproducible and relocatable packages for Helm Charts that can be moved around registries without hassles. This is particularly useful for distributing Helm Charts into airgapped environments.
Apache License 2.0
64 stars 10 forks source link

Relocating to dockerhub #68

Open DanielePalaia opened 1 month ago

DanielePalaia commented 1 month ago

Describe the bug

HI team,

I'm trying to do a few tests with this tool.

In particular I'm trying to wrap the bitnami rabbitmq-cluster-operator chart and unwrap it in my docker personal repo and in the harbor registry.

While in harbor seems working fine when unwrapping to dockerhub it is failing probably because it is considering repo like:

danielepalaia/bitnami/rabbitmq

which are maybe not supported in dockerhub

Reproduction steps

  1. helm dt wrap oci://docker.io/bitnamicharts/rabbitmq-cluster-operator
  2. helm dt unwrap rabbitmq-cluster-operator-4.3.1.wrap.tgz dev.registry.tanzu.vmware.com/rabbitmq (Working OK)
  3. helm dt unwrap rabbitmq-cluster-operator-4.3.1.wrap.tgz index.docker.io/danielepalaia (Failing)
  4. »  Unwrapping Helm chart "rabbitmq-cluster-operator-4.3.1.wrap.tgz"
    ✔  Helm chart uncompressed to "/var/folders/xq/77hzjpzj2h30fjsrz150jf_r0000gq/T/chart-3354106984/dt-wrap4225753514"                                                                                                                                                       
    ✔  Helm chart relocated successfully                                                                                                                                                                                                                                      
    »  The wrap includes the following 4 images:
    
       index.docker.io/danielepalaia/bitnami/rabbitmq:3.13.2-debian-12-r4
       index.docker.io/danielepalaia/bitnami/rabbitmq-cluster-operator:2.9.0-debian-12-r1
       index.docker.io/danielepalaia/bitnami/rmq-default-credential-updater:1.0.4-debian-12-r20
       index.docker.io/danielepalaia/bitnami/rmq-messaging-topology-operator:1.14.1-debian-12-r1
    
    Do you want to push the wrapped images to the OCI registry? [y/N]: Yes
    »  Pushing Images
       Pushing image "index.docker.io/danielepalaia/bitnami/rabbitmq:3.13.2-debian-12-r4"                                                                                                     [1/4] ████████████████████████████████████████████████████████████████  25% | 0s
       Pushing image "index.docker.io/danielepalaia/bitnami/rabbitmq:3.13.2-debian-12-r4"                                                                                                     [1/4] ████████████████████████████████████████████████████████████████  25% | 2s       WARNING  Failed to push image: retrying 1/3
       Pushing image "index.docker.io/danielepalaia/bitnami/rabbitmq:3.13.2-debian-12-r4"                                                                                                     [1/4] ████████████████████████████████████████████████████████████████  25% | 4s       WARNING  Failed to push image: retrying 2/3
       Pushing image "index.docker.io/danielepalaia/bitnami/rabbitmq:3.13.2-debian-12-r4"                                                                                                     [1/4] ████████████████████████████████████████████████████████████████  25% | 5s       WARNING  Failed to push image: retrying 3/3
    ✘  Failed to push images: failed to push image "rabbitmq": failed to write image index: HEAD https://index.docker.io/v2/danielepalaia/bitnami/rabbitmq/manifests/3.13.2-debian-12-r4: unexpected status code 401 Unauthorized (HEAD responses have no body, use GET for details)
    Failed to push images: failed to push image "rabbitmq": failed to write image index: HEAD https://index.docker.io/v2/danielepalaia/bitnami/rabbitmq/manifests/3.13.2-debian-12-r4: unexpected status code 401 Unauthorized (HEAD responses have no body, use GET for details)

Permissions are good because I can push in this repo

Expected behavior

I think the issue is that the tool happend automatically the /bitnami/ in the path so the output repo becomes:

index.docker.io/danielepalaia/bitnami/

which I think is not supported by dockerhub

Is there anyway to avoid this and just leave index.docker.io/danielepalaia?

Additional context

No response

beltran-rubo commented 1 month ago

Hi,

That is correct, DockerHub does not support sub-URI for the image registries. The Helm dt command keeps the 'repository' option from the 'values.yaml' to locate the container images and avoid collision with the Helm chart OCI.

DanielePalaia commented 1 month ago

Hey thanks for the fast reply,

any possibility or plans to add this kind of support maybe with a specific command line option (if we don't want to change the default behaviour)?

beltran-rubo commented 1 month ago

Not at this moment but any contribution will be welcome.