forked from sabre1041/sabre1041.eda
-
Notifications
You must be signed in to change notification settings - Fork 0
/
k8s_multiple.yml
36 lines (33 loc) · 1.14 KB
/
k8s_multiple.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
---
- name: Listen for newly created Namespace
hosts: all
sources:
- junipernetworks.eda.k8s:
kinds:
- api_version: v1
kind: Namespace
- api_version: v1
kind: Pod
label_selectors:
- app: myapp
rules:
- name: Existing Namespaces
condition: event.type == "INIT_DONE" and event.resources.kind == "NamespaceList"
action:
debug:
msg: "INIT_DONE: Namespaces: {{ event.resources }}"
- name: Namespace Added/Modified/Deleted
condition: event.resource.kind == "Namespace"
action:
debug:
msg: "{{ event.type }}: Namespace {{ event.resource.metadata.name }}"
- name: Existing Pods
condition: event.type == "INIT_DONE" and event.resources.kind == "PodList"
action:
debug:
msg: "INIT_DONE: Pods: {{ event.resources }}"
- name: Pod Added/Modified/Deleted
condition: event.resource.kind == "Pod"
action:
debug:
msg: "{{ event.type }}: Pod {{ event.resource.metadata.namespace }}/{{ event.resource.metadata.name }}, labels {{ event.resource.metadata.labels }}"