I have a deployment spec with a repeated env name, see below:
containers:
- name: c1
...
env:
- name: DUP1
value: hello1
- name: DUP1
value: hello2
Can I expect the second DUP1 key to always be the one set on the pod? e.g. echo $DUP1 == "hello2". It seems to be the case but I can't find validation about it
CodePudding user response:
If the order maintains like this, it will always be set as hello2
Note: Environment variables may reference each other, however ordering is important. Variables making use of others defined in the same context must come later in the list. Similarly, avoid circular references.
so if the order changes for the value like this
- name: DUP1
value: hello2
- name: DUP1
value: hello1
it will be set as hello1