<p>I like <a href="https://kubectl.docs.kubernetes.io/references/kustomize/kustomization/configmapgenerator/" rel="nofollow noreferrer">configMapGenerator</a> with suffix hashes because it forces redeployment of pod that are consuming particular config. But the diff output after changing config is just delete and create, which is less than ideal. Is there a way to get more intelligent diff config maps produces by configMapGenerator with suffix hashes?</p>
<h2>Edit:</h2>
<p>For example if I have kustomization.yaml:</p>
<pre class="lang-yaml prettyprint-override"><code>generatorOptions:
  disableNameSuffixHash: false

 configMapGenerator:
  - name: nginx-conf
    files:
    - nginx.conf=config/nginx.conf
</code></pre>
<ol>
<li><p>Lets assume that for first time <code>kubectl apply -k</code> generates <code>nginx-conf-aaaa</code> config map.</p>
</li>
<li><p>Edit <code>config/nginx.conf</code>.</p>
</li>
<li><p>Lets assume that <code>kubectl apply -k</code> will generate <code>nginx-config-bbbb</code>.</p>
</li>
</ol>
<p>Is there a way to diff <code>nginx-config-aaaa</code> and <code>nginx-config-bbbb</code> before applying changes?</p>

<p>You can do something like this</p>
<ul>
<li><p>Get the current version of the ConfigMap and write it to a file <code>current.yaml</code></p>
<p><code>kubectl get configmap nginx-conf-aaaa -o=yaml &gt; ./current.yaml</code></p>
</li>
<li><p>After making the changes get the new version of the ConfigMap in <code>new.yaml</code></p>
<p><code>kubectl kustomize . &gt; ./new.yaml</code></p>
</li>
<li><p>Then perform a <code>git diff</code></p>
<p><code>git diff --no-index ./current.yaml ./new.yaml</code></p>
</li>
</ul>
<p>If you are happy with the diff, go ahead and apply the changes.</p>
