I have a StatefulSet like this:
apiVersion: apps/v1
kind: StatefulSet
metadata:
namespace: myns
name: myapp
spec:
replicas: 3
template:
spec:
containers:
- name: mycontainer
image: ...
...
env:
- name: MY_ENV1
value: "1"
Now I want to add via Kustomize a second environment variable because it is used only in the dev environment. I did something like this:
namespace: myns
resources:
...
patches:
- patch: |-
- op: add
path: "/spec/template/spec/containers/0/env/-"
value:
- name: MY_ENV2
value: "2"
target:
kind: StatefulSet
namespace: myns
name: myapp
The problem is that it doesn't work. If I run kustomize build
I don't see this additional variable (I see other variations).
Can anyone help me to understand how to implement it?