nodeapi

package
v0.6.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package nodeapi is the transport nodes use to reach the control plane.

It is deliberately not part of the operator API contract: the audience, the credentials, and the shapes are different, and mixing them would let an operator token act as a node or a node credential reach operator surfaces.

Every exchange is initiated by the node. It opens one long-lived session and reads commands as newline-delimited JSON, and posts its events and command results back on separate paths. Nothing here dials a node, and a node needs no inbound listener and no exposed container runtime socket.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(registry Registry) http.Handler

New mounts the node protocol. The returned handler expects to be reached at its own prefix and never shares authentication with the operator API.

Types

type EnrollmentResponse

type EnrollmentResponse struct {
	NodeID         string `json:"node_id"`
	SessionToken   string `json:"session_token"`
	SessionExpires string `json:"session_expires"`
	FencingToken   uint64 `json:"fencing_token"`
	LeaseExpires   string `json:"lease_expires"`
}

EnrollmentResponse is what a machine receives for a redeemed invitation.

type EventBatch

type EventBatch struct {
	Events []node.Event `json:"events"`
}

EventBatch is what a node posts, including a spool it accumulated while disconnected. Every event carries an ID, so replaying the spool changes nothing.

type Registry

type Registry interface {
	Enroll(ctx context.Context, request capability.EnrollmentRequest) (capability.Enrollment, error)
	RenewSession(ctx context.Context, nodeID, sessionToken string) (capability.SessionRenewal, error)
	OpenSession(ctx context.Context, nodeID, sessionToken string) (*node.Session, error)
	CloseSession(session *node.Session)
	RecordEvents(ctx context.Context, nodeID, sessionToken string, events []node.Event) error
	RecordResult(ctx context.Context, nodeID, sessionToken string, result node.Result) error
}

Registry is what this transport needs from the node registry.

type SessionRenewalResponse

type SessionRenewalResponse struct {
	NodeID         string `json:"node_id"`
	SessionToken   string `json:"session_token"`
	SessionExpires string `json:"session_expires"`
	FencingToken   uint64 `json:"fencing_token"`
}

SessionRenewalResponse is a fresh credential for a session that already exists. It carries no lease, because renewing a credential renews no lease: what keeps a node believed alive is its heartbeat, and the two are separate on purpose.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL