Skip to content

Conversation

@LoginovIlia
Copy link
Contributor

@LoginovIlia LoginovIlia commented Sep 25, 2025

What this PR does

Adds validation for the pattern field when a pattern is added or changed. Removing a pattern is still allowed

Rationale

Changing or adding a regex may block values that worked before, so we mark these changes. Removing a regex makes the input more open, so we do not mark it

Which issue(s) this PR is related to:

Fixes #21

Changes

  • Adds validation in pkg/validations/property/pattern.go with unit tests
  • Adds a new section to docs/validations.md
  • Adds e2e tests: test/patternadded and test/patternchanged

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 25, 2025
@k8s-ci-robot
Copy link
Contributor

Welcome @LoginovIlia!

It looks like this is your first PR to kubernetes-sigs/crdify 🎉. 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/crdify 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 added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 25, 2025
@LoginovIlia
Copy link
Contributor Author

/cc @jpbetz

@everettraven
Copy link
Contributor

Just a heads up that this is on my list to take a look at soon. If I don't get to it today, it will be on my list for first thing next week. Thanks for contributing!

Copy link
Contributor

@everettraven everettraven left a comment

Choose a reason for hiding this comment

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

Overall, this looks really good - thanks for taking the time to contribute!

I'm requesting changes here because of some recent conversations I've had with folks that brought to my attention the importance of taking into account how loosening validations may impact both readers and writers of an API.

Because crdify doesn't have nuanced knowledge of a situation, we should add a knob here so that users of crdify that do not want to allow removal of a pattern constraint can do so and we should default to that behavior (we always default to the most restrictive at the moment).

@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 28, 2025
@LoginovIlia
Copy link
Contributor Author

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 1, 2026
@LoginovIlia
Copy link
Contributor Author

I updated the pattern validation and now removing the regex flags an incompatibility. I also added the removalPolicy like in enum validation. By default param is Disallow, I added example in docs > example
@everettraven

Copy link
Contributor

@everettraven everettraven left a comment

Choose a reason for hiding this comment

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

Overall, this looks pretty good - thanks @LoginovIlia for taking this work on!

I've just got a couple small comments that I'd like to be addressed (despite my previous self not following this guidance 😅 - something that I will need to go back and fix).

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jan 9, 2026
Copy link
Contributor

@everettraven everettraven left a comment

Choose a reason for hiding this comment

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

LGTM - thanks @LoginovIlia for the contribution!

/lgtm

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jan 14, 2026
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 15, 2026
Copy link
Contributor

@everettraven everettraven left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 16, 2026
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: everettraven, LoginovIlia

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 merged commit e493240 into kubernetes-sigs:main Jan 16, 2026
6 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. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Property Validation: pattern

4 participants