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

🐛 crdgen: compare metav1 pkg by ID #686

Conversation

k8s-infra-cherrypick-robot

This is an automated cherry-pick of #681

/assign alvaroaleman

akutz and others added 2 commits May 31, 2022 14:25
This patch updates the way the CRD generator compares an imported
metav1 package. Previously the comparison occurred using a Golang
equality operator, !=, against two, in-memory data structures.
However, this fails when multiple root paths are loaded. Their
metav1 packages are identical, just not identical objects in
memory. This patch updates the comparison to compare the package
IDs, not the instance of the object.

This patch also introduces a filesystem-path specific loader for
each unique filesystem path provided as a root. This ensures the
AST is loaded correctly and the kubebuilder markers are parsed as
intended.
This patch adds tests to reproduce the issue of the markers
not being discovered when multiple paths are used.

The issue is not markers missing from a type, but markers missing
from a *referenced* type. For example, the new Job type imports
the unserved.CronJobSpec as the field Job.Spec.CronJob. The
markers are not generated for Job.Spec.CronJob as it is referenced
from another package.
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 31, 2022
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 31, 2022
@alvaroaleman
Copy link
Member

/retitle 🐛 crdgen: compare metav1 pkg by ID

@k8s-ci-robot k8s-ci-robot changed the title [release-0.9] 🐛 crdgen: compare metav1 pkg by ID 🐛 crdgen: compare metav1 pkg by ID May 31, 2022
@alvaroaleman
Copy link
Member

/label tide/merge-method-squash
/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. lgtm "Looks good to me", indicates that a PR is ready to be merged. labels May 31, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alvaroaleman, k8s-infra-cherrypick-robot

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 31, 2022
@k8s-ci-robot k8s-ci-robot merged commit 3c8b410 into kubernetes-sigs:release-0.9 May 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants