Documentation
¶
Overview ¶
Package tracker defines a utility to enable Reconcilers to trigger reconciliations when objects that are cross-referenced change, so that the level-based reconciliation can react to the change. The prototypical cross-reference in Kubernetes is corev1.ObjectReference.
Imported from https://github.com/knative/pkg/tree/db8a35330281c41c7e8e90df6059c23a36af0643/tracker liberated from Knative runtime dependencies and evolved to better fit controller-runtime patterns.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Key
deprecated
type Key struct {
GroupKind schema.GroupKind
NamespacedName types.NamespacedName
}
Deprecated: use Reference
func NewKey
deprecated
func NewKey(gvk schema.GroupVersionKind, namespacedName types.NamespacedName) Key
Deprecated: use Reference
type Reference ¶ added in v0.12.0
type Reference struct {
// APIGroup of the referent.
// +optional
APIGroup string
// Kind of the referent.
// +optional
Kind string
// Namespace of the referent.
// +optional
Namespace string
// Name of the referent.
// Mutually exclusive with Selector.
// +optional
Name string
// Selector of the referents.
// Mutually exclusive with Name.
// +optional
Selector labels.Selector
}
Reference is modeled after corev1.ObjectReference, but omits fields unsupported by the tracker, and permits us to extend things in divergent ways.
APIVersion is reduce to APIGroup as the version of a tracked object is irrelevant.
type Tracker ¶
type Tracker interface {
// TrackReference tells us that "obj" is tracking changes to the
// referenced object.
TrackReference(ref Reference, obj client.Object) error
// TrackObject tells us that "obj" is tracking changes to the
// referenced object.
TrackObject(ref client.Object, obj client.Object) error
// GetObservers returns the names of all observers for the given
// object.
GetObservers(obj client.Object) ([]types.NamespacedName, error)
}
Tracker defines the interface through which an object can register that it is tracking another object by reference.