generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 181
Description
Internal APIs, e.g. EndpointSliceReconciler, use separate ns and name strings to represent the ns/name of CRs. A few benefits of using NamespacedName are:
- Encapsulates the namespace and name into a single struct, improving readability by clearly indicating that these two fields together uniquely identify a Kubernetes resource.
- Provides stronger type safety compared to using two separate strings.
- Provides built-in methods like
String()
that automatically format the resource identifier in the conventional namespace/name format, reducing boilerplate code and potential formatting errors. - Functions that operate on Kubernetes resources often require both namespace and name. Using a single types.NamespacedName reduces the number of function parameters, simplifying function signatures.
Metadata
Metadata
Assignees
Labels
No labels