<p>In Kubernetes I have a base kustomize package, and two patches to it, each patch adjusting a different aspect of the base - one for large deployment, and another to use a legacy image rather than the current one.  Is there a way I can create a "combined" patch -- the one that has both changes, without copying large &amp; legacy patch content?</p>

<pre><code>- base/
- large-deployment-patch/
- legacy-image-patch/
</code></pre>

<p>When I tried to simply use both patches as bases in the combined patch, I get an error like this:</p>

<p><code>Error: ../legacy: id '"~G_v1_ConfigMap|~X|~P|pg-database|~S"' already used</code></p>

Yuri Astrakhan
<p>As @Jamie mentioned in his comment, if any of the two &quot;Patches&quot; contains a <code>kustomization.yaml</code> file that include your <code>base/</code> directory as a resource, it will be an overlay. Each overlay generates a copy of all the resources in your base and modify them.</p>
<p>If your base creates a <code>ConfigMap</code> called <code>pg-database</code> and none of your overlays modifies the name of this resource, you will end-up with two <code>ConfigMap</code>s called <code>pg-database</code>.</p>
<p>So to sum-up: each overlay creates a copy of the resources and you can't have two resources of the same <code>kind</code> with the same <code>name</code> in the same <code>namespace</code>.</p>
<p>It's common practice to add a <code>namePrefix</code> or <code>nameSuffix</code> transformer in your overlays to avoid collisions and give more meaningful names to your resources.</p>
