Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

Generate Package Custom Resource when Package Bundle is Created #2199

Conversation

codegold79
Copy link
Contributor

@codegold79 codegold79 commented Apr 20, 2022

What this PR does / why we need it

This PR makes changes to package tooling to also generate Package CR when the package bundle is being created.

Merge this PR after PR #2187 (generate thick tarball)

Which issue(s) this PR fixes

Fixes #2158

Describe testing done for PR

make local-registry
PACKAGE_NAME=featuregates PACKAGE_REPOSITORY=management OCI_REGISTRY=${OCI_REGISTRY} make package-bundle

Screen Shot 2022-04-20 at 4 34 33 PM

PACKAGE_REPOSITORY=standalone OCI_REGISTRY=${OCI_REGISTRY} make package-bundles

Screen Shot 2022-04-20 at 4 33 43 PM

PACKAGE_SUB_VERSION=vmw.8-0 PACKAGE_NAME=featuregates PACKAGE_REPOSITORY=management make package-bundle     

Screen Shot 2022-04-26 at 11 18 10 AM

Release note

Package tooling generates Package CR when package bundle is being created

PR Checklist

  • Squash the commits into one or a small number of logical commits
  • Use good commit messages
  • Ensure PR contains terms all contributors can understand and links all contributors can access

Additional information

Special notes for your reviewer

yharish991 and others added 2 commits April 22, 2022 07:26
Signed-off-by: Harish Yayi <yharish991@gmail.com>
Signed-off-by: F. Gold <fgold@vmware.com>
@codegold79 codegold79 force-pushed the 2158-Generate-Package-CR-when-package-bundle-is-created branch from 6180c7a to 0607c41 Compare April 22, 2022 14:26
@codegold79
Copy link
Contributor Author

codegold79 commented Apr 25, 2022

@danniel1205 was worried about images: null showing up in his playground example:

image

I can provide the assurance that in our code, images is not null. You can see for yourself when you run the following ytt command in the project root:

$ ytt -f hack/packages/templates/repo-utils/images-tmpl.yaml -f hack/packages/templates/repo-utils/package-helpers.lib.yaml -f packages/package-values.yaml -v packageRepository=management -v registry=dockerhub.frankie
apiVersion: imgpkg.carvel.dev/v1alpha1
images:
- annotations:
    kbld.carvel.dev/id: dockerhub.frankie/featuregates:vlatest
  image: dockerhub.frankie/featuregates@sha256:featuregates:latest
- annotations:
    kbld.carvel.dev/id: dockerhub.frankie/cliplugins:vlatest
  image: dockerhub.frankie/cliplugins@sha256:cliplugins:latest
- annotations:
    kbld.carvel.dev/id: dockerhub.frankie/core-management-plugins:vlatest
  image: dockerhub.frankie/core-management-plugins@sha256:core-management-plugins:latest
- annotations:
    kbld.carvel.dev/id: dockerhub.frankie/addons-manager-v2:vlatest
  image: dockerhub.frankie/addons-manager-v2@sha256:addons-manager-v2:latest
- annotations:
    kbld.carvel.dev/id: dockerhub.frankie/tkg:vlatest
  image: dockerhub.frankie/tkg@sha256:tkg:latest
- annotations:
    kbld.carvel.dev/id: dockerhub.frankie/tkg-clusterclass:vlatest
  image: dockerhub.frankie/tkg-clusterclass@sha256:tkg-clusterclass:latest
- annotations:
    kbld.carvel.dev/id: dockerhub.frankie/tkg-clusterclass-docker:vlatest
  image: dockerhub.frankie/tkg-clusterclass-docker@sha256:tkg-clusterclass-docker:latest
- annotations:
    kbld.carvel.dev/id: dockerhub.frankie/tkg-clusterclass-azure:vlatest
  image: dockerhub.frankie/tkg-clusterclass-azure@sha256:tkg-clusterclass-azure:latest
- annotations:
    kbld.carvel.dev/id: dockerhub.frankie/tkg-clusterclass-vsphere:vlatest
  image: dockerhub.frankie/tkg-clusterclass-vsphere@sha256:tkg-clusterclass-vsphere:latest
- annotations:
    kbld.carvel.dev/id: dockerhub.frankie/tkg-clusterclass-aws:vlatest
  image: dockerhub.frankie/tkg-clusterclass-aws@sha256:tkg-clusterclass-aws:latest
- annotations:
    kbld.carvel.dev/id: dockerhub.frankie/tkr-aws-machine-webhook:vlatest
  image: dockerhub.frankie/tkr-aws-machine-webhook@sha256:tkr-aws-machine-webhook:latest
- annotations:
    kbld.carvel.dev/id: dockerhub.frankie/tkr-azure-machine-webhook:vlatest
  image: dockerhub.frankie/tkr-azure-machine-webhook@sha256:tkr-azure-machine-webhook:latest
- annotations:
    kbld.carvel.dev/id: dockerhub.frankie/tkr-docker-machine-webhook:vlatest
  image: dockerhub.frankie/tkr-docker-machine-webhook@sha256:tkr-docker-machine-webhook:latest
- annotations:
    kbld.carvel.dev/id: dockerhub.frankie/tkr-vsphere-machine-webhook:vlatest
  image: dockerhub.frankie/tkr-vsphere-machine-webhook@sha256:tkr-vsphere-machine-webhook:latest
- annotations:
    kbld.carvel.dev/id: dockerhub.frankie/tkr-service:vlatest
  image: dockerhub.frankie/tkr-service@sha256:tkr-service:latest
- annotations:
    kbld.carvel.dev/id: dockerhub.frankie/framework:vlatest
  image: dockerhub.frankie/framework@sha256:framework:latest
kind: ImagesLock

The difference between Daniel's example and our code are several.

For one, in @danniel1205 's playgound, he has the following in the first line of the data-values.yml file:

#@data/values-schema

That line needs to be changed to what it is in packages/package-values.yaml#L1.

#@data/values

Having values-schema forces the images attribute to be a default empty array.

Another difference is that Daniel is missing the array items the contain annotations and image sections. These are available in our code in the images-tmpl.yaml file. Given those, the images attribute will be populated with array items that contain annotations and images.

I am also just learning about YTT and what all it can do. I'm still not certain how it all works, but I'm learning that even the first line, whether it is values-schema or values makes a big difference.

@codegold79 codegold79 requested a review from danniel1205 April 25, 2022 23:31
@danniel1205 danniel1205 added the ok-to-merge PRs should be labelled with this before merging label Apr 26, 2022
Copy link
Contributor

@danniel1205 danniel1205 left a comment

Choose a reason for hiding this comment

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

LGTM

@codegold79 codegold79 force-pushed the 2158-Generate-Package-CR-when-package-bundle-is-created branch 2 times, most recently from cd0271a to 1941863 Compare April 26, 2022 18:23
Signed-off-by: F. Gold <fgold@vmware.com>
@codegold79 codegold79 force-pushed the 2158-Generate-Package-CR-when-package-bundle-is-created branch from 1941863 to 880681d Compare April 26, 2022 19:48
Copy link
Member

@yharish991 yharish991 left a comment

Choose a reason for hiding this comment

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

LGTM

@codegold79 codegold79 merged commit 9135b9e into vmware-tanzu:main Apr 27, 2022
chandrareddyp pushed a commit to chandrareddyp/tanzu-framework that referenced this pull request Apr 28, 2022
…re-tanzu#2199)

* generate Package CR when package bundle is generated

Signed-off-by: Harish Yayi <yharish991@gmail.com>

* Address golang-ci lint failed checks

Signed-off-by: F. Gold <fgold@vmware.com>

* Fix bug and pick up subversion from package values or flag

Signed-off-by: F. Gold <fgold@vmware.com>

Co-authored-by: Harish Yayi <yharish991@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla-not-required ok-to-merge PRs should be labelled with this before merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generate Package CR when package bundle is created
5 participants