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
clarify a comment on annotation key validation #109892
clarify a comment on annotation key validation #109892
Conversation
/retest |
@@ -44,6 +44,7 @@ var BannedOwners = map[schema.GroupVersionKind]struct{}{ | |||
func ValidateAnnotations(annotations map[string]string, fldPath *field.Path) field.ErrorList { | |||
allErrs := field.ErrorList{} | |||
for k := range annotations { | |||
// Uppercase is valid for annotation key but not QualifiedName, convert it as lowercase |
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.
nit: IIUC, in particular, uppercase is invalid in a QualifiedName's prefix:
a.b/C
is a valid QualifiedNameA.b/C
is not
The metadata.annotation doc says "the prefix must be a DNS subdomain" which is a little unclear. DNS is case insensitive and can be normalized. While a QualifiedName is expected to have a lowercase (normalized) RFC 1123 subdomain prefix, today we allow uppercase in metadata.annotation's prefix.
/lgtm |
/assign @lavalamp |
staging/src/k8s.io/apimachinery/pkg/api/validation/objectmeta.go
Outdated
Show resolved
Hide resolved
Update staging/src/k8s.io/apimachinery/pkg/api/validation/objectmeta.go Co-authored-by: Daniel Smith <dbsmith@google.com>
876c614
to
d0353e3
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: jlsong01, lavalamp, roycaihw 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 |
What type of PR is this?
/kind cleanup
/sig api-machinery
What this PR does / why we need it:
Clarify a comment on annotation key validation.
Since uppercase is valid for annotation key but not QualifiedName, it's better to clarify it for avoid confusion and code readability.
Which issue(s) this PR fixes:
Fixes #109459
Special notes for your reviewer:
None
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: