Watchers

Watchers are the component observing the state of any kind of resource and emitting changes as events to the Job.

Filesystem

class watchm8.watchers.fs.FileSystemWatcher(path, recursive=False)

Observe a location in the file system for changes

Example

watch:
    kind: .fs.FileSystemWatcher
    path: /path/to/observe
    recursive: True
Parameters:
  • path (str) – Path to watch
  • recursive (bool, optional) – Watch sub directories also, default: False

Kubernetes

class watchm8.watchers.k8s.ConfigMap(config=None, namespace=None, label_selector=None)

Observe ConfigMap objects in a Kubernetes cluster

Example

watch:
    kind: .k8s.ConfigMap
Parameters:
  • config (dict, optional) – Kubernetes API auth configuration, defaults to using ~/.kube/config
  • namespace (str, optional) – Observe objects only in given namespace
  • label_selector (str, optional) – Select objects based on given label selector, eg: environment=prod,app=web
class watchm8.watchers.k8s.Namespace(config=None, namespace=None, label_selector=None)

Observe Namespace objects in a Kubernetes cluster

Example

watch:
    kind: .k8s.Namespace
Parameters:
  • config (dict, optional) – Kubernetes API auth configuration, defaults to using ~/.kube/config
  • label_selector (str, optional) – Select objects based on given label selector, eg: environment=prod,app=web
class watchm8.watchers.k8s.Node(config=None, namespace=None, label_selector=None)

Observe Node objects in a Kubernetes cluster

Example

watch:
    kind: .k8s.Node
Parameters:
  • config (dict, optional) – Kubernetes API auth configuration, defaults to using ~/.kube/config
  • namespace (str, optional) – Observe objects only in given namespace
  • label_selector (str, optional) – Select objects based on given label selector, eg: environment=prod,app=web
class watchm8.watchers.k8s.Pod(config=None, namespace=None, label_selector=None)

Observe Pod objects in a Kubernetes cluster

Example

watch:
    kind: .k8s.Pod
Parameters:
  • config (dict, optional) – Kubernetes API auth configuration, defaults to using ~/.kube/config
  • namespace (str, optional) – Observe objects only in given namespace
  • label_selector (str, optional) – Select objects based on given label selector, eg: environment=prod,app=web
class watchm8.watchers.k8s.Service(config=None, namespace=None, label_selector=None)

Observe Service objects in a Kubernetes cluster

Example

watch:
    kind: .k8s.Service
Parameters:
  • config (dict, optional) – Kubernetes API auth configuration, defaults to using ~/.kube/config
  • namespace (str, optional) – Observe objects only in given namespace
  • label_selector (str, optional) – Select objects based on given label selector, eg: environment=prod,app=web