<p>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:</p>

<p>kustomization.yaml</p>

<pre><code>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
</code></pre>

<p>create_volume_one.yaml</p>

<pre><code>- op: add
  path: /spec/template/spec/containers/0/volumeMounts
  value:
    name: volumeOne
    mountPath: /data/one
</code></pre>

<p>create_volume_two.yaml</p>

<pre><code>- op: add
  path: /spec/template/spec/containers/0/volumeMounts/-
  value:
    name: volumeTwo
    mountPath: /data/two
</code></pre>

<p>When I run said kustomization I get the following error:</p>

<pre class="lang-sh prettyprint-override"><code>$&gt; kubectl kustomize .
Error: found conflict between different patches
&amp;resource.Resource{Kunstructured:(*kunstruct.UnstructAdapter)(0xc000010058), options:(*types.GenArgs)(0xc00038eb00)} doesn't deep equal &amp;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 &lt;dir&gt; [flags] [options]

Use "kubectl options" for a list of global command-line options (applies to all commands).

found conflict between different patches
&amp;resource.Resource{Kunstructured:(*kunstruct.UnstructAdapter)(0xc000010058), options:(*types.GenArgs)(0xc00038eb00)} doesn't deep equal &amp;resource.Resource{Kunstructured:(*kunstruct.UnstructAdapter)(0xc0000c6038), options:(*types.GenArgs)(0xc00038eb00)}
</code></pre>

<p>I tried various paths (with and without the <code>-</code> after <code>volumeMounts</code> but with no avail).</p>

<p>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 <code>volumeMounts</code> properly.  </p>

<p>Any help would be greatly appreciated. Thanks,</p>

Gerb
<p>Apparently, the <code>kubectl</code> version of <code>kustomize</code> (2.0.3) is old and doesn't support appending to items.  Using the latest kustomize (3.1.0) fixed my issue.</p>
