-
Notifications
You must be signed in to change notification settings - Fork 38.7k
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
add validation for customresourcedefintions #45556
Conversation
ret := genericvalidation.NameIsDNSSubdomain(name, prefix) | ||
requiredName := obj.Spec.Names.Plural + "." + obj.Spec.Group | ||
if name != requiredName { | ||
ret = append(ret, fmt.Sprintf(`must be spec.names.plural+"."+spec.group `)) |
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.
no space after group
return allErrs | ||
} | ||
|
||
func ValidateCustomResourceNames(names *apiextensions.CustomResourceNames, fldPath *field.Path) field.ErrorList { |
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.
Do you want to allow empty Kind and Plural? Plural could be derived from the CustomResource name, but Kind?
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.
Do you want to allow empty Kind and Plural? Plural could be derived from the CustomResource name, but Kind?
This used by status validation too. Status may not have all these field set. If they are set, they must be valid, but if they are not set how to handle that varies with where the field is embedded. See the spec validation above.
Also, no information is derived post-defaulting: #45561
1503e95
to
bcf6c66
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: deads2k, sttts Assign the PR to them by writing
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
its the api-extensions thing again: #45490 approving |
Automatic merge from submit-queue |
Add basic validation for customresource definitions.
@adohe if you had review bandwidth, this is a relatively small one.