I'm trying to patch in (patchJSON6922) multiple volumeMounts to a base kustomization. However, when I patch in more than one volumeMounts I get errors. Here's my configuration:
kustomization.yaml
commonLabels:
app: my-app
imageTags:
- name: my-app
newName: localhost/my-app
newTag: latest
bases:
- app
patchesJson6902:
- target:
group: apps
version: v1
kind: Deployment
name: my-app
path: create_volume_one.yaml
- target:
group: apps
version: v1
kind: Deployment
name: my-app
path: create_volume_two.yaml
create_volume_one.yaml
- op: add
path: /spec/template/spec/containers/0/volumeMounts
value:
name: volumeOne
mountPath: /data/one
create_volume_two.yaml
- op: add
path: /spec/template/spec/containers/0/volumeMounts/-
value:
name: volumeTwo
mountPath: /data/two
When I run said kustomization I get the following error:
gt; kubectl kustomize .
Error: found conflict between different patches
&resource.Resource{Kunstructured:(*kunstruct.UnstructAdapter)(0xc000010058), options:(*types.GenArgs)(0xc00038eb00)} doesn't deep equal &resource.Resource{Kunstructured:(*kunstruct.UnstructAdapter)(0xc0000c6038), options:(*types.GenArgs)(0xc00038eb00)}
Examples:
# Use the current working directory
kubectl kustomize .
# Use some shared configuration directory
kubectl kustomize /home/configuration/production
# Use a URL
kubectl kustomize github.com/kubernetes-sigs/kustomize.git/examples/helloWorld?ref=v1.0.6
Usage:
kubectl kustomize <dir> [flags] [options]
Use "kubectl options" for a list of global command-line options (applies to all commands).
found conflict between different patches
&resource.Resource{Kunstructured:(*kunstruct.UnstructAdapter)(0xc000010058), options:(*types.GenArgs)(0xc00038eb00)} doesn't deep equal &resource.Resource{Kunstructured:(*kunstruct.UnstructAdapter)(0xc0000c6038), options:(*types.GenArgs)(0xc00038eb00)}
I tried various paths (with and without the -
after volumeMounts
but with no avail).
When I comment out the create_volume_two.yaml section everything works. So I'm wondering what do I need to do to append to the volumeMounts
properly.
Any help would be greatly appreciated. Thanks,
Apparently, the kubectl
version of kustomize
(2.0.3) is old and doesn't support appending to items. Using the latest kustomize (3.1.0) fixed my issue.