Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ResourceTracker ¶
type ResourceTracker[TObj commonKubernetes.Object] interface { // KnownResources returns all currently known resources // If a filter was used to create this tracker it will be applied on the KnownResources KnownResources() ([]TObj, error) // KnownResourcesByIndex returns currently known resources with the given <indexValue> within the index <indexName> // If a filter was used to create this tracker it will be applied on the KnownResourcesByIndex KnownResourcesByIndex(indexName string, indexValue string) ([]TObj, error) // RegisterAddedResourceChannel adds a new handler for the "Added Resource" event RegisterAddedResourceChannel(chan TObj) // UnregisterAddedResourceChannel removes a previously registered handler (the channel gets closed by UnregisterAddedResourceChannel) UnregisterAddedResourceChannel(chan TObj) // RegisterDeletedResourceChannel adds a new handler for the "Deleted Resource" event RegisterDeletedResourceChannel(chan TrackerDeleteResource[TObj]) // UnregisterDeletedResourceChannel removes a previously registered handler (the channel gets closed by UnregisterDeletedResourceChannel) UnregisterDeletedResourceChannel(chan TrackerDeleteResource[TObj]) // RegisterUpdatedResourceChannel adds a new handler for the "Updated Resource" event RegisterUpdatedResourceChannel(chan struct{ Old, New TObj }) // UnregisterUpdatedResourceChannel removes a previously registered handler (the channel gets closed by UnregisterUpdatedResourceChannel) UnregisterUpdatedResourceChannel(chan struct{ Old, New TObj }) }
func NewResourceTracker ¶
func NewResourceTracker[TObj commonKubernetes.Object](informer cache.SharedIndexInformer, filter commonKubernetes.ResourceFilter[TObj]) (ResourceTracker[TObj], error)
NewResourceTracker attaches a typed resource tracker to the given shared informer cache.SharedIndexInformer.
It's mandatory that any objects published by cache.SharedIndexInformer are convertable to [TObj] via scheme.Schema.Convert. Objects witch are not convertable will be passed to runtime.HandleError and not otherwise returned to the user.
type TrackerDeleteResource ¶
type TrackerDeleteResource[TObj commonKubernetes.Object] struct { Resource TObj ResourceKey string RawResource interface{} UnknownState bool }
TrackerDeleteResource contains information on deleted resources in the underlying cache.SharedIndexInformer. There is the possibility that k8s already "finalized" the deleted object or has some trouble to do so.
in case of a normal deletion TrackerDeleteResource.Resource contains a converted state TrackerDeleteResource.UnknownState will be false in case of an abnormal deletion TrackerDeleteResource.Resource might contain a converted state; if the underlying k8s resource is still convertible; NOTE: the contents might differ from the current k8s state as the presented resource might be outdated! TrackerDeleteResource.UnknownState will be true TrackerDeleteResource.RawResource contains the raw resource from k8s; usually tha last known state of the resource when the client still was connected to k8s TrackerDeleteResource.ResourceKey contains the key to the abnormal deleted object; usually delivered in form of "<namespace>/<name>"
Click to show internal directories.
Click to hide internal directories.