<p>How to patch "db.password" in the following cm with kustomize?</p>

<p>comfigmap:</p>

<pre><code>apiVersion: v1
data:
  dbp.conf: |-
    {
      "db_properties": {
        "db.driver": "com.mysql.jdbc.Driver",
        "db.password": "123456",
        "db.user": "root"
      }
    }

kind: ConfigMap
metadata:
  labels: {}
  name: dbcm
</code></pre>

Lior
<p>create a placeholder in your file and replace it with real data while applying kustomize</p>
<p>your code will be like this:</p>
<pre><code>#!/bin/bash
sed -i &quot;s/PLACE-HOLDER/123456/g&quot; db_config.yaml
kustomize config.yaml &gt;&gt; kustomizeconfig.yaml
kubectl apply -f kustomizeconfig.yaml -n foo
</code></pre>
<p>And the db_config file will be:</p>
<pre><code>apiVersion: v1
data:
  dbp.conf: |-
    {
      &quot;db_properties&quot;: {
        &quot;db.driver&quot;: &quot;com.mysql.jdbc.Driver&quot;,
        &quot;db.password&quot;: &quot;PLACE_HODLER&quot;,
        &quot;db.user&quot;: &quot;root&quot;
      }
    }

kind: ConfigMap
metadata:
  labels: {}
  name: dbcm
</code></pre>
<p>NB: This should be running on the pipeline to have the config file cloned from repo, so the real file won't be updated.</p>
