Documentation
¶
Overview ¶
Package origin provides a mechanism for tracking the provenance of Kubernetes objects that are created by controllers as projections of source objects. It encodes the source object's name, namespace, and UID into labels and annotations on the target object, allowing controllers to determine which source object a target was derived from.
Index ¶
- type Data
- type Origin
- func (s *Origin) Annotations(sourceObj client.Object) map[string]string
- func (s *Origin) DataOf(obj client.Object) *Data
- func (s *Origin) Labels(sourceObj client.Object) map[string]string
- func (s *Origin) NameAnnotationKey() string
- func (s *Origin) NamespaceLabelKey() string
- func (s *Origin) RemoveOrigin(obj client.Object)
- func (s *Origin) SetOrigin(sourceObj, obj client.Object)
- func (s *Origin) StemsFrom(obj, sourceObj client.Object) bool
- func (s *Origin) StemsFromKey(obj client.Object, key client.ObjectKey) bool
- func (s *Origin) UIDLabelKey() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Data ¶
Data holds the source object's namespace, name, and UID as extracted from origin labels and annotations on a target object.
type Origin ¶
Origin defines a provenance scheme for tracking which source object a target object was derived from. It stores the source's UID and (optionally) namespace as labels, and the source's name as an annotation on the target object. Set Namespaced to true if the source objects are namespace-scoped.
func (*Origin) Annotations ¶
Annotations returns the origin annotations that should be set on a target object for the given source.
func (*Origin) DataOf ¶
DataOf extracts the origin data from obj's labels and annotations. It returns nil if any required field is missing (UID label, name annotation, and namespace label for namespaced origins).
func (*Origin) Labels ¶
Labels returns the origin labels that should be set on a target object for the given source.
func (*Origin) NameAnnotationKey ¶
NameAnnotationKey returns the annotation key used to store the source object's name.
func (*Origin) NamespaceLabelKey ¶
NamespaceLabelKey returns the label key used to store the source object's namespace.
func (*Origin) RemoveOrigin ¶
RemoveOrigin removes all origin labels and annotations from the given object.
func (*Origin) SetOrigin ¶
SetOrigin stamps the target object with origin labels and annotations derived from the source object. Existing labels and annotations on the target are preserved.
func (*Origin) StemsFrom ¶
StemsFrom reports whether obj was derived from sourceObj by comparing the stored UID.
func (*Origin) StemsFromKey ¶
StemsFromKey reports whether obj was derived from a source object identified by the given namespace/name key.
func (*Origin) UIDLabelKey ¶
UIDLabelKey returns the label key used to store the source object's UID.