The workload identity gate¶
Some work may run only on a node that holds a particular cloud identity: a given provider, a given service account, tokens for a given audience. The control plane states that requirement in the assignment, and the node compares it with the identity it was started with before it does anything else with the run. A node whose identity differs blocks the run and reports exactly which fields disagreed. This page covers what is compared, where the node's identity comes from, and what a block produces.
What is compared¶
flowchart TB
subgraph AS["ASSIGNMENT, workload_identity"]
direction LR
RQ["required"]
EX["mode, provider,<br/>service_account, token_audience"]
end
subgraph NODE["NODE"]
direction TB
IP[("Identity profile<br/>from the bootstrap contract")]
CL[("Identity claims<br/>identity_mode, identity_provider,<br/>service_account, token_audience")]
G{{"Workload identity gate<br/>first gate on the run"}}
IP --> CL --> G
end
OK["Run continues"]
BL["assignment.blocked<br/>IDENTITY_CONTEXT_MISMATCH"]
AS --> G
G -->|"matched or not required"| OK
G -.->|"any field differs"| BL
The requirement comes from the control plane and the claims from the node's own bootstrap, so a run that requires an identity runs only on nodes installed with it. The gate runs before artifacts are fetched, so a node with the wrong identity fetches nothing for the run.
The rule¶
When workload_identity.required is false or absent, the gate passes with
reason not_required. Otherwise each field the assignment names is compared
with the node's claim:
| Assignment field | Node claim |
|---|---|
mode (or profile_mode) |
identity_mode |
provider |
identity_provider |
service_account |
service_account |
token_audience |
token_audience |
mode and provider are compared without case. A field the assignment leaves
empty is skipped. The gate passes with reason matched when no named
field differs.
The node's claims come from the identity profile in its bootstrap contract,
validated when xratud starts: its mode, provider, service account and token
audience, with channel mtls for mode onprem_mtls and workload_identity
otherwise. See
Infra identity.
A block¶
A run whose identity differs completes as failed and is reported three ways:
complete error.code IDENTITY_CONTEXT_MISMATCH
error.message assignment workload identity requirements do not match dataplane identity claims
error.details the gate result
event assignment.blocked, reason workload_identity_mismatch, with the gate result
log assignment blocked by workload identity gate
The gate result names every field that differed:
{
"enforced": true,
"allowed": false,
"reason": "workload_identity_mismatch",
"mismatches": {
"service_account": {"expected": "xratu-runtime-prod", "observed": "xratu-runtime"}
},
"expected": {"mode": "workload_identity", "provider": "gcp", "service_account": "xratu-runtime-prod", "token_audience": ""},
"observed": {"mode": "workload_identity", "provider": "gcp", "service_account": "xratu-runtime", "token_audience": "xratu"}
}
A block means the run was placed on a node installed with a different identity. Check which nodes in the pool hold the required identity, or the requirement the run's workspace states.
The reconciliation stages apply a stricter check of their own: the node's
SPIFFE identity must equal the stage's expected_workload_identity. See
Runtime closure materialization and reconciliation.