Class Watcher<T>
A generic Kubernetes watcher.
Namespace: Neon.Kube.K8s
Assembly: Neon.Kube.dll
Syntax
public sealed class Watcher<T> where T : IKubernetesObject<V1ObjectMeta>
Type Parameters
Name | Description |
---|---|
T | Specifies the Kubernetes entity type being watched. |
Constructors
Watcher(IKubernetes, ILogger)
Constructor.
Declaration
public Watcher(IKubernetes k8s, ILogger logger = null)
Parameters
Type | Name | Description |
---|---|---|
IKubernetes | k8s | The Kubernetes clien. |
ILogger | logger | Optionally specifies the logger to use. |
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Declaration
public void Dispose()
WatchAsync(Func<WatchEvent<T>, Task>, string, string, string, string, string, int?, CancellationToken)
A generic Watcher to watch Kubernetes resources, and respond with a custom (async) callback method.
Declaration
public Task WatchAsync(Func<WatchEvent<T>, Task> actionAsync, string namespaceParameter = null, string fieldSelector = null, string labelSelector = null, string resourceVersion = null, string resourceVersionMatch = null, int? timeoutSeconds = null, CancellationToken cancellationToken = default)
Parameters
Type | Name | Description |
---|---|---|
Func<WatchEvent<T>, Task> | actionAsync | The async action called as watch events are received. |
string | namespaceParameter | The target Kubernetes namespace. |
string | fieldSelector | The optional field selector |
string | labelSelector | The optional label selector |
string | resourceVersion | The start resource version. |
string | resourceVersionMatch | The optional resourceVersionMatch setting. |
int? | timeoutSeconds | Optional timeout override. |
CancellationToken | cancellationToken | Optionally specifies a cancellation token. |
Returns
Type | Description |
---|---|
Task | The tracking Task. |