Adding or Replacing Environment Variables
In some cases there is a need to replace an environment variable or add a new one. To do this we use patches and apply those patches to the kustomization.yaml.
This can be accomplished via an inline patch in the kustomization.yaml. Here is an example where we update the url of a value in a configmap.
As an inline patch
patches:
- target:
kind: ConfigMap
name: vista-fhir-adapter-app-config
patch: |-
- op: add
path: /data/MOBILE_MVI_SERVICE_V1_URL
value: http://wiremock:8080/mvi/v1
The add operation will add a new value if it doesn’t exist or update an existing one.
The replace operation can also be used. The difference being that the replace operation will fail if the value doesn’t already exist in the configmap.