We keep in our Flux repo our HelmReleases. We use Kustomize to edit some of the keys in the HelmReleases. I tried using Strategic Merge patch in order to append a value into a list but instead the list was overwritten (which is the default it seems..)
Is there a way to use Strategic Merge Patch on HelmReleases in a way that will allow me to append values to a list (patch - merge) ?
My base.yaml is :
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: MyReleaseX
spec:
releaseName: serviceXRelease
chart:
spec:
chart: serviceXchart
sourceRef:
kind: HelmRepository
name: my-repo
valuesFiles:
- values.yaml
values:
env:
- name: ACCOUNT
value: "x5"
My kustomization file under overlay dir:
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ../base/serviceX
patchesStrategicMerge:
- serviceX.yaml
I want to add in my overlay another env variable (I don't want to overwrite it the existing env).
When I tried the following in my overlay/ServiceX.yaml the list was overwritten and I had only one value:
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: serviceXRelease
spec:
values:
env:
- name: NEW_ENV
value: "val"
Is my only option using json patches instead of Strategic Merge patch like suggested here (just use merge instead of replace) ?