nodeclient

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: 8 Imported by: 0

Documentation

Overview

Package nodeclient selects and records how the engine reaches one enrolled Tako node. It does not decide workload placement or control authority.

Index

Constants

View Source
const (
	EvidenceLegacySSHDefault    = "legacy_ssh_default"
	EvidenceExplicitSSH         = "explicit_ssh"
	EvidenceInstallationMatch   = "installation_identity_match"
	EvidenceLocalProbeFailed    = "local_identity_probe_failed"
	EvidenceLocalIdentityAbsent = "local_installation_identity_absent"
	EvidenceLocalIdentityWrong  = "local_installation_identity_mismatch"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Decision

type Decision struct {
	Transport Transport `json:"transport"`
	Evidence  string    `json:"evidence"`
	NodeID    string    `json:"nodeId,omitempty"`
}

Decision is safe to include in plans, results, and audit records. It explains the preflight decision without exposing credentials.

func Resolve

func Resolve(ctx context.Context, policy Policy, expected nodeidentity.Reference, local IdentityProbe) (Decision, error)

Resolve selects one transport exactly once. It never attempts SSH and can therefore never turn an SSH failure into a local host mutation.

type Factory

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

Factory resolves and caches structured runtime clients independently from workload placement. Legacy server entries never probe the local socket.

func NewFactory

func NewFactory(cfg *config.Config, pool SSHPool, socket string) (*Factory, error)

NewFactory constructs a runtime client factory. pool may be nil only when every requested server is explicitly and successfully resolved as local.

func NewFactoryWithLocalSocket

func NewFactoryWithLocalSocket(cfg *config.Config, pool SSHPool, remoteSocket string, localSocket string) (*Factory, error)

NewFactoryWithLocalSocket allows tests and embedded engines to select a protected worker ingress path while keeping the remote takod socket path.

func (*Factory) Client

func (f *Factory) Client(ctx context.Context, serverName string) (*takodclient.AgentClient, Decision, error)

Client resolves transport before opening SSH. PolicyAuto never changes its decision after an SSH failure, so connectivity problems cannot become local host mutations. Enrolled SSH targets are identity-checked as well.

func (*Factory) CloseIdleConnections

func (f *Factory) CloseIdleConnections()

CloseIdleConnections releases runtime HTTP keepalives. The caller still owns and closes the SSH pool.

func (*Factory) Decision

func (f *Factory) Decision(serverName string) (Decision, bool)

Decision returns a previously resolved decision without causing a probe or connection. The bool is false until Client has successfully resolved it.

func (*Factory) SetOperationFenceSource

func (f *Factory) SetOperationFenceSource(source takodclient.OperationFenceSource)

SetOperationFenceSource binds renewable mutation authority to cached and future clients owned by this operation-scoped factory.

type IdentityProbe

type IdentityProbe interface {
	Status(context.Context) (*takodclient.AgentStatus, error)
}

IdentityProbe is the minimal local agent surface needed for transport resolution. AgentClient satisfies it.

type Policy

type Policy string

Policy is the configured transport-selection policy for one node.

const (
	// PolicySSH preserves the historical Tako behavior and never probes local
	// runtime state. An omitted policy has the same meaning.
	PolicySSH Policy = "ssh"
	// PolicyAuto selects local only after immutable identity attestation and
	// otherwise decides SSH before any SSH connection attempt.
	PolicyAuto Policy = "auto"
	// PolicyLocal requires immutable local identity attestation.
	PolicyLocal Policy = "local"
)

type SSHPool

type SSHPool interface {
	GetOrCreateWithAuth(host string, port int, user string, keyPath string, password string) (*ssh.Client, error)
}

SSHPool is the provisioning-owned connection pool capability needed to open an SSH direct-streamlocal runtime transport. No shell execution is exposed by Factory's result.

type Transport

type Transport string

Transport is the resolved runtime path. It is deliberately independent of scheduling and node roles.

const (
	TransportSSH   Transport = "ssh"
	TransportLocal Transport = "local"
)

Jump to

Keyboard shortcuts

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