Skip to content

Minted and injected material

Apply mints one invitation per node and injects them as a secret before the workload starts. That is the whole of what install provides a node in the way of credentials.

What is minted

At step 9 of apply, one invitation is minted per node label. At --dp-count 2 for dp-eu-west1, that is a code each for dp-eu-west1-0 and dp-eu-west1-1.

Each carries the organization, the pool, and the organization's governance revision at mint. See Invitations.

How it is injected

The codes become one secret, keyed by node label:

apiVersion: v1
kind: Secret
metadata:
  name: dp-eu-west1-enrollment-invitations
  namespace: dp-eu-west1
type: Opaque
stringData:
  dp-eu-west1-0.token: <invitation code>
  dp-eu-west1-1.token: <invitation code>

The secret name is derived from dp_install as <statefulset_name>-enrollment-invitations.

How a node finds its own

The StatefulSet mounts the secret and reads the pod's own name to pick its key:

        env:
        - name: XRATU_NODE_LABEL
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: XRATU_ENROLLMENT_INVITATION_FILE
          value: "/var/run/xratu/enrollment/${XRATU_NODE_LABEL}.token"
        volumeMounts:
        - name: bootstrap-invitation
          mountPath: /var/run/xratu/enrollment
          readOnly: true
      volumes:
      - name: bootstrap-invitation
        secret:
          secretName: dp-eu-west1-enrollment-invitations

Pod dp-eu-west1-0 reads dp-eu-west1-0.token. That is why stable ordinal names matter, and why the workload kind is fixed. See StatefulSet requirement.

The init container that consumes it

An init container exchanges the code and writes the seed before xratud starts:

      initContainers:
      - name: xratud-enrollment-bootstrap
        command: ["python", "-m", "data_plane.daemon.bootstrap", "--wait-readiness", "--out", "/var/lib/xratu/identity/xratud.bootstrap.json"]
        env:
        - name: XRATU_CP_ENDPOINT
          value: http://xratu-control-plane.xratu.svc:8080
        - name: XRATU_CP_BOOTSTRAP_WAIT_TIMEOUT_SECONDS
          value: "900"
flowchart LR
  S["Secret<br/>one code per label"] --> I["Init container<br/>reads its own code"]
  I --> X["Exchange<br/>control plane"]
  X --> SD["Seed written<br/>/var/lib/xratu/identity"]
  SD --> D["xratud starts"]

--wait-readiness with a 900 second timeout means a pod started before the control plane is answering waits rather than failing, which is what lets apply proceed without ordering the two by hand.

What arrives from elsewhere

The runtime credential comes from the exchange rather than from install, and it refreshes on its own schedule afterwards. Workload identity comes from SPIRE through the CSI driver:

        - name: SPIFFE_ENDPOINT_SOCKET
          value: unix:///run/spiffe/workload-api/spire-agent.sock
        volumeMounts:
        - name: spiffe-workload-api
          mountPath: /run/spiffe/workload-api
          readOnly: true
      volumes:
      - name: spiffe-workload-api
        csi:
          driver: csi.spiffe.io
          readOnly: true

So the only credential install places on disk is the invitation, and it is spent on first start.

On re-apply

Each apply mints fresh invitations for the node labels. A node already enrolled continues on its durable identity and its existing enrollment, so the new code goes unused. A node whose volume was lost uses it to enrol as a new installation. See Re-enrollment and idempotency.

After enrollment

The secret remains in the cluster. Its codes are spent once consumed, and each was clamped to a lifetime between 60 and 7200 seconds at mint, so an unconsumed one expires on its own.