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 ¶
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 ¶
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.