HUB
Sign inSign up
dingo-operator logo

blinklabs/dingo-operator

By blinklabs

•Updated about 1 hour ago

Kubernetes operator for Dingo Cardano nodes

Image
0

10K+

blinklabs/dingo-operator repository overview

⁠dingo-operator

A Kubernetes operator for Dingo⁠, the Go Cardano node. It manages the full lifecycle of Cardano relays and block producers — including KES/operational-certificate monitoring and rotation, Mithril bootstrap, and topology (with external relays) — aimed at secure, production mainnet block production for enterprise stake pool operators.

Status: early development (v1alpha1). The API may change.

⁠Features

  • One CRD, two roles. DingoNode runs as a relay or a blockProducer.

  • Env-var-driven Dingo workloads as StatefulSets with a persistent DB volume, headless + client Services, and an optional PodMonitor.

  • Node health probes use Dingo's dedicated listener on canonical ghcr.io/blinklabs-io/dingo images v0.70.13 and later: liveness stays healthy during sync, while readiness waits until the chain tip is within Dingo's configured slot-gap tolerance. Catching-up or stalled nodes are removed from client Services without being restarted. Older and custom images keep TCP probes.

  • Mithril bootstrap via an init container running dingo mithril sync (native Go client, no external binary).

  • Topology management — auto-wire in-cluster block-producer/relay peering, plus static/external relays merged into local roots.

  • Block-producer key handling — stages KES/VRF/opcert from a Secret into a memory-backed /keys volume with mode 0600, sets the CARDANO_SHELLEY_* env, and surfaces KES period / opcert state from the node's metrics. A delivered bundle is validated (opcert signature, pool binding, KES-key binding, counter, KES period) before the operator rolls the pod onto it; a refused bundle sets KeysValid=False and Degraded=True and is not rolled out. While it is refused, the live pod template is kept, so pod template changes from spec edits or operator upgrades are held too; other resources still reconcile. When the live template differs from the render, the KeysValid and Degraded messages say a pod template update is held. A missing Secret is reported the same way, and the running pod is not rolled onto a template that cannot mount it. The certificate may be named opcert.cert or node.cert (the dingo Helm chart's name), so a chart key Secret works unchanged; if both are present they must be identical, and it is staged at /keys/opcert.cert either way. The live pod keeps its staged keys when the Secret changes (unless reloadInPlace, below, loads a validated KES key and opcert). Any later pod recreation stages the Secret's current contents, so fix a refused bundle rather than leaving it in place. In MonitorOnly mode a valid replacement is reported but not approved, loaded, or rolled out; any pending staging approval is withdrawn and the pod template is held while its key checksum differs from the Secret. Switch to Assisted to deliver an externally managed replacement. Pod recreation initiated outside the operator still stages the Secret's current contents. With spec.blockProducer.rotation.reloadInPlace: true, a validated bundle that changes only the KES key and opcert is loaded into the running node instead of rolling the pod: after validating it, the operator records its digest in the <name>-keys-approval ConfigMap, a sync-block-producer-keys container stages it into /keys, and Dingo reloads it on its credential file watch. A node that signs through signingAgent has no staging container, approval ConfigMap or approval volume: Dingo takes a new opcert from the agent, and a pod restart stages the keys Secret's current opcert. The rotation completes when the node reports the new opcert counter (status.opcert.loadedCounter); if it does not within 10 minutes, the pod is rolled. A change to any other Secret entry (VRF key, vote key), a new pool, or an opcert that reuses the loaded counter (or one approved before the node has reported its counter, or one replacing an unconfirmed approval without a higher counter) always rolls the pod. A bundle loads in place only with a counter above the loaded one and the one the pod started with, which the pod template records (dingo.blinklabs.io/keys-counter, mirrored in status.opcert.rolledCounter until the node reports it). It needs a Dingo version that reloads credential files in place. An optional vote.skey key in the Secret (Leios BLS12-381 vote signing key, text envelope or raw hex scalar; bls.skey, the dingo Helm chart's name, is accepted in its place, and both may be present only if identical) is staged the same way and wired to DINGO_LEIOS_VOTE_SIGNING_KEY_FILE; without it nothing changes. It is checked with the rest of the bundle, including the scalar range Dingo requires, and spec.environment may neither point that variable elsewhere nor set it when no vote key is staged. On a network without Leios, Dingo logs a warning and ignores the key. Dingo no longer reads DINGO_LEIOS_VOTER_PUBLIC_KEYS; the vote key must be registered on chain for the pool.

  • Remote signing agent — spec.blockProducer.signingAgent signs block headers through a remote Bursa KES agent, so the KES key never reaches the node. The keys Secret then needs only vrf.skey and the opcert: kes.skey is not required, checked, staged or passed to Dingo (one left in the Secret is ignored and noted in the KeysValid message), and the opcert is not bound to a local KES key, since Dingo checks it against the agent when it connects. Every other check, and the optional vote key, are unchanged. The operator sets Dingo's CARDANO_SHELLEY_KES_AGENT_* variables instead of CARDANO_SHELLEY_KES_KEY and refuses spec.environment overrides of them. The link is TLS unless plaintext is set; serverSpkiSha256 pins the agent's key, and clientCertSecretRef names a Secret with tls.crt and tls.key, mounted read-only and read by the operator with the same grant as the keys Secret. While that Secret is missing, holds only half the pair, or does not load as a matching PEM pair, the pod template is held as for a refused keys bundle. Dingo loads the client certificate at startup, so the operator rolls the pod when tls.crt or tls.key changes, through a separate checksum annotation that leaves the keys checksum alone. The canonical Dingo image must be one that reads the remote agent settings; the default image and older tags are refused as InvalidSpec before the pod template changes. Dingo v0.93.0 is the first release that qualifies, so set spec.image.tag to v0.93.0 or later. Agent profiles, which let one agent serve several pools, need v0.94.0 or later; the operator does not check this. Custom repositories and tags that are not a version are trusted, as for spec.tracing. plaintext takes neither a pin nor a client certificate. The field is named for signing in general: Leios vote signing can move to the agent once Dingo and Bursa support it.

    rotation.mode: Auto rotates the key through the agent's control role on the same address. When rotation is due the operator runs gen-staged-key for the pool's profile (controlProfile, which may be omitted when the agent has one profile), has the cold signer issue the opcert for the returned verification key at the on-chain counter plus one, runs install-key, and writes the public opcert back to the keys Secret. No KES private key is created or stored by the operator. The agent admits only a client whose key is pinned in control_client_spki_sha256 on that profile, so Auto needs controlClientCertSecretRef (a Secret with tls.crt and tls.key, read by the operator and never mounted into the node), TLS and serverSpkiSha256, which pins the control connection too. An agent that keeps keys in memory only loses them on restart and then reports no active key for the profile, refusing sign sessions, so the producer cannot forge. Under Auto the operator asks the agent's info about once a minute while the node is not due, and when the profile holds no key it issues one as above without waiting for the rotation to be due, once the on-chain counter is known and no failed attempt is backing off. An info that fails is not taken as a missing key. A pool list does the same per pool, with the pool's agentProfile, for each pool whose KES state the node reported in that reconcile; the node loads its credentials from the opcert, so a running pod reports a pool whether or not the agent holds its key. The same check runs when rotation is due and the staged opcert is still fresh. A step that fails before install-key leaves the previous key serving and the Secret unchanged, and retries after ten minutes as Auto does without an agent, reported in the OpCertIssued condition. A failure after install-key, such as a lost Secret write, is repaired on the retry: the operator reads the agent's info and, when the agent serves the next counter signed by the pool's cold key, writes that opcert instead of issuing another; when info does not answer, the attempt fails and is retried rather than issuing. The repair does not wait for the rotation to be due again: once the node reports forging with a counter above the Secret's, the operator writes the opcert the agent serves, even after the chain has recorded that counter. Auto requires rotation.reloadInPlace. The node takes the new opcert from the agent, and a node that already reports the new counter when the Secret is judged is not rolled onto it. Dingo starts only when the opcert in the keys Secret is the one the agent serves, or an older one for the same pool, so under Auto a delivered bundle with any other opcert is refused (KeysValid False, OpCertRejected) and the pod keeps running on what it loaded. While the agent does not answer, a new bundle is held with reason OpCertUnverified.

    Bursa authorizes an operational certificate through the caller's grant, which lists the exact KES verification keys it may certify (opcerts[].kes_vkeys), trusts the agent that staged the key (opcerts[].kes_agents, below), or both. When that grant refuses a new key, status.conditions[OpCertIssued].message includes the verification key in hex. Grant that key in the Bursa caller's opcerts[].kes_vkeys; the next retry offers the same key. For a local KES key, the operator retains it as kes.pending.skey in the keys Secret, promotes it to kes.skey after issuance, and removes the pending entry. For a signing agent, the operator reuses the agent's staged key. The pending key does not trigger a rollout.

    When the agent returns a staged_key_attestation with the staged key, the operator sends it to Bursa as attestation in the opcert request. Bursa decides such a request on the attestation alone, so it is accepted when the caller's grant trusts the agent through opcerts[].kes_agents. An agent with an attestation identity attests every key. A grant that lists only kes_vkeys therefore refuses the attested request, and the operator offers the same key again in that attempt without the attestation, which that grant accepts. If both are refused, the message names the key in hex to grant and keeps the reason the attestation was refused. Info does not report the attestation, so the operator reuses a staged key only while it still holds the attestation it received with that key (it is held in memory). After an operator restart the agent stages a new key instead.

    blockProducer:
      poolId: <pool id, bech32 or hex>
      keys: { secretRef: producer-pool-keys }   # vrf.skey + opcert.cert
      rotation: { mode: Assisted }
      signingAgent:
        address: kes-agent.signing.svc:7000
        serverSpkiSha256: <64 hex characters>
        clientCertSecretRef: kes-agent-client
        # only with rotation.mode: Auto
        # controlClientCertSecretRef: kes-agent-control
        # controlProfile: pool-a
    
  • Several pools per node — spec.blockProducer.pools lists the pools one node forges for (Dingo v0.94.0 or later, which the operator checks). Each entry has a poolId (bech32 or hex), keys.secretRef (that pool's vrf.skey and opcert) and an agentProfile; all share spec.blockProducer.signingAgent, which is required, since a pool list holds no local KES keys. It replaces poolId and keys: setting either beside pools is refused, as are duplicate pool IDs and duplicate agent profiles. The operator renders the list as Dingo's blockProducerPools in a ConfigMap (<name>-pools) mounted at /etc/dingo/dingo.yaml, the file the Dingo image reads when it is given no --config, stages each pool's keys under /keys/<pool id>/, and sets none of Dingo's single-pool variables (CARDANO_SHELLEY_VRF_KEY, _KES_KEY, _OPERATIONAL_CERTIFICATE and the _KES_AGENT_* settings, with or without the CARDANO_ prefix), which Dingo refuses beside a pool list; spec.environment may not set them either. More than one pool is refused with Leios: a vote key in any pool's Secret leaves that pool out, and DINGO_RUN_MODE=leios (or CARDANO_DINGO_RUN_MODE, which Dingo reads first) or the Musashi network refuses the spec.

    Each pool's bundle is validated on its own, against its own pool ID and counters. A pool whose bundle fails (a missing Secret included) is left out of the pool list, the pod rolls once, and the others keep forging; the pool is reported in status.pools with keysValid: false and the reason, and the node is Degraded. Only when every bundle fails is the node refused as a whole and its live pod template kept, as for a refused single-pool bundle; the pools that template runs are still observed. In Auto rotation, a pool refused because its Secret holds an older opcert than one installed in the signing agent (its Secret write failed) is not left out: the live pod template is kept until the operator writes the agent's opcert back to the Secret. The counter is recorded in the pool's status.pools[].pendingInstallCounter before the agent installs it, and kept until an accepted bundle reaches it. status.pools also holds each pool's on-disk, on-chain (one node-to-client query reads all of them) and loaded opcert counters and KES periods, read from the pool_id-labelled series Dingo exposes with several pools, for every pool the running pod stages whatever its bundle's verdict. A pod running one pool exposes its series unlabelled; they are attributed by the dingo.blinklabs.io/keys-pool annotation of the scraped pod, read before and after the scrape, not by the StatefulSet template, which during a roll already records the next pools. When that pod changed between the reads or records no pools, unlabelled series are attributed to no pool, and pools without labelled series keep their status. status.kes is the pool with the fewest KES periods left, and RotationDue is true while any pool is due.

    rotation.mode may be Assisted, MonitorOnly or Auto. With Auto the operator rotates each pool that is due on its own KES state, as for a single pool above but through that pool's agentProfile and into that pool's keys.secretRef only: a pool that is not due is left alone, and the agent is not contacted while none is. A pool's refusal (an unread on-chain counter, say) does not hold back another; each attempted pool is reported in the OpCertIssued condition and as an Event naming it. The same prerequisites apply (controlClientCertSecretRef, TLS, serverSpkiSha256, reloadInPlace, nodeToClient.enabled, a cold signer that can issue), except that controlProfile is refused, since each pool names its profile, and a Bursa signer's coldKeyHash must be left empty, since the signer is asked for each pool's own cold key. The secret signer holds one cold key, so it is refused for more than one pool, and on mainnet as for a single pool. A pool whose Secret write failed after the agent installed its new key is repaired from what the agent serves, as for a single pool. An agent that lost a pool's key is not re-keyed. In Assisted, a new opcert in one pool's Secret reaches Dingo without rolling the pod: a container beside Dingo stages it once the operator has validated and approved it, and Dingo reloads it on its key file watch. Only a change to a pool's other Secret entries (its VRF key, vote key, anything but the opcert), to its profile or to the agent settings, or adding, removing or leaving out a pool, rolls the pod. MonitorOnly reports key-bundle changes, withdraws staging approval, and does not roll the pod for those key changes.

    blockProducer:
      signingAgent:
        address: kes-agent.signing.svc:7000
        serverSpkiSha256: <64 hex characters>
        clientCertSecretRef: kes-agent-client
      rotation: { mode: Assisted }
      pools:
        - poolId: <pool id, bech32 or hex>
          keys: { secretRef: pool-a-keys }     # vrf.skey + opcert.cert
          agentProfile: pool-a
        - poolId: <pool id, bech32 or hex>
          keys: { secretRef: pool-b-keys }
          agentProfile: pool-b
    
  • Operational metrics — the optional PodMonitor scrapes Dingo's complete Prometheus endpoint, including blockfetch delay and fetch duration, ledger block-apply batch latency, and the KES/opcert metrics used for status and rotation monitoring. Series carry the pod's cardano_network, cardano_service and spec.podLabels labels, and instance is the pod name. Grafana dashboards and Prometheus alert rules for the operator and its nodes are in docs/dashboards⁠.

  • Tracing and logging — spec.tracing exports OpenTelemetry spans over OTLP/HTTP (endpoint, service name defaulting to the node name, sample ratio) and needs a Dingo image of v0.82.0 or later, which the operator checks before rendering. spec.tracing.alwaysSamplePools (bech32 or hex pool IDs, up to 64) traces those pools' blocks whatever the sample ratio. spec.otlp exports the node's logs and metrics over OTLP through the standard OTEL_* variables: endpoint, protocol (grpc or http/protobuf), logs, metrics, a headersSecretRef for OTEL_EXPORTER_OTLP_HEADERS, and extra resourceAttributes. OTEL_RESOURCE_ATTRIBUTES always carries the pod, namespace and node names (from the downward API) and cardano.network.name; otlp: {} adds only those attributes, for example to traces. Stdout logs and /metrics are unaffected. Both need Dingo v0.91.0 or later, checked before rendering. The OTLP endpoint, protocol and headers are the generic settings, so traces use them too when tracing has no endpoint of its own. spec.logging sets the node's log level and format; json suits Loki or ELK.

  • On-chain counter floor — with blockProducer.nodeToClient.enabled, the operator reads the pool's authoritative opcert counter from the node over node-to-client local-state-query, publishes it as status.opcert.onChainCounter, and refuses a delivered certificate numbered below it (the chain would reject blocks forged with it). It fails open: an unreachable or unsynced node falls back to the operator's own last accepted counter, and the OnChainCounterAvailable condition says which applies. The operator dials the pods through the headless Service, in ordinal order, so a pod that is not ready yet (a producer waiting for its first KES key) is still read. The counter is read at the node's immutable tip, so a block that is later rolled back cannot lower a reading that was acted on, and a lower reading replaces a stored one older than 15 minutes. The OpCertCounterConsistent condition is False, with reason AheadOfChain, while the highest opcert counter any replica has loaded is more than one above an on-chain counter read within the last 15 minutes. It only reports, and it is removed while no such pair can be compared: an older reading, a failed scrape, or no loaded opcert. Reaching the port also needs the label dingo.blinklabs.io/node-to-client=allowed on the client pod — see the NetworkPolicy note below.

  • OpCert rotation — MonitorOnly, Assisted, or full Auto issuance via a pluggable cold signer: Bursa keeps cold keys out of the cluster, while the in-cluster secret signer holds the cold key in a Secret and is for testnets only. See Cold signer and Auto rotation⁠.

  • Safe HA — SingleActive is the only supported strategy: exactly one forger, with reschedule on failure. ActiveStandby is rejected by validation until fenced failover is implemented. A block producer gets a PodDisruptionBudget that keeps its one pod available, so kubectl drain of its node does not complete. Set spec.blockProducer.podDisruptionBudget.enabled: false to let a drain evict it; the operator then deletes the budget. A producer that signs through spec.blockProducer.signingAgent may run several pods with spec.replicas; status.replicas reports each one. Every pod forges, so the agent must refuse a second header for a signed slot: a Bursa KES agent of v0.23.0 or later does, and every pod must reach the same agent guard. A producer moving from a local KES key to an agent scales up only after its pods have rolled onto the agent.

  • Secure by default — non-root, read-only root filesystem with writable /tmp and /ipc volumes, dropped capabilities, no privilege escalation, RuntimeDefault seccomp, no node service-account token, least-privilege RBAC, and ingress NetworkPolicies for all nodes (default-deny for block producers, with relay peers limited to node-to-node traffic). Node-to-client (port 3002) is closed unless a client opts in: label the client pod dingo.blinklabs.io/node-to-client=allowed, and its namespace too when it is not the node's own. That label is the only way in — peers named in topology.relayRefs get the node-to-node port (relayService.port, default 3001) and nothing else. Dingo also binds node-to-client to loopback until blockProducer.nodeToClient.enabled is set, so both the listener and the policy have to be opened deliberately. Metrics also require an explicit grant: label the operator and Prometheus client pods dingo.blinklabs.io/metrics=allowed, and their namespaces too when they differ from the node's. Apply these labels before upgrading; otherwise status and KES monitoring cannot scrape nodes. Metrics access does not grant node-to-client access. Set spec.image.digest to pin immutable image content; it overrides the tag in container references. New digest references also require spec.image.capabilityVersion, set to the Dingo release contained in the image. The operator uses that version to select the UID, health probes and optional feature support. Existing digest and tag pairs retain their current behavior while the digest and tag remain unchanged and no capability version was previously declared; add capabilityVersion before changing either value. Once declared, it must remain set while the image is digest-pinned.

Only one block producer may forge per pool on a network. When two DingoNodes on the same network share a pool ID (any namespace, hex or bech32), or share a keys Secret (same namespace, whatever network each names), the older one by creation time, then namespace/name, keeps the keys. The newer is set Degraded=True and Ready=False with reason DuplicateForger, its StatefulSet is scaled to zero if it exists (across namespaces only when the older node's keys Secret holds the pool's keys, as described below), and it is re-checked every requeue interval. One cold key may register the same pool ID on several networks, so a pool shared across networks is not a conflict. The network is the one Dingo gets from the node's effective environment, including spec.environment overrides, and for a workload from the environment of its dingo container: CARDANO_NETWORK_MAGIC when it is a non-zero number, the magic of the named CARDANO_NETWORK when the magic is unset or zero. A network that cannot be resolved (an unparseable or out-of-range magic, an unknown name, a value from a Secret or ConfigMap, envFrom, a container command or arguments, which can override it, or no dingo container) matches any network. Copies of one key bundle under different Secret names count as the same keys: the pool is also read from the cold key in the opcert. The newer node resumes only after the older DingoNode is gone and its StatefulSet is scaled to zero or removed with all its pods finished, since deleting a DingoNode does not stop its pod at once. Likewise the

Tag summary
Recent tags
Content type
Image
Digest
sha256:64909ffd9…
Size
21.1 MB
Last updated
7 days ago
docker pull blinklabs/dingo-operator:latest