Skip to content

Add declarative validation linting to optionalorrequired #76

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

Conversation

JoelSpeed
Copy link
Contributor

This PR updates the optionalorrequired linter to also understand the semantics of the +k8s:Optional and +k8s:Required markers.

In particular, it checks that both are not set at the same time, and, that if another optiona/required marker is present, that the semantics match.

CC @yongruilin

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: JoelSpeed

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 cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 1, 2025
Copy link
Member

@sivchari sivchari 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 May 1, 2025
@k8s-ci-robot k8s-ci-robot merged commit 1901c31 into kubernetes-sigs:main May 1, 2025
4 checks passed
@JoelSpeed
Copy link
Contributor Author

Oops, I probably should have held this

@yongruilin if you have any feedback, please review here and I'll create a follow up PR

@sivchari
Copy link
Member

sivchari commented May 1, 2025

Oh no, sorry.
I considered it you started to handle validation-gen.

@JoelSpeed
Copy link
Contributor Author

Don't worry! I've spoken with @yongruilin already and was intending to start supporting declarative validation so that we can cover the linting use case of that project as well.

I'm currently working on enabling kube-api-linter for kubernetes itself and this is one of the prerequisites, so I was intending to merge over the next few days anyway

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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants