platform

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: MIT Imports: 37 Imported by: 0

Documentation

Overview

Package platform owns the single-controller PaaS foundation installed on the first Tako node. It is separate from application desired state.

Index

Constants

View Source
const (
	EnrollmentInspectionKind = "PlatformEnrollmentInspection"
	EnrollmentNotEnrolled    = "not-enrolled"
	EnrollmentIncomplete     = "incomplete"
	EnrollmentEnrolled       = "enrolled"

	EnrollmentActionInitialize        = "initialize"
	EnrollmentActionResumeInit        = "resume-platform-init"
	EnrollmentActionRepairWorker      = "repair-worker-enrollment"
	EnrollmentActionRecoverState      = "recover-platform-state"
	EnrollmentActionUseExisting       = "use-existing-cluster"
	IdentityVerificationVerified      = "verified"
	IdentityVerificationPermission    = "permission-limited"
	MembershipComparisonMatches       = "matches-published-inventory"
	MembershipComparisonStale         = "published-inventory-stale"
	MembershipComparisonPermission    = "permission-limited"
	MembershipComparisonNotApplicable = "not-applicable"

	DefaultPlatformConfigPath = "/etc/tako/platform.json"
	DefaultWorkerUnitPath     = "/etc/systemd/system/" + WorkerUnitName
)
View Source
const (
	MembershipKind           = "PlatformMembership"
	DefaultMembershipName    = "membership.json"
	DefaultMembershipDirName = "control"
	DefaultJoinTokenTTL      = 15 * time.Minute
	MaximumJoinTokenTTL      = 24 * time.Hour
	DefaultPlatformMeshCIDR  = "10.210.0.0/16"
)
View Source
const (
	RemovalPhaseRevokePeers   = "revoke-peers"
	RemovalPhaseRemoveMember  = "remove-membership"
	RemovalPhaseCleanupTarget = "cleanup-target"
)
View Source
const (
	TakodUnitName  = "takod.service"
	WorkerUnitName = "tako-platform-worker.service"
)
View Source
const (
	APIVersion         = "tako.io/v1"
	BootstrapKind      = "PlatformBootstrap"
	PolicyKind         = "PlatformResourcePolicy"
	DefaultStateDir    = "/var/lib/tako/platform"
	DefaultConfigDir   = "/etc/tako"
	DefaultAuditDir    = "/var/log/tako"
	DefaultWorkerUser  = "tako-platform"
	DefaultWorkerGroup = "tako-platform"
	// DefaultSocketGroup is the legacy operator group granted access only to
	// the protected worker ingress. The root takod socket belongs to the
	// dedicated worker group and is never exposed directly to operators.
	DefaultSocketGroup  = "tako"
	DefaultSocket       = "/run/tako/takod.sock"
	DefaultWorkerSocket = "/run/tako-platform/worker.sock"
	DefaultBinaryPath   = "/usr/local/lib/tako/tako"
	DefaultJournalName  = "operations.jsonl"
	DefaultAuditLogName = "platform-audit.jsonl"
)
View Source
const DefaultPlatformMeshKeyDir = "/etc/tako/wireguard"

Variables

View Source
var (
	ErrOperationExists = errors.New("platform operation already exists")
)

Functions

func ControllerRecoveryKeyFingerprint

func ControllerRecoveryKeyFingerprint(publicKey string) (string, error)

func DefaultMembershipPath

func DefaultMembershipPath(stateDir string) string

func EnsureMeshPublicKey

func EnsureMeshPublicKey(keyDir string) (string, error)

EnsureMeshPublicKey creates one durable WireGuard private key, or derives the public identity from the existing protected key. The key is compatible with wg(8)'s base64 file format and is never returned to the caller.

func OpenControllerMembership

func OpenControllerMembership(stateDir, identityPath, inventoryPath string) (*MembershipStore, *MembershipState, error)

OpenControllerMembership opens the protected local controller store only when the caller is root on the exact immutable controller node.

func RenderTakodUnit

func RenderTakodUnit(binaryPath string, socketPath string, stateDir string, nodeName string, identityPath string, dockerDataRoot string, socketGroup string, policy ResourcePolicy) (string, error)

func RenderWorkerUnit

func RenderWorkerUnit(config BootstrapConfig) (string, error)

func RunningAsRoot

func RunningAsRoot() bool

func ValidateControllerRecoverySnapshot

func ValidateControllerRecoverySnapshot(membershipPath, inventoryPath string, installation *nodeidentity.Installation) error

ValidateControllerRecoverySnapshot proves that the protected membership and published inventory are the exact authority owned by this controller key. The caller must hold the node-wide exclusive recovery snapshot lock.

Types

type AdmissionController

type AdmissionController struct {
	// contains filtered or unexported fields
}

func NewAdmissionController

func NewAdmissionController(policy ResourcePolicy, disk DiskProbe, path string) (*AdmissionController, error)

func (*AdmissionController) Admit

func (a *AdmissionController) Admit(ctx context.Context, effect OperationEffect) (func(), error)

type AgentOperationExecutor

type AgentOperationExecutor struct{ Agent StructuredAgent }

func (AgentOperationExecutor) Execute

func (AgentOperationExecutor) ExecuteResult

func (AgentOperationExecutor) Plan

type AgentRequestPayload

type AgentRequestPayload struct {
	Method   string          `json:"method"`
	Endpoint string          `json:"endpoint"`
	Body     json.RawMessage `json:"body,omitempty"`
}

type AllocationHighWater

type AllocationHighWater struct {
	NodeID      string `json:"nodeId"`
	Key         string `json:"key"`
	Generation  uint64 `json:"generation"`
	Fingerprint string `json:"fingerprint"`
	Revoked     bool   `json:"revoked,omitempty"`
}

AllocationHighWater is a durable replay tombstone. It survives omission from ActiveAllocations so a withdrawn worker proof cannot later be replayed.

type BootstrapConfig

type BootstrapConfig struct {
	RootDir             string
	NodeName            string
	ClusterID           string
	NodeID              string
	IdentityPath        string
	StateDir            string
	ConfigDir           string
	AuditDir            string
	SocketPath          string
	WorkerSocketPath    string
	DockerDataRoot      string
	BinaryPath          string
	ServiceBinaryPath   string
	WorkerUser          string
	WorkerGroup         string
	SocketGroup         string
	Policy              ResourcePolicy
	WorkerUserExplicit  bool
	WorkerGroupExplicit bool
	PolicyExplicit      bool
	RequireRoot         bool
	Now                 func() time.Time
}

func (BootstrapConfig) Validate

func (c BootstrapConfig) Validate() error

type BootstrapResult

type BootstrapResult struct {
	State       BootstrapState `json:"state"`
	Policy      ResourcePolicy `json:"policy"`
	Resumed     bool           `json:"resumed"`
	JournalPath string         `json:"journalPath"`
	AuditPath   string         `json:"auditPath"`
}

type BootstrapState

type BootstrapState struct {
	APIVersion        string    `json:"apiVersion"`
	Kind              string    `json:"kind"`
	ClusterID         string    `json:"clusterId"`
	NodeID            string    `json:"nodeId"`
	NodeName          string    `json:"nodeName"`
	ControllerMode    string    `json:"controllerMode"`
	EnrollmentRoles   []string  `json:"enrollmentRoles"`
	IdentityPath      string    `json:"identityPath"`
	InventoryPath     string    `json:"inventoryPath"`
	MembershipPath    string    `json:"membershipPath"`
	StateDir          string    `json:"stateDir"`
	AuditDir          string    `json:"auditDir"`
	SocketPath        string    `json:"socketPath"`
	WorkerSocketPath  string    `json:"workerSocketPath"`
	DockerDataRoot    string    `json:"dockerDataRoot"`
	SocketGroup       string    `json:"socketGroup"`
	ServiceBinaryPath string    `json:"serviceBinaryPath"`
	WorkerUser        string    `json:"workerUser"`
	WorkerGroup       string    `json:"workerGroup"`
	WorkerUID         int       `json:"workerUid"`
	WorkerGID         int       `json:"workerGid"`
	SocketGroupGID    int       `json:"socketGroupGid"`
	InitializedAt     time.Time `json:"initializedAt"`
}

func (BootstrapState) Validate

func (s BootstrapState) Validate() error

type Bootstrapper

type Bootstrapper struct {
	// contains filtered or unexported fields
}

func NewBootstrapper

func NewBootstrapper(host Host) (*Bootstrapper, error)

func (*Bootstrapper) Bootstrap

func (b *Bootstrapper) Bootstrap(ctx context.Context, config BootstrapConfig) (*BootstrapResult, error)

type ConfigDocument

type ConfigDocument struct {
	State  BootstrapState `json:"state"`
	Policy ResourcePolicy `json:"policy"`
}

type DiskProbe

type DiskProbe interface {
	AvailableBytes(path string) (int64, error)
}

type EnrollWorkerRequest

type EnrollWorkerRequest struct {
	Reservation                     string
	NodeID                          string
	NodeName                        string
	MeshIP                          string
	MeshEndpoint                    string
	SSHHost                         string
	SSHPort                         int
	SSHUser                         string
	SSHHostKeyType                  string
	SSHHostKey                      string
	SSHHostKeyFingerprint           string
	AllocationPublicKey             string
	MeshPublicKey                   string
	ControllerMeshEndpoint          string
	ControllerSSHHost               string
	ControllerSSHPort               int
	ControllerSSHUser               string
	ControllerSSHHostKeyType        string
	ControllerSSHHostKey            string
	ControllerSSHHostKeyFingerprint string
}

type EnrollmentInspection added in v0.11.0

type EnrollmentInspection struct {
	APIVersion              string     `json:"apiVersion"`
	Kind                    string     `json:"kind"`
	Status                  string     `json:"status"`
	ClusterID               string     `json:"clusterId,omitempty"`
	NodeID                  string     `json:"nodeId,omitempty"`
	NodeName                string     `json:"nodeName,omitempty"`
	EnrollmentRoles         []string   `json:"enrollmentRoles,omitempty"`
	PublishedRoles          []string   `json:"publishedRoles,omitempty"`
	PublishedLifecycle      string     `json:"publishedLifecycle,omitempty"`
	PublishedSchedulable    bool       `json:"publishedSchedulable"`
	WorkerUID               int        `json:"workerUid,omitempty"`
	InventoryGeneration     uint64     `json:"inventoryGeneration,omitempty"`
	InventoryUpdatedAt      *time.Time `json:"inventoryUpdatedAt,omitempty"`
	PublishedControllerID   string     `json:"publishedControllerNodeId,omitempty"`
	PublishedControllerName string     `json:"publishedControllerNodeName,omitempty"`
	LocalController         bool       `json:"localController"`
	IdentityVerification    string     `json:"identityVerification,omitempty"`
	MembershipComparison    string     `json:"membershipComparison,omitempty"`
	MembershipGeneration    uint64     `json:"membershipGeneration,omitempty"`
	NextAction              string     `json:"nextAction"`
	NextCommand             string     `json:"nextCommand,omitempty"`
	Detail                  string     `json:"detail,omitempty"`
	Warnings                []string   `json:"warnings,omitempty"`
	ResidualArtifacts       []string   `json:"residualArtifacts,omitempty"`
}

EnrollmentInspection is the credential-free description of this host's platform state. Published* fields are explicitly a local trust snapshot; they do not claim that the controller is reachable or currently live.

func InspectEnrollment added in v0.11.0

func InspectEnrollment(paths EnrollmentInspectionPaths) (*EnrollmentInspection, error)

InspectEnrollment reads create-once identity and root-published state. It never contacts a daemon, connects over SSH, or mutates the host. A protected identity that is unreadable to a non-root caller is clearly reported rather than silently treated as verified.

type EnrollmentInspectionPaths added in v0.11.0

type EnrollmentInspectionPaths struct {
	IdentityPath     string
	LocalBindingPath string
	InventoryPath    string
	ConfigPath       string
	MembershipPath   string
	WorkerUnitPath   string
	MeshKeyDir       string
}

type ExistingEnrollmentError added in v0.11.0

type ExistingEnrollmentError struct {
	ClusterID          string
	NodeID             string
	NodeName           string
	EnrollmentRoles    []string
	PublishedRoles     []string
	PublishedLifecycle string
	ControllerNodeID   string
	ControllerNodeName string
	Reason             string
}

ExistingEnrollmentError explains why platform init refused to reinterpret a create-once node identity as a new first controller.

func (*ExistingEnrollmentError) Error added in v0.11.0

func (e *ExistingEnrollmentError) Error() string

type Host

type Host interface {
	ResolveDockerDataRoot(context.Context, string) (string, error)
	EnsurePlatformAccounts(context.Context, string, string, string) (PlatformAccountIDs, error)
	StageBinary(context.Context, string, string) error
	InstallUnit(context.Context, string, string) error
	ReloadEnableRestart(context.Context, ...string) error
	WaitReady(context.Context, ReadinessCheck) error
}

type JoinToken

type JoinToken struct {
	Token          string    `json:"token"`
	ClusterID      string    `json:"clusterId"`
	ExpectedNodeID string    `json:"expectedNodeId"`
	ExpiresAt      time.Time `json:"expiresAt"`
}

type JoinTokenRecord

type JoinTokenRecord struct {
	ID                   string    `json:"id"`
	ExpectedNodeID       string    `json:"expectedNodeId"`
	TokenHash            string    `json:"tokenHash"`
	CreatedAt            time.Time `json:"createdAt"`
	ExpiresAt            time.Time `json:"expiresAt"`
	ConsumedAt           time.Time `json:"consumedAt,omitempty"`
	ReservationHash      string    `json:"reservationHash,omitempty"`
	ReservedAt           time.Time `json:"reservedAt,omitempty"`
	ReservationExpiresAt time.Time `json:"reservationExpiresAt,omitempty"`
}

type JoinTokenReservation

type JoinTokenReservation struct {
	Reservation    string    `json:"reservation"`
	ExpectedNodeID string    `json:"expectedNodeId"`
	ExpiresAt      time.Time `json:"expiresAt"`
}

type Journal

type Journal struct {
	// contains filtered or unexported fields
}

func NewJournal

func NewJournal(path string) (*Journal, error)

func (*Journal) Append

func (j *Journal) Append(record OperationRecord) error

type LocalHost

type LocalHost struct{}

func (LocalHost) EnsurePlatformAccounts

func (LocalHost) EnsurePlatformAccounts(ctx context.Context, user string, group string, accessGroup string) (PlatformAccountIDs, error)

func (LocalHost) InstallUnit

func (LocalHost) InstallUnit(_ context.Context, name string, content string) error

func (LocalHost) ReloadEnableRestart

func (LocalHost) ReloadEnableRestart(ctx context.Context, names ...string) error

func (LocalHost) ResolveDockerDataRoot

func (LocalHost) ResolveDockerDataRoot(ctx context.Context, requested string) (string, error)

func (LocalHost) StageBinary

func (LocalHost) StageBinary(_ context.Context, source string, destination string) error

func (LocalHost) WaitReady

func (LocalHost) WaitReady(ctx context.Context, check ReadinessCheck) error

type MembershipNode

type MembershipNode struct {
	NodeID                string    `json:"nodeId"`
	NodeName              string    `json:"nodeName"`
	Lifecycle             string    `json:"lifecycle"`
	Roles                 []string  `json:"roles"`
	Schedulable           bool      `json:"schedulable"`
	MeshIP                string    `json:"meshIp,omitempty"`
	MeshEndpoint          string    `json:"meshEndpoint"`
	MeshCredentialID      string    `json:"meshCredentialId"`
	MeshPublicKey         string    `json:"meshPublicKey"`
	MeshCredentialStatus  string    `json:"meshCredentialStatus"`
	SSHHost               string    `json:"sshHost,omitempty"`
	SSHPort               int       `json:"sshPort,omitempty"`
	SSHUser               string    `json:"sshUser,omitempty"`
	SSHHostKeyType        string    `json:"sshHostKeyType,omitempty"`
	SSHHostKey            string    `json:"sshHostKey,omitempty"`
	SSHHostKeyFingerprint string    `json:"sshHostKeyFingerprint,omitempty"`
	AllocationPublicKey   string    `json:"allocationPublicKey"`
	JoinedAt              time.Time `json:"joinedAt"`
	UpdatedAt             time.Time `json:"updatedAt"`
}

type MembershipState

type MembershipState struct {
	APIVersion           string                          `json:"apiVersion"`
	Kind                 string                          `json:"kind"`
	ClusterID            string                          `json:"clusterId"`
	Generation           uint64                          `json:"generation"`
	AllocationGeneration uint64                          `json:"allocationGeneration,omitempty"`
	ControllerNodeID     string                          `json:"controllerNodeId"`
	MeshCIDR             string                          `json:"meshCidr,omitempty"`
	Nodes                []MembershipNode                `json:"nodes"`
	Tombstones           []nodeidentity.NodeTombstone    `json:"tombstones,omitempty"`
	JoinTokens           []JoinTokenRecord               `json:"joinTokens,omitempty"`
	ActiveAllocations    []nodeidentity.ActiveAllocation `json:"activeAllocations,omitempty"`
	AllocationHighWater  []AllocationHighWater           `json:"allocationHighWater,omitempty"`
	RemovalOperations    []NodeRemovalOperation          `json:"removalOperations,omitempty"`
	UpdatedAt            time.Time                       `json:"updatedAt"`
}

func (MembershipState) ActiveNode

func (s MembershipState) ActiveNode(nodeID string) (*MembershipNode, bool)

func (MembershipState) Inventory

func (MembershipState) IsTombstoned

func (s MembershipState) IsTombstoned(nodeID string) bool

func (MembershipState) RemovalOperation

func (s MembershipState) RemovalOperation(nodeID string) (*NodeRemovalOperation, bool)

func (MembershipState) Validate

func (s MembershipState) Validate(now time.Time) error

type MembershipStore

type MembershipStore struct {
	// contains filtered or unexported fields
}

func NewMembershipStore

func NewMembershipStore(path, inventoryPath string) (*MembershipStore, error)

func NewMembershipStoreWithinMutationBarrier

func NewMembershipStoreWithinMutationBarrier(path, inventoryPath string) (*MembershipStore, error)

NewMembershipStoreWithinMutationBarrier opens a store for a caller that already holds the node-upgrade lifecycle guard followed by the recovery mutation barrier. It prevents a nested reverse-order acquisition.

func (*MembershipStore) AuthorizeAllocations

func (s *MembershipStore) AuthorizeAllocations(project, environment string, allocations []nodeidentity.ActiveAllocation) (*MembershipState, error)

AuthorizeAllocations replaces the complete controller-authorized allocation set for one project/environment. Omission is intentional revocation, so a stale node proof cannot remain routable after the desired scope changes.

func (*MembershipStore) BeginDrain

func (s *MembershipStore) BeginDrain(nodeID string) (*MembershipNode, error)

func (*MembershipStore) CommitPreparedAllocations

func (s *MembershipStore) CommitPreparedAllocations(candidate *MembershipState, baseGeneration, baseAllocationGeneration uint64) (*MembershipState, error)

CommitPreparedAllocations atomically persists the exact state previously signed and acknowledged by edge nodes. The base generations provide the compare-and-swap boundary against unrelated controller changes.

func (*MembershipStore) CompleteRemoval

func (s *MembershipStore) CompleteRemoval(nodeID string) error

func (*MembershipStore) Cordon

func (s *MembershipStore) Cordon(nodeID string) (*MembershipNode, error)

func (*MembershipStore) CreateJoinToken

func (s *MembershipStore) CreateJoinToken(expectedNodeID string, ttl time.Duration) (*JoinToken, error)

func (*MembershipStore) EnrollWorker

func (s *MembershipStore) EnrollWorker(request EnrollWorkerRequest) (*MembershipNode, error)

func (*MembershipStore) InitializeFirstNode

func (s *MembershipStore) InitializeFirstNode(installation nodeidentity.Installation, meshCIDR, meshPublicKey, meshEndpoint string) (*MembershipState, error)

func (*MembershipStore) MarkReady

func (s *MembershipStore) MarkReady(nodeID string) (*MembershipNode, error)

func (*MembershipStore) MarkRemovalPeersRevoked

func (s *MembershipStore) MarkRemovalPeersRevoked(nodeID string) (*NodeRemovalOperation, error)

func (*MembershipStore) MarkSchedulable

func (s *MembershipStore) MarkSchedulable(nodeID string) (*MembershipNode, error)

func (*MembershipStore) PrepareRemoval

func (s *MembershipStore) PrepareRemoval(nodeID string) (*NodeRemovalOperation, error)

PrepareRemoval durably records enough immutable target state to resume a revoke-first removal even after membership deletion or a controller crash.

func (*MembershipStore) PreviewAllocations

func (s *MembershipStore) PreviewAllocations(project, environment string, allocations []nodeidentity.ActiveAllocation) (*MembershipState, error)

PreviewAllocations produces the exact next membership state without committing it. The controller uses this for publish-before-commit routing transitions: every edge must acknowledge the signed candidate first.

func (*MembershipStore) Read

func (s *MembershipStore) Read() (*MembershipState, error)

func (*MembershipStore) Remove

func (s *MembershipStore) Remove(nodeID string) (*nodeidentity.NodeTombstone, error)

func (*MembershipStore) ReserveJoinToken

func (s *MembershipStore) ReserveJoinToken(token, nodeID string) (*JoinTokenReservation, error)

ReserveJoinToken authenticates the bound join request before any create-once candidate identity is mutated. Re-presenting the original token replaces an abandoned reservation without weakening single-use consumption.

func (*MembershipStore) SetNodeMeshEndpoint

func (s *MembershipStore) SetNodeMeshEndpoint(nodeID, endpoint string) (*MembershipNode, error)

type NodeRemovalOperation

type NodeRemovalOperation struct {
	Node       MembershipNode `json:"node"`
	Phase      string         `json:"phase"`
	Generation uint64         `json:"generation"`
	CreatedAt  time.Time      `json:"createdAt"`
	UpdatedAt  time.Time      `json:"updatedAt"`
}

NodeRemovalOperation retains the immutable target identity and durable progress needed to resume removal after any controller or network failure.

type OSDiskProbe

type OSDiskProbe struct{}

func (OSDiskProbe) AvailableBytes

func (OSDiskProbe) AvailableBytes(path string) (int64, error)

type OperationEffect

type OperationEffect struct {
	DiskGrowth bool
	Build      bool
}

type OperationEngine

type OperationEngine struct {
	// contains filtered or unexported fields
}

func NewOperationEngine

func NewOperationEngine(store *OperationStore, executor OperationExecutor, admission *AdmissionController, maxOps int) (*OperationEngine, error)

func (*OperationEngine) Run

func (e *OperationEngine) Run(ctx context.Context) error

type OperationExecutor

type OperationExecutor interface {
	Plan(OperationSpec) (OperationPlan, error)
	Execute(context.Context, OperationSpec) error
}

type OperationPlan

type OperationPlan struct {
	OperationEffect
	ReplaySafe bool
}

OperationPlan is derived by the trusted executor from the validated endpoint and body. Resource and replay behavior must never be accepted from the operation producer.

type OperationRecord

type OperationRecord struct {
	OperationID string         `json:"operationId"`
	Operation   string         `json:"operation"`
	Phase       string         `json:"phase"`
	Status      string         `json:"status"`
	NodeID      string         `json:"nodeId,omitempty"`
	Message     string         `json:"message,omitempty"`
	Metadata    map[string]any `json:"metadata,omitempty"`
	Timestamp   time.Time      `json:"timestamp"`
}

type OperationResult

type OperationResult struct {
	Body        []byte
	Status      int
	ContentType string
	// KnownFailure means the upstream returned an authoritative HTTP
	// rejection. It is a failed durable outcome, not an uncertain transport
	// error, and Body/Status remain safe to relay to the caller.
	KnownFailure bool
}

type OperationSpec

type OperationSpec struct {
	APIVersion string          `json:"apiVersion"`
	ID         string          `json:"id"`
	Kind       string          `json:"kind"`
	Payload    json.RawMessage `json:"payload,omitempty"`
	CreatedAt  time.Time       `json:"createdAt"`
}

type OperationState

type OperationState struct {
	Spec                OperationSpec `json:"spec"`
	Status              string        `json:"status"`
	Phase               string        `json:"phase"`
	Attempts            int           `json:"attempts"`
	LastError           string        `json:"lastError,omitempty"`
	Response            string        `json:"response,omitempty"`
	ResponseStatus      int           `json:"responseStatus,omitempty"`
	ResponseContentType string        `json:"responseContentType,omitempty"`
	UpdatedAt           time.Time     `json:"updatedAt"`
}

type OperationStore

type OperationStore struct {
	// contains filtered or unexported fields
}

func NewOperationStore

func NewOperationStore(stateDir string, nodeID string, now func() time.Time) (*OperationStore, error)

func (*OperationStore) Enqueue

func (s *OperationStore) Enqueue(spec OperationSpec) error

func (*OperationStore) Read

func (s *OperationStore) Read(id string) (*OperationState, error)

type PassivePromotionProof

type PassivePromotionProof struct {
	ClusterID                string `json:"clusterId"`
	ControllerNodeID         string `json:"controllerNodeId"`
	ControllerKeyFingerprint string `json:"controllerKeyFingerprint"`
	MembershipGeneration     uint64 `json:"membershipGeneration"`
	ControllerMode           string `json:"controllerMode"`
	ActiveActive             bool   `json:"activeActive"`
}

PassivePromotionProof proves that a cold recovery staging tree contains one internally consistent single-writer controller bound to an externally held controller-key fingerprint. It never activates services.

func VerifyPassivePromotion

func VerifyPassivePromotion(stagedRoot string, expectedClusterID string, expectedKeyFingerprint string) (*PassivePromotionProof, error)

type PlatformAccountIDs

type PlatformAccountIDs struct {
	WorkerUID      int
	WorkerGID      int
	SocketGroupGID int
}

type ReadinessCheck

type ReadinessCheck struct {
	SocketPath       string
	WorkerSocketPath string
	WorkerUID        int
	ClusterID        string
	NodeID           string
	StateDir         string
	Since            time.Time
}

type ResourcePolicy

type ResourcePolicy struct {
	APIVersion              string `json:"apiVersion"`
	Kind                    string `json:"kind"`
	ReservedMemoryBytes     int64  `json:"reservedMemoryBytes"`
	ReservedDiskBytes       int64  `json:"reservedDiskBytes"`
	MinimumFreeDiskBytes    int64  `json:"minimumFreeDiskBytes"`
	MaximumConcurrentBuilds int    `json:"maximumConcurrentBuilds"`
	MaximumConcurrentOps    int    `json:"maximumConcurrentOperations"`
}

func DefaultResourcePolicy

func DefaultResourcePolicy() ResourcePolicy

func (ResourcePolicy) Validate

func (p ResourcePolicy) Validate() error

type RuntimeAgent

type RuntimeAgent interface {
	Status(context.Context) (*takodclient.AgentStatus, error)
	RequestJSON(context.Context, string, string, any) (string, error)
}

type StructuredAgent

type StructuredAgent interface {
	RequestJSON(context.Context, string, string, any) (string, error)
}

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

func NewWorker

func NewWorker(configPath string, stateDir string, socketPath string, agent RuntimeAgent, disk DiskProbe) (*Worker, error)

func (*Worker) Run

func (w *Worker) Run(ctx context.Context) error

type WorkerEnrollmentIdentity

type WorkerEnrollmentIdentity struct {
	ClusterID           string `json:"clusterId"`
	NodeID              string `json:"nodeId"`
	NodeName            string `json:"nodeName"`
	AllocationPublicKey string `json:"allocationPublicKey"`
	MeshPublicKey       string `json:"meshPublicKey"`
}

func PrepareWorkerIdentity

func PrepareWorkerIdentity(path, clusterID, nodeID, nodeName string, now time.Time) (*WorkerEnrollmentIdentity, bool, error)

PrepareWorkerIdentity is the candidate-side create-once enrollment step. It deliberately creates only immutable worker identity. The controller must still consume a bound join token and publish membership before the node can become ready or schedulable.

Jump to

Keyboard shortcuts

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