-
Notifications
You must be signed in to change notification settings - Fork 624
🌱 enable requiredfields linter #5643
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
base: main
Are you sure you want to change the base?
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Hi @v47. 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 Once the patch is verified, the new status will be reflected by the 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. |
/ok-to-test |
Please update KAL to the latest version. After discussion with the Kube API reviewers, and updates to the Kube API conventions, the required fields rule has been rewritten and will now recommend |
/hold |
Also the PR needs a retitle. |
…ditions checks in .golangci-kal.yml (comment out conditions config). The older version was not picking them.
2f48458
to
43a07db
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In a lot of cases, changing the serialization can be breaking, though clients do need to update to the new library version for this to take effect.
Where we already have a non-zero min length, adding omitempty
/omitzero
should be safe, since no one should have persisted an empty value anyway
Where there aren't min lengths already, this could be problematic. Have you checked what the behaviour is when a zero value is persisted and you upgrade into this schema/client?
Existing values should be fine because of ratcheting validation, but, if the client now starts omitting the value, it will remove the value on write and this will lead to a required validation coming up, which would then be breaking
@@ -223,6 +223,7 @@ type OIDCIdentityProviderConfig struct { | |||
// This is also known as audience. The ID for the client application that makes | |||
// authentication requests to the OpenID identity provider. | |||
// +kubebuilder:validation:Required | |||
// +kubebuilder:validation:MinLength=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you verified that this ratchets?
@@ -250,6 +252,8 @@ type OIDCIdentityProviderConfig struct { | |||
// and must be publicly accessible over the internet. | |||
// | |||
// +kubebuilder:validation:Required | |||
// +kubebuilder:validation:MinLength=1 | |||
// +kubebuilder:validation:Pattern=`^https://.+` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be better to use a CEL validation if possible, isURL
likely more comprehensive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you have something like this in mind?
// +kubebuilder:validation:XValidation:rule="isURL(self) && url(self).getScheme() == 'https'"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly, and then you can add ,message="..."
with a custom error message too
What type of PR is this?
/kind cleanup
What this PR does / why we need it:
Which issue(s) this PR fixes :
Fixes #5492
Checklist:
Release note: