Skip to content

Commit 162b031

Browse files
authored
Document that env vars are strings (openshift-service-mesh#550)
In Sail Operator, env vars are always of type string, so sometimes quotes are required when using values such as `true` or `4.5`. Signed-off-by: Daniel Grimm <[email protected]>
1 parent 8e20756 commit 162b031

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

docs/README.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,48 @@ spec:
220220

221221
Note that the only field that was added is the `spec.version` field. There are a few situations however where the APIs are different and require different approaches to achieve the same outcome.
222222

223+
### Environment variables
224+
225+
In Sail Operator, all `.env` fields are `map[string]string` instead of `struct{}`, so you have to be careful with values such as `true` or `false` - they need to be in quotes in order to pass the type checks!
226+
227+
That means the following YAML
228+
229+
```yaml
230+
apiVersion: install.istio.io/v1alpha1
231+
kind: IstioOperator
232+
metadata:
233+
name: default
234+
spec:
235+
values:
236+
global:
237+
istiod:
238+
enableAnalysis: true
239+
pilot:
240+
env:
241+
PILOT_ENABLE_STATUS: true
242+
```
243+
244+
becomes
245+
246+
```yaml
247+
apiVersion: sailoperator.io/v1alpha1
248+
kind: Istio
249+
metadata:
250+
name: default
251+
spec:
252+
values:
253+
global:
254+
istiod:
255+
enableAnalysis: true
256+
pilot:
257+
env:
258+
PILOT_ENABLE_STATUS: "true"
259+
version: v1.23.0
260+
namespace: istio-system
261+
```
262+
263+
Note the quotes around the value of `spec.values.pilot.env.PILOT_ENABLE_STATUS`. Without them, Kubernetes would reject the YAML as it expects a value of type `string` but receives a `boolean`.
264+
223265
### components field
224266

225267
Sail Operator's Istio resource does not have a `spec.components` field. Instead, you can enable and disable components directly by setting `spec.values.<component>.enabled: true/false`. Other functionality exposed through `spec.components` like the k8s overlays is not currently available.

0 commit comments

Comments
 (0)