<p>I am trying to deploy Kong API Gateway via template to my openshift project.  The problem is that Kong seems to be doing some DNS stuff that causes <a href="https://github.com/Mashape/kong/issues/2524#issuecomment-302233645" rel="nofollow noreferrer">sporadic failure of DNS resolution</a>.  The workaround is to use the FQDN (<code>&lt;name&gt;.&lt;project_name&gt;.svc.cluster.local</code>).  So, in my template i would like to do:</p>

<pre><code>    - env:
      - name: KONG_DATABASE
        value: postgres
      - name: KONG_PG_HOST
        value: "{APP_NAME}.{PROJECT_NAME}.svc.cluster.local"
</code></pre>

<p>I am just not sure how to get the current <code>PROJECT_NAME</code> of if perhaps there is a default set of available parameters...</p>

<p>You can read the namespace(project name) from the Kubernetes downward API into an environment variable and then use that in the value perhaps.</p>

<p>See the OpenShift docs <a href="https://docs.openshift.com/container-platform/3.4/dev_guide/downward_api.html#dapi-values-using-environment-variables" rel="nofollow noreferrer">here</a> for example.</p>

<p>Update based on Claytons comment:</p>

<p>Tested and the following snippet from the deployment config works.</p>

<pre><code>- env:
    - name: MY_POD_NAMESPACE
      valueFrom:
        fieldRef:
          apiVersion: v1
          fieldPath: metadata.namespace
    - name: EXAMPLE
      value: example.$(MY_POD_NAMESPACE)
</code></pre>

<p>Inside the running container:</p>

<pre><code>sh-4.2$ echo $MY_POD_NAMESPACE                                                                          
testing                                                                                                                            
sh-4.2$ echo $EXAMPLE                                                                                                             
example.testing
</code></pre>

<p>In the environment screen of the UI it appears as a string value such as <code>example.$(MY_POD_NAMESPACE)</code></p>
