carvel-dev / imgpkg

Store application configuration files in Docker/OCI registries
https://carvel.dev/imgpkg
Apache License 2.0
262 stars 61 forks source link

`imgpkg copy` should work with Inline package manifest #323

Closed blc1996 closed 2 years ago

blc1996 commented 2 years ago

Describe the problem/challenge you have Same issue as: https://github.com/vmware-tanzu/carvel-kapp-controller/issues/490

In kapp-contoller 0.31, a inline field in introduced for package and packageRepository CR. This allows package CR contains all the YTT templates inline, including the .imgpkg/image.yaml file that locks the images.

However, if .imgpkg/image.yaml is put inline inside package CR, imgpkg copy on the packageRepository will not relocate the images listed in .imgpkg/image.yaml for that package CR. The inline.imgpkg/image.yaml will stay unchanged.

Describe the solution you'd like The images in .imgpkg/image.yaml for the inline package should also be resolved and relocated as required by the air gap workflow.

Anything else you would like to add: [Additional information that will assist in solving the issue.] Example inline package: Under template.spec.fectch.inline[0] are the YTT template files for this package bundle

apiVersion: data.packaging.carvel.dev/v1alpha1
kind: Package
metadata:
  name: metrics-server.tanzu.vmware.com.0.5.1+vmware.1-tkg.1
spec:
  refName: metrics-server.tanzu.vmware.com
  version: 0.5.1+vmware.1-tkg.1
  releaseNotes: metrics-server 0.5.1 https://github.com/kubernetes-sigs/metrics-server/releases/tag/v0.5.1
  licenses:
  - 'VMware’s End User License Agreement (Underlying OSS license: Apache License 2.0)'
  template:
    spec:
      fetch:
      - inline:
          paths:
            .imgpkg/images.yml: |-
              ---
              apiVersion: imgpkg.carvel.dev/v1alpha1
              images:
              - annotations:
                  kbld.carvel.dev/id: k8s.gcr.io/metrics-server/metrics-server:v0.5.1
                  kbld.carvel.dev/origins: |
                    - resolved:
                        tag: v0.5.1
                        url: k8s.gcr.io/metrics-server/metrics-server:v0.5.1
                image: k8s.gcr.io/metrics-server/metrics-server@sha256:3ae6366cbeab73860a4f4a297e82134c1531bbe766d70cf677a7ba2e84d412d0
              kind: ImagesLock
            config/overlays/overlay-deployment.yaml: |-
                ......
            config/upstream/components.yaml: |-
              ......
      template:
      - ytt:
          paths:
          - config/
          ignoreUnknownComments: true
      - kbld:
          paths:
          - '-'
          - .imgpkg/images.yml
      deploy:
      - kapp:
          rawOptions:
          - --wait-timeout=30s
          - --kube-api-qps=20
          - --kube-api-burst=30
  releasedAt: "2022-01-24T22:44:48Z"
  valuesSchema:
    openAPIv3:
      title: metrics-server.tanzu.vmware.com.0.5.1+vmware.1-tkg.1 values schema

This package CR is put under a package repository like

.
└── packages
    └── metrics-server.tanzu.vmware.com
        ├── 0.5.1+vmware.1-tkg.1-rc.4.yml
        └── metadata.yml

Vote on this request

This is an invitation to the community to vote on issues, to help us prioritize our backlog. Use the "smiley face" up to the right of this comment to vote.

👍 "I would like to see this addressed as soon as possible" 👎 "There are other more important things to focus on right now"

We are also happy to receive and review Pull Requests if you want to help working on this issue.

github-actions[bot] commented 2 years ago

This issue is being marked as stale due to a long period of inactivity and will be closed in 5 days if there is no response.