Skip to content

Modernize API markers: Replace immutable CEL validation rules with +k8s:immutable marker - #4902

Open
chinmaychahar wants to merge 3 commits into
kubernetes-sigs:mainfrom
chinmaychahar:modernize-api-markers
Open

Modernize API markers: Replace immutable CEL validation rules with +k8s:immutable marker#4902
chinmaychahar wants to merge 3 commits into
kubernetes-sigs:mainfrom
chinmaychahar:modernize-api-markers

Conversation

@chinmaychahar

@chinmaychahar chinmaychahar commented May 25, 2026

Copy link
Copy Markdown

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

Replaces the self == oldSelf CEL XValidation rules with the controller-tools 0.21.0 +k8s:immutable marker on:

  • GatewayClass.controllerName
  • XMesh.controllerName

These are the only two occurrences of this pattern. Scoped to immutability only for now; can follow upAtMostOneOf separately

Which issue(s) this PR fixes:

Ref #4834

Does this PR introduce a user-facing change?:

NONE

Currently, the immutability validation message for GatewayClass.spec.controllerName changed from "Value is immutable" to "field is immutable"

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

Adding the "do-not-merge/release-note-label-needed" label because no release-note block was detected, please follow our release note process to remove it.

Details

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 kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels May 25, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: chinmaychahar
Once this PR has been reviewed and has the lgtm label, please assign thockin for approval. For more information see the Code Review Process.

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

Details 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

@linux-foundation-easycla

linux-foundation-easycla Bot commented May 25, 2026

Copy link
Copy Markdown

CLA Signed
The committers listed above are authorized under a signed CLA.

  • ✅ login: chinmaychahar / name: chinmaychahar (ba8b38c)

@k8s-ci-robot

Copy link
Copy Markdown
Contributor

Welcome @chinmaychahar!

It looks like this is your first PR to kubernetes-sigs/gateway-api 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/gateway-api has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot
k8s-ci-robot requested review from rikatz and thockin May 25, 2026 05:02
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

Hi @chinmaychahar. 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.

Details

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 size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels May 25, 2026
@chinmaychahar
chinmaychahar marked this pull request as draft May 25, 2026 05:05
@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 May 25, 2026
@chinmaychahar
chinmaychahar marked this pull request as ready for review May 25, 2026 06:23
@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 May 25, 2026
@chinmaychahar

Copy link
Copy Markdown
Author

My idea is to start small and targeted with this PR. Will continue iterating once I get some review on the expectations of current changes and if I'm headed in this right direction!

Comment thread apis/v1/grpcroute_types.go Outdated
Comment thread apis/v1/gatewayclass_types.go
Signed-off-by: maychin <maychin@amazon.com>
Signed-off-by: chinmaychahar <chinmay.cc.06@gmail.com>
@chinmaychahar
chinmaychahar force-pushed the modernize-api-markers branch from ba8b38c to 512f780 Compare June 2, 2026 09:20
@chinmaychahar

Copy link
Copy Markdown
Author

I made a couple of changes since last review. Could you take a look?

@rikatz

rikatz commented Jun 29, 2026

Copy link
Copy Markdown
Member

there is just a single line of change, is this correct?

@kubernetes-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: chinmaychahar
Once this PR has been reviewed and has the lgtm label, please assign thockin for approval. For more information see the Code Review Process.

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

Details 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

@chinmaychahar

Copy link
Copy Markdown
Author

Could the CI checks on this PR be triggered? Thanks!

@rikatz

rikatz commented Jul 23, 2026

Copy link
Copy Markdown
Member

/ok-to-test
Please fix the PR description, given you are doing just on the "immutables" tag

@kubernetes-prow kubernetes-prow Bot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Jul 23, 2026
@kubernetes-prow kubernetes-prow Bot removed the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jul 23, 2026
@chinmaychahar

Copy link
Copy Markdown
Author

Hey @rikatz, changed the PR description

The +k8s:immutable marker changes the validation message from "Value is immutable" to "field is immutable", the rule itself is unchanged but verify-crdify flags it as breaking. Is the new message okay, or would you suggest a different fix?

@kubernetes-prow kubernetes-prow Bot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jul 26, 2026
@chinmaychahar chinmaychahar changed the title Modernize API markers: replace CEL rules with controller-tools 0.21 markers Modernize API markers: Replace immutable CEL validation rules with +k8s:immutable marker Jul 26, 2026
@chinmaychahar

Copy link
Copy Markdown
Author

Hey @rikatz, should I increase the scope of this PR with the other rules as well? I wanted to keep it scoped for immutables for now

@rikatz

rikatz commented Aug 11, 2026

Copy link
Copy Markdown
Member

yes please. Also run a make generate to make api verify pass.

Thanks

@rikatz

rikatz commented Aug 11, 2026

Copy link
Copy Markdown
Member

or at least, just run the make generate, and we can move to other markers on other PRs

@kubernetes-prow

Copy link
Copy Markdown

@chinmaychahar: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-gateway-api-verify d5c60b9 link true /test pull-gateway-api-verify

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Details

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. I understand the commands that are listed here.

@chinmaychahar

Copy link
Copy Markdown
Author

make generate is done and verify-codegen passes now. verify-crdify is failing because +k8s:immutable changes the message from "Value is immutable" to "field is immutable". Any way to correct this?

@chinmaychahar

Copy link
Copy Markdown
Author

I think +k8s:immutable marker hardcodes its message to "field is immutable", so it can't keep the old "Value is immutable"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants