The gRPC client¶
The node and a project kernel run in different pods and are upgraded at
different times, so the messages between them are fixed by one protocol
definition that both sides generate from. The gRPC client is the node's end of
that protocol, kernel.grpc_control.v1. It opens a mutual-TLS channel to the
kernel, sends typed requests, validates typed responses, and reports every
failure as a reason string the node's retry policy can branch on. This page
covers the service, the request header, the two lanes, the channel settings
and the transport failures.
The service¶
flowchart TB
subgraph XD["XRATUD, gRPC client"]
direction TB
CL["Command lane<br/>new channel per call"]
RLN["Return lane<br/>one held channel per runtime"]
end
subgraph K["PROJECT KERNEL, KernelControl service on 7777"]
direction TB
HS["Handshake"]
OC["OperatorCommand"]
SR["StreamReturnEnvelopes<br/>bidirectional"]
PR["PullReturnEnvelopes,<br/>AckReturnEnvelopes"]
CS[("Continuity store")]
SR --- CS
PR --- CS
end
CL -->|"unary, 30 s"| HS
CL -->|"unary, 30 s"| OC
RLN <==>|"envelopes down, acks up"| SR
RLN -->|"reconnect, polling clients"| PR
Commands are re-admitted on every call over a channel opened for that call and closed after it. The return lane is held open per runtime and resumed from the last acknowledged sequence, so a dropped stream loses nothing. See The three lanes and their lifetimes.
The protocol is defined once, in contracts/kernel_grpc_protocol/kernel_control.proto,
package xratu.kernel.grpc_control.v1. Both the node and the kernel generate
their messages from it.
The request header¶
Every request on both lanes starts with the same header:
| Field | Holds |
|---|---|
protocol_version |
kernel.grpc_control.v1 |
identity.dp_node_id |
The node the caller claims to be |
identity.trust_bundle_digest |
The trust bundle the caller operates against |
identity.identity_revision |
The caller's identity revision |
ownership.contract_version |
project.runtime_ownership.v1 |
ownership.runtime_instance_id |
The runtime being addressed |
ownership.owner_dp_node_id, lease_id, fence_epoch, lease_expires_at |
The ownership the caller holds |
The header carries no peer identity. The kernel takes the caller's identity
from its verified TLS certificate and checks dp_node_id against it; a request
cannot assert who sent it. Every response returns identity_proof, the
identity the kernel authenticated.
The command lane¶
| RPC | Request | Response |
|---|---|---|
Handshake |
The header | accepted, reason, kernel version and profile, runtime_image_digest, supported_operations, identity_proof, trust_evidence, startup |
OperatorCommand |
The header, op, and diagnostics for the diagnostics commands |
accepted, reason, result, identity_proof, trust_evidence |
The handshake's reason is one of accepted, protocol_mismatch,
malformed_request, ownership_rejected, peer_identity_rejected,
trust_bundle_digest mismatch, startup_not_ready,
startup_evidence_incomplete, or a reason the kernel's startup declared. See
Readiness, handshake, and endpoint re-resolution
and Operator controls.
The return lane¶
The stream opens with a ReturnLaneOpen carrying the header and from_seq.
The kernel answers once with ReturnLaneOpened (accepted, reason,
last_acked_seq, max_seq, terminal_seq), replays from from_seq, then
pushes envelopes as they are written. The node sends ReturnLaneAck with
ack_seq on the same stream, and the kernel answers each with a ReturnAck.
Each ReturnEnvelope carries:
contract_version kernel.return_envelope.v1
seq position in the runtime's lane
kind, category category is status, event, log, evidence or fault
context workspace_uuid, assignment_id, run_id, node_id, trace_id
emitted_at, terminal
payload_json the status document, run event or fault evidence
prev_digest, digest
digest is computed over the envelope's canonical JSON (sorted keys, no
separator whitespace), and prev_digest chains it to the envelope before. A
ReturnAck reports state: accepted, gap, regression, post_terminal,
non_owner or stale_fence. Every rejected ack is final for that
acknowledgement. See
Recovering the kernel link.
The polled pair, PullReturnEnvelopes (from_seq, limit clamped to 1 to
1,000) and AckReturnEnvelopes, has the same semantics for a client that
cannot hold a stream.
The channel¶
The channel is secure only: the node reads its certificate, key and CA from the
contract's kernel_control_tls (cert_file, key_file, ca_file) and
refuses to dial without all three:
The kernel's certificate is checked against the trust bundle, and its SPIFFE ID
must equal exactly the runtime_trust.runtime_workload_identity the control
plane provisioned for the runtime. A kernel presenting another ID is refused:
kernel identity spiffe://xratu/workspace/w1/runtime/r2 does not match provisioned spiffe://xratu/workspace/w1/runtime/r1
Channel options:
| Option | Value |
|---|---|
grpc.keepalive_time_ms |
20,000 |
grpc.keepalive_timeout_ms |
10,000 |
grpc.keepalive_permit_without_calls |
1 |
grpc.initial_reconnect_backoff_ms |
200 |
grpc.max_reconnect_backoff_ms |
5,000 |
A connection that dies silently is detected within 30 seconds by keepalive.
Transport failures¶
A call that fails in transport returns a refusal, named after the gRPC status:
kernel_transport_unavailable: <detail>
kernel_transport_deadline_exceeded: <detail>
kernel_transport_unauthenticated: <detail>
The kernel's own refusals arrive in the response's reason, so a
kernel_transport_* reason means the call did not reach an answer, and any
other reason is the kernel's decision. Which reasons are retried is on
Detecting a kernel link break.