Skip to content

Conversation

@everettraven
Copy link
Contributor

@everettraven everettraven commented Jun 25, 2025

Adds a new property validation for validating compatibility of changes to the format constraint of a CRD schema property.

Changing the format of a property is a breaking change as each format type outlined in https://github.com/kubernetes/apiextensions-apiserver/blob/5714b0b58b88ea1b939e40a3602ee349ee4b57e7/pkg/apis/apiextensions/v1/types_jsonschema.go#L47-L73 has a different validation that is applied to the property value.

Making changes to this results in breaking of client/user expectations and may invalidate existing values.

Fixes #18

@k8s-ci-robot k8s-ci-robot requested review from JoelSpeed and jpbetz June 25, 2025 14:11
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 25, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: everettraven

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

The pull request process is described 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

@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jun 25, 2025
@@ -1,59 +1,62 @@
{
"crdValidation": [
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems the order here is non-determinisitic which is leading to re-ordering of lots of the output? Can that be fixed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would say yes if we were not using the serialized JSON output here. I'm sure it is possible to make it deterministic if we created our own JSON marshalling methods, but at the time that felt like overkill.

If we feel we must have deterministic output that may be a path worth considering, but my general understand is that YAML and JSON output formats are usually non-deterministic in ordering. I could be mistaken, but if this is the case I'd rather not fight the usual behaviors of particular output formats.

We certainly could consider using a different output format that we make more deterministic but we do have logic implemented that these should only ever be updated if there is a semantic difference. I think this semantic difference logic and a fix for #29 would result in less frequent updates of these files.

Copy link
Contributor

Choose a reason for hiding this comment

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

I thought most serialization libraries in Go sorted lists on output, but I could be wrong. Being non deterministic in this case seems particularly problematic as it's creating unnecessary churn isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure. I could certainly be wrong about the list serialization being non-deterministic, but I think it may be because we pull the set of checks we need to perform from a map and execute them in the order we pulled from the map (which is non-deterministic).

I've got #38 up which we can certainly include adjusting that list to always be deterministic (maybe based on validation name?) before running them

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 2, 2025
Signed-off-by: Bryce Palmer <bpalmer@redhat.com>
as it is flagging validations as duplicates because the code is very similar
but the constraints they are validating are different.

This may go a bit against DRY principles, but repetition in this case is
more situational and keeping this repetition allows us to evolve validations
independently as needed.

Signed-off-by: Bryce Palmer <bpalmer@redhat.com>
Signed-off-by: Bryce Palmer <bpalmer@redhat.com>
@k8s-ci-robot k8s-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Sep 19, 2025
@everettraven
Copy link
Contributor Author

@JoelSpeed This PR should be up to date now and pulling in all the improvements made for deterministic and minimal output.

PTAL when you've got some time - thanks!

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 18, 2025
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. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. 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.

Property Validation: format

4 participants