<p>I have configMap that are loading properties files for my spring boot application.
My configMap is mounted as a volume and my springboot app is reading from that volume.</p>

<p>my typical property files are:</p>

<pre><code>application-dev1.yml has
integrations-queue-name=integration-dev1
search-queue-name=searchindex-dev1

application-dev2.yml
integrations-queue-name=integration-dev2
search-queue-name=searchindex-dev1

application-dev3.yml
integrations-queue-name=integration-dev3
search-queue-name=searchindex-dev1
</code></pre>

<p>My goal is to have 1 properties file </p>

<pre><code>application-env.yml 
integrations-queue-name=integration-{env}
search-queue-name=searchindex-{env}
</code></pre>

<p>I want to do parameter substitution of env with the profile that is active for my service.</p>

<p>Is it possible to do parameter substitution in configMaps from my spring boot application running in the pod? I am lookin for something similar to maven-resource-plugin that can be done run time.</p>

Praveen Kumar
<p>If it's just those two, then likely you will get more mileage out of using the <code>SPRING_APPLICATION_JSON</code> environment variable, which should supersede anything in the configmap:</p>

<pre class="lang-yaml prettyprint-override"><code>containers:
- name: my-spring-app
  image: whatever
  env:
  - name: ENV_NAME
    value: dev2
  - name: SPRING_APPLICATION_JSON
    value: |
      {"integrations-queue-name": "integration-$(ENV_NAME)",
       "search-queue-name": "searchindex-$(ENV_NAME)"}
</code></pre>

<p>materializes as:</p>

<pre><code>$ kubectl exec my-spring-pod -- printenv
ENV_NAME=dev2
SPRING_APPLICATION_JSON={"integrations-queue-name": "integration-dev2",
  "search-queue-name": "searchindex-dev2"}
</code></pre>
