<p>If I have a ConfigMap like so:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: ConfigMap
metadata:
  name: id-config
data:
  uuid: &quot;{{ randAlphaNum 32 }}&quot;
</code></pre>
<p>and a StatefulSet specification like so (taken and slightly modified from kubernetes' <a href="https://kubernetes.io/docs/tutorials/stateful-application/basic-stateful-set/" rel="nofollow noreferrer">StatefulSet Basics</a> page):</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: v1
kind: Service
metadata:
  name: nginx
  labels:
    app: nginx
spec:
  ports:
  - port: 80
    name: web
  clusterIP: None
  selector:
    app: nginx
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: web
spec:
  serviceName: &quot;nginx&quot;
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      containers:
      - name: nginx
        image: registry.k8s.io/nginx-slim:0.8
        ports:
        - containerPort: 80
          name: web
        volumeMounts:
        - name: www
          mountPath: /usr/share/nginx/html
      env:
      - name: UUID
        valueFrom:
          configMapKeyRef:
            name: id-config
            key: uuid
  volumeClaimTemplates:
  - metadata:
      name: www
    spec:
      accessModes: [ &quot;ReadWriteOnce&quot; ]
      resources:
        requests:
          storage: 1Gi
</code></pre>
<p>Will <code>randAlphaNum</code> only be called once, when the initial deployment occurs, and then the value returned by <code>randAlphaNum</code> is stored in the <code>uuid</code> key and used if a pod restarts? Or will <code>randAlphaNum</code> be called every time a pod is created or restarted, with a different uuid being returned every time? Thanks in advance.</p>

quantumferret
<p>When you deploy something with Helm you need to differentiate between two distinct things that are happening:</p>
<ol>
<li>Rendering the manifests, which happens locally on the machine where you execute the <code>helm</code> CLI.</li>
<li>Deploying the rendered manifests. I.e. sending the instruction to the Kubernetes API to deploy certain resources.</li>
</ol>
<p>Entries in the manifest files such as <code>{{ randAlphaNum 32 }}</code> are rendered in step 1 and the pre-rendered results are sent to the Kubernetes API. It will only change if you ask Helm to render and deploy again.</p>
