You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/ansible/user-guide.md
+58-1Lines changed: 58 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -55,13 +55,70 @@ layout][layout_doc] doc.
55
55
56
56
#### Operator scope
57
57
58
-
A namespace-scoped operator (the default) watches and manages resources in a single namespace, whereas a cluster-scoped operator watches and manages resources cluster-wide. Namespace-scoped operators are preferred because of their flexibility. They enable decoupled upgrades, namespace isolation for failures and monitoring, and differing API definitions. However, there are use cases where a cluster-scoped operator may make sense. For example, the [cert-manager](https://github.com/jetstack/cert-manager) operator is often deployed with cluster-scoped permissions and watches so that it can manage issuing certificates for an entire cluster.
58
+
A namespace-scoped operator (the default) watches and manages resources in a
59
+
single namespace, whereas a cluster-scoped operator watches and manages
60
+
resources cluster-wide. Namespace-scoped operators are preferred because of
61
+
their flexibility. They enable decoupled upgrades, namespace isolation for
62
+
failures and monitoring, and differing API definitions. However, there are use
63
+
cases where a cluster-scoped operator may make sense. For example, the
64
+
[cert-manager](https://github.com/jetstack/cert-manager) operator is often
65
+
deployed with cluster-scoped permissions and watches so that it can manage
66
+
issuing certificates for an entire cluster.
59
67
60
68
If you'd like to create your memcached-operator project to be cluster-scoped use the following `operator-sdk new` command instead:
61
69
```
62
70
$ operator-sdk new memcached-operator --cluster-scoped --api-version=cache.example.com/v1alpha1 --kind=Memcached --type=ansible
63
71
```
64
72
73
+
### Watches file
74
+
75
+
The Watches file contains a list of mappings from custom resources, identified
76
+
by it's Group, Version, and Kind, to an Ansible Role or Playbook. The Operator
77
+
expects this mapping file in a predefined location: `/opt/ansible/watches.yaml`
78
+
79
+
***group**: The group of the Custom Resource that you will be watching.
80
+
***version**: The version of the Custom Resource that you will be watching.
81
+
***kind**: The kind of the Custom Resource that you will be watching.
82
+
***role** (default): This is the path to the role that you have added to the
83
+
container. For example if your roles directory is at `/opt/ansible/roles/`
84
+
and your role is named `busybox`, this value will be
85
+
`/opt/ansible/roles/busybox`. This field is mutually exclusive with the
86
+
"playbook" field.
87
+
***playbook**: This is the path to the playbook that you have added to the
88
+
container. This playbook is expected to be simply a way to call roles. This
89
+
field is mutually exclusive with the "role" field.
90
+
***reconcilePeriod** (optional): The reconciliation interval, how often the
91
+
role/playbook is run, for a given CR.
92
+
***manageStatus** (optional): Specifies who is managing the status for the CR.
93
+
Set to `false` when you want the role/playbook to be solely responsible for
94
+
the CR's status.
95
+
96
+
An example Watches file:
97
+
98
+
```yaml
99
+
---
100
+
# Simple example mapping Foo to the Foo role
101
+
- version: v1alpha1
102
+
group: foo.example.com
103
+
kind: Foo
104
+
role: /opt/ansible/roles/Foo
105
+
106
+
# Simple example mapping Bar to a playbook
107
+
- version: v1alpha1
108
+
group: bar.example.com
109
+
kind: Bar
110
+
playbook: /opt/ansible/playbook.yaml
111
+
112
+
# More complex example for our Baz kind
113
+
# Here we will disable requeuing and be managing the CR status in the playbook
114
+
- version: v1alpha1
115
+
group: baz.example.com
116
+
kind: Baz
117
+
playbook: /opt/ansible/baz.yaml
118
+
reconcilePeriod: 0
119
+
manageStatus: false
120
+
```
121
+
65
122
## Customize the operator logic
66
123
67
124
For this example the memcached-operator will execute the following
0 commit comments