Skip to content

Commit 060f0ed

Browse files
committed
Grammar and spelling updates
1 parent 65af7cb commit 060f0ed

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

doc/ansible/dev/developer_guide.md

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ kube-public Active 28d
142142
kube-system Active 28d
143143
```
144144
## Using Ansible inside of an Operator
145-
Now that we have demonstrated using the k8s modules inside of Ansible, we want
146-
to trigger this Ansible logic when a custom resource changes. In the above
145+
Now that we have demonstrated using the Ansible Kubernetes modules, we want to
146+
trigger this Ansible logic when a custom resource changes. In the above
147147
example, we want to map a role to a specific Kubernetes resource that the
148-
operator will watch. This is called the Watches file.
148+
operator will watch. This mapping is done in a file called `watches.yaml`.
149149

150150
### Watches file
151151

@@ -243,7 +243,7 @@ This is the list of CR annotations which will modify the behavior of the operato
243243
**ansible.operator-sdk/reconcile-period**: Used to specify the reconciliation
244244
interval for the CR. This value is parsed using the standard Golang package
245245
[time][time_pkg]. Specifically [ParseDuration][time_parse_duration] is used
246-
which will use the default of `s` suffix giving the value in seconds.
246+
which will apply the default suffix of `s` giving the value in seconds.
247247

248248
Example:
249249
```
@@ -281,11 +281,13 @@ directory and simply comment out the existing line:
281281
```
282282

283283
Create a Custom Resource Definiton (CRD) and proper Role-Based Access Control
284-
(RBAC) defitinions for resource Foo. `operator-sdk` autogenerates these files
284+
(RBAC) definitions for resource Foo. `operator-sdk` autogenerates these files
285285
inside of the `deploy` folder:
286286
```bash
287-
$ kubectl create -f deploy/crd.yaml
288-
$ kubectl create -f deploy/rbac.yaml
287+
$ kubectl create -f deploy/crds/foo_v1alpha1_foo_crd.yaml
288+
$ kubectl create -f deploy/service_account.yaml
289+
$ kubectl create -f deploy/role.yaml
290+
$ kubectl create -f deploy/role_binding.yaml
289291
```
290292

291293
Run the `up local` command:
@@ -371,14 +373,13 @@ $ sed -i 's|REPLACE_IMAGE|quay.io/example/foo-operator:v0.0.1|g' deploy/operator
371373
Deploy the foo-operator:
372374

373375
```sh
374-
$ kubectl create -f deploy/rbac.yaml
376+
$ kubectl create -f deploy/crds/foo_v1alpha1_foo_crd.yaml # if CRD doesn't exist already
377+
$ kubectl create -f deploy/service_account.yaml
378+
$ kubectl create -f deploy/role.yaml
379+
$ kubectl create -f deploy/role_binding.yaml
375380
$ kubectl create -f deploy/operator.yaml
376381
```
377382

378-
**NOTE**: `deploy/rbac.yaml` creates a `ClusterRoleBinding` and assumes we are
379-
working in namespace `default`. If you are working in a different namespace you
380-
must modify this file before creating it.
381-
382383
Verify that the foo-operator is up and running:
383384

384385
```sh
@@ -388,7 +389,11 @@ foo-operator 1 1 1 1 1m
388389
```
389390

390391
## Extra vars sent to Ansible
391-
The extravars that are sent to Ansible are predefined and managed by the operator. The `spec` section will pass along the key-value pairs as extra vars. This is equivalent to how above extra vars are passed in to `ansible-playbook`.
392+
The extra vars that are sent to Ansible are managed by the operator. The `spec`
393+
section will pass along the key-value pairs as extra vars. This is equivalent
394+
to how above extra vars are passed in to `ansible-playbook`. The operator also
395+
passes along additional variables under the `meta` field for the name of the CR
396+
and the namespace of the CR.
392397

393398
For the CR example:
394399
```yaml
@@ -401,7 +406,7 @@ spec:
401406
newParameter: "newParam"
402407
```
403408

404-
The structure is:
409+
The structure passed to Ansible as extra vars is:
405410

406411

407412
```json
@@ -416,7 +421,9 @@ The structure is:
416421
},
417422
}
418423
```
419-
`message` and `newParameter` are set in the top level as extra variables and `meta` provides the relevant metadata for the Custom Resource as defined in the operator. The `meta` fields can be access via dot notation in Ansible as so:
424+
`message` and `newParameter` are set in the top level as extra variables, and
425+
`meta` provides the relevant metadata for the Custom Resource as defined in the
426+
operator. The `meta` fields can be accesses via dot notation in Ansible as so:
420427
```yaml
421428
---
422429
- debug:

0 commit comments

Comments
 (0)