Skip to content
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

Merged
merged 1 commit into from May 27, 2022

Conversation

jlsong01
Copy link
Contributor

@jlsong01 jlsong01 commented May 8, 2022

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?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels May 8, 2022
@k8s-ci-robot k8s-ci-robot requested review from deads2k and sttts May 8, 2022 15:40
@jlsong01
Copy link
Contributor Author

jlsong01 commented May 8, 2022

/retest

@fedebongio
Copy link
Contributor

/assign @roycaihw @Jefftree
/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels May 10, 2022
@@ -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
Copy link
Member

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 QualifiedName
  • A.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.

@roycaihw
Copy link
Member

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 12, 2022
@jlsong01
Copy link
Contributor Author

/assign @lavalamp
for approval

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 19, 2022
Update staging/src/k8s.io/apimachinery/pkg/api/validation/objectmeta.go

Co-authored-by: Daniel Smith <dbsmith@google.com>
@lavalamp
Copy link
Member

/lgtm
/approve

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

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 27, 2022
@k8s-ci-robot k8s-ci-robot merged commit de44988 into kubernetes:master May 27, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.25 milestone May 27, 2022
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. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The validation of Annotations
6 participants