Skip to content

Commit 7d9f0bf

Browse files
committed
Document the manageStatus flag
1 parent 6fa4204 commit 7d9f0bf

File tree

1 file changed

+58
-1
lines changed

1 file changed

+58
-1
lines changed

doc/ansible/user-guide.md

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,70 @@ layout][layout_doc] doc.
5555

5656
#### Operator scope
5757

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.
5967

6068
If you'd like to create your memcached-operator project to be cluster-scoped use the following `operator-sdk new` command instead:
6169
```
6270
$ operator-sdk new memcached-operator --cluster-scoped --api-version=cache.example.com/v1alpha1 --kind=Memcached --type=ansible
6371
```
6472

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+
65122
## Customize the operator logic
66123
67124
For this example the memcached-operator will execute the following

0 commit comments

Comments
 (0)