Skip to content

feat: generate crd with version annotation. #1134

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

Merged
merged 21 commits into from
Jul 18, 2025

Conversation

zetxqx
Copy link
Contributor

@zetxqx zetxqx commented Jul 10, 2025

Add the CRD annotation for gateway-api-inferecence-extention CRD

The generator is mostly copied from https://github.com/kubernetes-sigs/gateway-api/blob/main/pkg/generator/main.go but removed the channel support. Since the version is needed for conformance tests. I removed the channel support to make this a minimum change.

@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 10, 2025
Copy link

netlify bot commented Jul 10, 2025

Deploy Preview for gateway-api-inference-extension ready!

Name Link
🔨 Latest commit 6f7c774
🔍 Latest deploy log https://app.netlify.com/projects/gateway-api-inference-extension/deploys/6879f919f700fa00084e6294
😎 Deploy Preview https://deploy-preview-1134--gateway-api-inference-extension.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 10, 2025
@k8s-ci-robot k8s-ci-robot requested review from ahg-g and robscott July 10, 2025 00:04
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 10, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @zetxqx. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jul 10, 2025
@capri-xiyue
Copy link
Contributor

capri-xiyue commented Jul 10, 2025

I guess with this self-written code generator approach, you need to change the Makefile, based on my experience, currently all generated code relies on make manifests and make generate, when the pipeline runs tests, it will call these two make command to re-generate all the files. Probably you need to change hack/update-codegen.sh

@zetxqx zetxqx changed the title [WIP] generate crd with version annotation. feat: generate crd with version annotation. Jul 10, 2025
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 10, 2025
@nirrozenbaum
Copy link
Contributor

@zetxqx can you please explain the motivation behind this PR? why should we move from a the common code generation libraries which are widely used in the community to having our own code for generation?

@zetxqx
Copy link
Contributor Author

zetxqx commented Jul 10, 2025

@zetxqx can you please explain the motivation behind this PR? why should we move from a the common code generation libraries which are widely used in the community to having our own code for generation?

@nirrozenbaum I was following what we have in the gateway-api(https://github.com/kubernetes-sigs/gateway-api/blob/main/pkg/generator/main.go) Currently we only have one active version and do not have any channels so this PR does not have much benefits. However, if we have more channels and versions to maintain, the benefit is we can have a single place to "consts.go" in this PR to change the version related stuff.

CC: @robscott

@capri-xiyue
Copy link
Contributor

capri-xiyue commented Jul 10, 2025

@zetxqx can you please explain the motivation behind this PR? why should we move from a the common code generation libraries which are widely used in the community to having our own code for generation?

@nirrozenbaum I was following what we have in the gateway-api(https://github.com/kubernetes-sigs/gateway-api/blob/main/pkg/generator/main.go) Currently we only have one active version and do not have any channels so this PR does not have much benefits. However, if we have more channels and versions to maintain, the benefit is we can have a single place to "consts.go" in this PR to change the version related stuff.

CC: @robscott

If we want to keep the common code generation libraries which are widely used in the community, one approach I can think of is that keep the pkg/consts.go and let conformance test use it, make sure that the version in pkg.consts.go be the same with the version in kubebuilder annotation comment.

@zetxqx zetxqx requested a review from capri-xiyue July 10, 2025 22:20
Copy link
Member

@robscott robscott left a comment

Choose a reason for hiding this comment

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

Thanks @zetxqx!

RELEASE.md Outdated
@@ -2,6 +2,7 @@

The Kubernetes Template Project is released on an as-needed basis. The process is as follows:

1. Update `pkg/consts/consts.go` with the new semver tag.
Copy link
Member

Choose a reason for hiding this comment

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

After this they'll also have to manually regenerate the CRDs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated! @robscott could you please take a look? I mostly copy pasted from the gateway api here.

Copy link
Member

@robscott robscott left a comment

Choose a reason for hiding this comment

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

Thanks @zetxqx!

@@ -95,12 +95,8 @@ help: ## Display this help.

##@ Development

.PHONY: manifests
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
Copy link
Member

Choose a reason for hiding this comment

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

@kfswain @nirrozenbaum Do you need anything beyond CRDs that could have been generated here? (I'm assuming not, certainly not a webhook, and probably not RBAC, but just want to make sure I'm not missing some EPP dependencies here).

Copy link
Contributor

Choose a reason for hiding this comment

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

nothing that I'm aware of.
sorry for the delayed response, missed the question.

@zetxqx
Copy link
Contributor Author

zetxqx commented Jul 14, 2025

/hold

hold to coordinate with #1156 not affecting the review

cc: @capri-xiyue

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 14, 2025
@capri-xiyue
Copy link
Contributor

capri-xiyue commented Jul 15, 2025

/hold

hold to coordinate with #1156 not affecting the review

cc: @capri-xiyue

@zetxqx #1156 got merged. Seems like you need to merge with the main branch and then run make generateto generate the CRD again.

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 15, 2025
@k8s-ci-robot k8s-ci-robot removed lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. labels Jul 18, 2025
@zetxqx zetxqx requested a review from nirrozenbaum July 18, 2025 07:35
@nirrozenbaum
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jul 18, 2025
@k8s-ci-robot k8s-ci-robot merged commit f6707d0 into kubernetes-sigs:main Jul 18, 2025
9 checks passed
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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants