Skip to content

Commit 0fe52b3

Browse files
authored
doc: Explain how to set maxWorkers (#2051)
* doc: Explain how to set maxWorkers
1 parent d54ac03 commit 0fe52b3

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

doc/ansible/dev/advanced_options.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,59 @@ ENTRYPOINT ["/usr/local/bin/entrypoint", "--inject-owner-ref=false"]
5555
If you have created resources without owner reference injection, it is
5656
possible to manually to update resources following [this
5757
guide.](./retroactively-owned-resources.md)
58+
59+
## Max Workers
60+
61+
Increasing the number of workers allows events to be processed
62+
concurrently, which can improve reconciliation performance.
63+
64+
Worker maximums can be set in two ways. Operator **authors and admins**
65+
can set the max workers default by including extra args to the operator
66+
container in `deploy/operator.yaml`. (Otherwise, the default is 1 worker.)
67+
68+
**NOTE:** Admins using OLM should use the environment variable instead
69+
of the extra args.
70+
71+
``` yaml
72+
- name: operator
73+
image: "quay.io/asmacdo/memcached-operator:v0.0.0"
74+
imagePullPolicy: "Always"
75+
args:
76+
- "--max-workers"
77+
- "3"
78+
```
79+
80+
Operator **admins** can override the value by setting an environment
81+
variable in the format `WORKER_<kind>_<group>`. This variable must be
82+
all uppercase, and periods (e.g. in the group name) are replaced with underscores.
83+
84+
For the memcached operator example, the component parts are retrieved
85+
with a GET on the operator:
86+
87+
```bash
88+
$ kubectl get memcacheds example-memcached -o yaml
89+
90+
apiVersion: cache.example.com/v1alpha1
91+
kind: Memcached
92+
metadata:
93+
name: example-memcached
94+
namespace: default
95+
```
96+
97+
From this data, we can see that the environment variable will be
98+
`WORKER_MEMCACHED_CACHE_EXAMPLE_COM`, which we can then add to
99+
`deploy/operator.yaml`:
100+
101+
``` yaml
102+
- name: operator
103+
image: "quay.io/asmacdo/memcached-operator:v0.0.0"
104+
imagePullPolicy: "Always"
105+
args:
106+
# This default is overridden.
107+
- "--max-workers"
108+
- "3"
109+
env:
110+
# This value is used
111+
- name: WORKER_MEMCACHED_CACHE_EXAMPLE_COM
112+
value: "6"
113+
```

0 commit comments

Comments
 (0)