What reasons might one prefer the with_object
or the with_array
options below?
{
"with_array": [
{
"name": "foo",
"key": "value"
},
{
"name": "bar",
"key": "value"
}
],
"with_object": {
"foo": {
"key": "value"
},
"bar": {
"key": "value"
}
}
}
Real world example: Why is the environment variable spec in this Kubernetes manifest using an array of name
and value
keys?
pods/inject/envars.yaml
apiVersion: v1
kind: Pod
metadata:
name: envar-demo
labels:
purpose: demonstrate-envars
spec:
containers:
- name: envar-demo-container
image: gcr.io/google-samples/node-hello:1.0
env:
- name: DEMO_GREETING
value: "Hello from the environment"
- name: DEMO_FAREWELL
value: "Such a sweet sorrow"