|
2 | 2 |
|
3 | 3 | ## Configuring Operators deployed by OLM
|
4 | 4 |
|
5 |
| -It is possible to configure how OLM deploys an operator via the `config` field in the [subscription](../../pkg/api/apis/operators/subscription_types.go) object. |
| 5 | +It is possible to configure how OLM deploys an Operator via the `config` field in the [Subscription](https://github.com/operator-framework/operator-lifecycle-manager/blob/master/doc/install/install.md#subscribe-to-a-package-and-channel) object. |
6 | 6 |
|
7 |
| -Currently, the OLM supports the following configurations: |
| 7 | +Currently, OLM supports the following configurations: |
8 | 8 |
|
9 | 9 | ### Env
|
10 | 10 |
|
11 |
| -The `Env` field defines a list of environment variables that must exist in all containers in the `pod` created by OLM. |
| 11 | +The `env` field defines a list of [Environment Variables](https://kubernetes.io/docs/tasks/inject-data-application/define-environment-variable-container/#define-an-environment-variable-for-a-container) that must exist in all containers in the Pod created by OLM. |
12 | 12 |
|
13 | 13 | > Note: Values defined here will overwrite existing environment variables of the same name.
|
14 | 14 |
|
| 15 | +#### Example |
| 16 | + |
| 17 | +Increase log verbosity on an Operator's container that utilizes the `ARGS` variable: |
| 18 | + |
| 19 | +``` |
| 20 | +kind: Subscription |
| 21 | +metadata: |
| 22 | + name: prometheus |
| 23 | +spec: |
| 24 | + package: prometheus |
| 25 | + channel: alpha |
| 26 | + config: |
| 27 | + env: |
| 28 | + - name: ARGS |
| 29 | + value: "-v=10" |
| 30 | +``` |
| 31 | + |
15 | 32 | ### EnvFrom
|
16 | 33 |
|
17 |
| -The `EnvFrom` field defines a list of sources to populate environment variables in the container. |
18 |
| -The keys defined within a source must be a C_IDENTIFIER. |
19 |
| -All invalid keys will be reported as an event when the container is starting. |
20 |
| -When a key exists in multiple sources, the value associated with the last source will take precedence. |
| 34 | +The `envFrom` field defines a [list of sources to populate Environment Variables](https://kubernetes.io/docs/tasks/configure-pod-container/configure-pod-configmap/#configure-all-key-value-pairs-in-a-configmap-as-container-environment-variables) in the container. The keys defined within a source must be a C_IDENTIFIER. All invalid keys will be reported as an event when the container is starting. When a key exists in multiple sources, the value associated with the last source will take precedence. |
21 | 35 |
|
22 | 36 | > Note: Values defined by an Env with a duplicate key will take precedence.
|
23 | 37 |
|
| 38 | +#### Example |
| 39 | + |
| 40 | +Inject a license key residing in a Secret to unlock Operator features: |
| 41 | + |
| 42 | +``` |
| 43 | +kind: Subscription |
| 44 | +metadata: |
| 45 | + name: my-operator |
| 46 | +spec: |
| 47 | + package: app-operator |
| 48 | + channel: stable |
| 49 | + config: |
| 50 | + envFrom: |
| 51 | + - secretRef: |
| 52 | + name: license-secret |
| 53 | +``` |
| 54 | + |
24 | 55 | ### Volumes
|
25 | 56 |
|
26 |
| -The `Volumes` field defines a list of [volumes](https://kubernetes.io/docs/concepts/storage/volumes/) that must exist on the `pod` created by OLM. |
| 57 | +The `volumes` field defines a list of [Volumes](https://kubernetes.io/docs/concepts/storage/volumes/) that must exist on the Pod created by OLM. |
27 | 58 |
|
28 | 59 | > Note: Volumes defined here will overwrite existing Volumes of the same name.
|
29 | 60 |
|
30 | 61 | ### VolumeMounts
|
31 | 62 |
|
32 |
| -The `VolumeMounts` field defines a list of [volumeMounts](https://kubernetes.io/docs/concepts/storage/volumes/) that must exist in all containers in the `pod` created by OLM. If a `volumeMount` references a `volume` that does not exist, OLM will fail to deploy the operator. |
| 63 | +The `volumeMounts` field defines a list of [VolumeMounts](https://kubernetes.io/docs/concepts/storage/volumes/) that must exist in all containers in the Pod created by OLM. If a `volumeMount` references a `volume` that does not exist, OLM will fail to deploy the operator. |
33 | 64 |
|
34 | 65 | > Note: VolumeMounts defined here will overwrite existing VolumeMounts of the same name.
|
| 66 | +
|
| 67 | +#### Example |
| 68 | + |
| 69 | +Mount a ConfigMap as a Volume that contains configuration information that can change default Operator behavior. Modifications to the content of the ConfigMap should appear within the container's VolumeMount. |
| 70 | + |
| 71 | +``` |
| 72 | +kind: Subscription |
| 73 | +metadata: |
| 74 | + name: my-operator |
| 75 | +spec: |
| 76 | + package: etcd |
| 77 | + channel: alpha |
| 78 | + config: |
| 79 | + volumes: |
| 80 | + - name: config-volume |
| 81 | + configMap: |
| 82 | + name: etcd-operator-config |
| 83 | + volumeMounts: |
| 84 | + - mountPath: /config |
| 85 | + name: config-volume |
| 86 | +``` |
0 commit comments