ResourceWatcher
Class: ResourceWatcher
Defined in: kubernetes/src/stores/watcher.ts:17
Emit the repository events of the changes made to the resources of a root model by others than this process (kubectl, GitOps, another replica)
The objects listed at start are known silently; afterwards an added object emits Created, a change of its data
(spec, status fields, model) Updated and a deletion Deleted, on the repository of the object's model. Changes of
metadata only (finalizers, operator conditions) and the writes of this process emit nothing.
Constructors
Constructor
new ResourceWatcher(
store,root,resources,onError):ResourceWatcher
Defined in: kubernetes/src/stores/watcher.ts:29
Parameters
store
the store
root
ModelClass
the model owning the resources
resources
the resources, with the tracker of this process writes
onError
(err) => void
called when the watch fails (it restarts)
Returns
ResourceWatcher
Properties
informer?
protectedoptionalinformer?:KubernetesInformer<CustomResource>
Defined in: kubernetes/src/stores/watcher.ts:18
onError
protectedonError: (err) =>void
Defined in: kubernetes/src/stores/watcher.ts:33
called when the watch fails (it restarts)
Parameters
err
unknown
Returns
void
repositories
protectedrepositories:Map<string, {events:Repository<any>;raw:KubernetesRepository<any>; }>
Defined in: kubernetes/src/stores/watcher.ts:21
resources
protectedresources:CustomResources
Defined in: kubernetes/src/stores/watcher.ts:32
the resources, with the tracker of this process writes
root
protectedroot:ModelClass
Defined in: kubernetes/src/stores/watcher.ts:31
the model owning the resources
rows
protectedrows:Map<string,string>
Defined in: kubernetes/src/stores/watcher.ts:20
data of each known object, to detect the changes of the model data
store
protectedstore:KubernetesStore
Defined in: kubernetes/src/stores/watcher.ts:30
the store
Methods
onChange()
protectedonChange(resource,live):Promise<void>
Defined in: kubernetes/src/stores/watcher.ts:94
An object was added or changed
Parameters
resource
the resource
live
boolean
false while listing the existing objects
Returns
Promise<void>
onDelete()
protectedonDelete(resource):Promise<void>
Defined in: kubernetes/src/stores/watcher.ts:117
An object was deleted
Parameters
resource
the last state of the resource
Returns
Promise<void>
repositoriesOf()
protectedrepositoriesOf(resource):object
Defined in: kubernetes/src/stores/watcher.ts:71
Repositories of the model of a resource: the model in its annotation when this store holds it under the root, else the root model
Parameters
resource
the resource
Returns
object
the repository emitting the events and the one converting the resource
events
events:
Repository<any>
raw
raw:
KubernetesRepository<any>
start()
start():
Promise<void>
Defined in: kubernetes/src/stores/watcher.ts:40
Start watching
Returns
Promise<void>
once the resources are listed
stop()
stop():
Promise<void>
Defined in: kubernetes/src/stores/watcher.ts:59
Stop watching
Returns
Promise<void>