kubernetes / website

Kubernetes website and documentation repo:
https://kubernetes.io
Creative Commons Attribution 4.0 International
4.5k stars 14.43k forks source link

Object Names and IDs - Add section for qualified names #47869

Open juliusl opened 2 months ago

juliusl commented 2 months ago

I was having a really rough time trying to figure out where the rules were defined for the type property of a PodCondition. I know underscores are allowed but I didn't find a rule in this part of the docs that mention that _ is allowed.

Turns out this is the code that validates that property,

https://github.com/kubernetes/kubernetes/blob/abc056843c030ead11551e13171a4447701db24e/staging/src/k8s.io/apimachinery/pkg/util/validation/validation.go#L42

(via https://github.com/kubernetes/kubernetes/blob/abc056843c030ead11551e13171a4447701db24e/pkg/apis/core/validation/validation.go#L5390)

Which has a really nice explanation of what a qualified name is right above it,

const qnameCharFmt string = "[A-Za-z0-9]"
const qnameExtCharFmt string = "[-A-Za-z0-9_.]"
const qualifiedNameFmt string = "(" + qnameCharFmt + qnameExtCharFmt + "*)?" + qnameCharFmt
const qualifiedNameErrMsg string = "must consist of alphanumeric characters, '-', '_' or '.', and must start and end with an alphanumeric character"
const qualifiedNameMaxLength int = 63

var qualifiedNameRegexp = regexp.MustCompile("^" + qualifiedNameFmt + "$")

It would be great if this information was included in this particular doc.

k8s-ci-robot commented 2 months ago

This issue is currently awaiting triage.

SIG Docs takes a lead on issue triage for this website, but any Kubernetes member can accept issues by applying the triage/accepted label.

The triage/accepted label can be added by org members by writing /triage accepted in a comment.

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md). If you have questions or suggestions related to my behavior, please file an issue against the [kubernetes-sigs/prow](https://github.com/kubernetes-sigs/prow/issues/new?title=Prow%20issue:) repository.
tamilselvan1102 commented 2 months ago

related page: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/

tamilselvan1102 commented 2 months ago

/language en

tamilselvan1102 commented 2 months ago

/sig docs

sftim commented 1 month ago

I think we should document this, but it belongs elsewhere. https://kubernetes.io/docs/concepts/overview/working-with-objects/names/ is about the name and uid fields within object metadata only. This issue is about object status.

juliusl commented 1 month ago

@sftim is the "qualified name" used elsewhere? Or is it specific to object status type naming? If the latter I agree but if the former, it might be beneficial to stick it in this section.

tengqm commented 1 month ago

I cannot think of a better location for this concept.

sftim commented 1 month ago

I'd put the explanation in https://kubernetes.io/docs/reference/glossary/ and transclude (eg {{< glossary_definition prepend="Kubernetes also has a concept of a qualified name, which is" term_id="qualified-name" >}})) it into the Object Names and IDs page.