takod

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: MIT Imports: 61 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CapabilityAcmeDNSV1 = "proxy.acme-dns-v1"

	ACMEDNSProviderCloudflare   = "cloudflare"
	ACMEDNSProviderHetzner      = "hetzner"
	ACMEDNSProviderDigitalOcean = "digitalocean"

	ACMEDNSCAProviderLetsEncrypt = "letsencrypt"
	ACMEDNSCAProviderZeroSSL     = "zerossl"
)
View Source
const (
	HealthStateHealthy   = "healthy"
	HealthStateStarting  = "starting"
	HealthStateUnhealthy = "unhealthy"
)

Docker health-check states surfaced in actual state and status rows.

View Source
const (
	BackupDir        = "/var/lib/tako/backups"
	DefaultRetention = 7
)
View Source
const (
	BackupStorageProviderS3           = "s3"
	BackupStorageProviderR2           = "r2"
	BackupStorageProviderS3Compatible = "s3-compatible"
)
View Source
const (
	ExecModeAttach = "attach"
	ExecModeOneOff = "oneoff"
)

Exec modes: attach runs the command inside a running replica via `docker exec`; oneoff runs it in a fresh `docker run --rm` container from the service's current image.

View Source
const (
	OperationFenceHeader     = "X-Tako-Operation-Fence"
	OperationHolderHeader    = "X-Tako-Operation-Holder"
	CapabilityOperationFence = "operation.controller-fence-v1"
)
View Source
const (
	JobRunStatusSucceeded = "succeeded"
	JobRunStatusFailed    = "failed"
	JobRunStatusTimeout   = "timeout"
	JobRunStatusSkipped   = "skipped"
)

Job run statuses.

View Source
const (
	JobTriggerSchedule = "schedule"
	JobTriggerManual   = "manual"
)

Job run triggers.

View Source
const (
	CertificateSourcePushed  = "pushed"
	CertificateSourceACMEDNS = "acme-dns"
)
View Source
const (
	ProxyDestinationRuntimeAlias = "runtime-alias"
	ProxyDestinationMesh         = "mesh-allocation"
)
View Source
const CapabilityContainerArgvV1 = "container.argv-v1"

CapabilityContainerArgvV1 means reconcile and job payloads preserve the container command/entrypoint argv fields introduced with config exec form.

View Source
const CapabilityContainerRuntimeControlsV1 = "container.runtime-controls-v1"

CapabilityContainerRuntimeControlsV1 covers user/workdir/stop/init/hosts, ulimits, and shm-size fields on service and job payloads.

View Source
const CapabilityExecOneOffControlsV1 = "exec.oneoff-controls-v1"

CapabilityExecOneOffControlsV1 covers pull auth, entrypoint, labels, and runtime controls on deploy-time one-off exec requests.

View Source
const CapabilityImageBuildOptionsV1 = "image.build-options-v1"

CapabilityImageBuildOptionsV1 means the streamed image builder consumes buildArgs and target from the request preamble.

View Source
const CapabilityImageDescriptorV1 = "image.descriptor-v1"

CapabilityImageDescriptorV1 means image reuse can be proven with config digest, platform, and Docker daemon identity instead of a mutable tag.

View Source
const CapabilityNodeIdentityV1 = nodeidentity.Capability

CapabilityNodeIdentityV1 means status exposes an immutable installation identity separately from mutable project/environment node metadata.

View Source
const CapabilityNodeLifecycleV1 = "node.lifecycle-v1"
View Source
const CapabilityNodeMembershipV1 = "node.membership-controller-v1"
View Source
const CapabilityNodePlatformV1 = "node.platform-v1"
View Source
const CapabilityNodeUpgradeV1 = "node.upgrade-v1"

CapabilityNodeUpgradeV1 means the agent reports the N/N-1 lifecycle protocol and was installed through the rollback-capable node upgrade path.

View Source
const CapabilityPlatformWorkerHandoffV1 = "platform.worker-handoff-v1"

CapabilityPlatformWorkerHandoffV1 means an enrolled node's protected platform-worker binary is handed off in the same atomic transaction.

View Source
const CapabilityProxyCertsV1 = "proxy.certs-v1"

CapabilityProxyCertsV1 means the node exposes the validated certificate store API and can render store-backed TLS directives safely.

View Source
const CapabilityProxyRemoteMeshRoutesV1 = "proxy.remote-mesh-routes-v1"

CapabilityProxyRemoteMeshRoutesV1 will be advertised only when the node can validate authoritative active allocation generations and revocations. Phase 3 intentionally omits it so unsupported multi-node routes fail preflight.

View Source
const CapabilityProxyTrustedProxiesV1 = "proxy.trusted-proxies-v1"

CapabilityProxyTrustedProxiesV1 means proxy route manifests accept explicit trusted proxy CIDRs and render Caddy's trusted client IP handling.

View Source
const CapabilityServiceFilesV1 = "service.files-v1"

CapabilityServiceFilesV1 means reconcile, jobs, and one-off execution can atomically publish request-scoped operator file bundles and bind mount them.

View Source
const DefaultBuildCacheKeepStorage = "20GB"
View Source
const (
	DefaultBuildCachePruneInterval = 24 * time.Hour
)
View Source
const DefaultServiceFilesRoot = "/var/lib/tako/files"
View Source
const ExecContainerMarker = "__TAKO_EXEC_CONTAINER__:"

ExecContainerMarker precedes the resolved-container frame emitted at the start of an exec stream, on its own line.

View Source
const ExecExitMarker = "__TAKO_EXEC_EXIT__:"

ExecExitMarker precedes the terminal frame of an exec stream, on its own line, carrying the remote command's exit code.

View Source
const (
	PortAllocationKindMeshUpstream = "mesh-upstream"
)
View Source
const RegistryAuthFailedMarker = "registry authentication failed"

RegistryAuthFailedMarker prefixes auth-classified docker failures so the CLI can raise a typed error distinct from image-not-found.

Variables

This section is empty.

Functions

func CheckServiceFiles added in v0.9.0

func CheckServiceFiles(request ServiceFilesCheckRequest) error

func CleanupBackupObjects added in v0.5.4

func CleanupBackupObjects(ctx context.Context, storage BackupStorageConfig, retention BackupObjectRetention) error

func DeleteVolumeBackup

func DeleteVolumeBackup(ctx context.Context, req BackupRequest) error

func DownloadBackupObjectExact added in v0.10.0

func DownloadBackupObjectExact(ctx context.Context, storage BackupStorageConfig, key, destination string, expectedSize int64) error

DownloadBackupObjectExact refuses an object whose declared or streamed size differs from expectedSize. This bounds disk use and makes upload readback prove the exact newly uploaded object rather than merely any valid bundle.

func ExportImage

func ExportImage(ctx context.Context, image string, w io.Writer) error

func HashBackupObjectExact added in v0.10.0

func HashBackupObjectExact(ctx context.Context, storage BackupStorageConfig, key string, expectedSize int64) (string, error)

HashBackupObjectExact verifies the remote length and hashes it as a bounded stream, avoiding a controller-disk copy of persistent workload backups.

func MergeHealthStates added in v0.9.1

func MergeHealthStates(existing string, incoming string) string

MergeHealthStates aggregates two health-check states with worst-wins semantics: unhealthy > starting > healthy > unknown (empty).

func ParseContainerHealth added in v0.9.1

func ParseContainerHealth(dockerStatus string) string

ParseContainerHealth extracts the docker health-check state from a `docker ps` status column value such as "Up 5 minutes (healthy)". Containers without a health check report no parenthesized state and yield the empty string.

func PublishServiceFiles added in v0.9.0

func PublishServiceFiles(ctx context.Context, request ServiceFilesRequest) error

func ReadMeshStatus

func ReadMeshStatus(ctx context.Context, interfaceName string) (*mesh.Status, error)

func RefreshActualStateDocuments

func RefreshActualStateDocuments(ctx context.Context, dataDir string, node string) (int, error)

func ReleaseProjectPortAllocations

func ReleaseProjectPortAllocations(ctx context.Context, dataDir string, project string, environment string) error

func ReleaseServicePortAllocations

func ReleaseServicePortAllocations(ctx context.Context, dataDir string, project string, environment string, service string) error

func ReleaseServicePortAllocationsExceptRevision added in v0.5.4

func ReleaseServicePortAllocationsExceptRevision(ctx context.Context, dataDir string, project string, environment string, service string, keepRevision string) error

func RestoreVolumeBackup

func RestoreVolumeBackup(ctx context.Context, req BackupRequest) error

func RunExecStream added in v0.8.1

func RunExecStream(ctx context.Context, req ExecRequest, reader io.Reader, writer io.Writer) error

RunExecStream runs one interactive (optionally PTY-backed) exec session over an upgraded frame stream: container frame first, output frames until the process ends, then a terminal exit frame. It handles stdin/resize frames from the client, enforces absolute and idle timeouts, and cleans up the docker process (and oneoff container) when the client disconnects.

func ServiceFileBundlePath added in v0.9.0

func ServiceFileBundlePath(project, environment, service, setID, bundle string) string

func SignPortAllocation added in v0.10.0

func SignPortAllocation(response *PortAllocationResponse, installation *nodeidentity.Installation) error

func StreamExec added in v0.8.0

func StreamExec(ctx context.Context, req ExecRequest, writer io.Writer) error

StreamExec runs the requested command and streams its combined output to writer, followed by a terminal ExecExitMarker line with the exit code. It returns an error only for failures before any output is streamed (validation, container/image resolution); run-phase failures surface in the stream and the exit marker instead.

func StreamProxyAccessLogs

func StreamProxyAccessLogs(ctx context.Context, tail int, follow bool, writer io.Writer) error

func StreamServiceLogs

func StreamServiceLogs(ctx context.Context, req LogsRequest, writer io.Writer) error

func ValidateBackupStorage added in v0.5.4

func ValidateBackupStorage(storage BackupStorageConfig) error

func VerifyPortAllocation added in v0.10.0

func VerifyPortAllocation(response PortAllocationResponse, publicKey string) error

Types

type ACMEDNSCertificateRequest added in v0.9.3

type ACMEDNSCertificateRequest struct {
	Domain     string `json:"domain"`
	Email      string `json:"email,omitempty"`
	CAProvider string `json:"caProvider,omitempty"`
	Staging    bool   `json:"staging,omitempty"`
}

type ACMEDNSCertificateResult added in v0.9.3

type ACMEDNSCertificateResult struct {
	Domain      string                   `json:"domain"`
	Action      string                   `json:"action"`
	Certificate ProxyCertificateMetadata `json:"certificate"`
}

type ACMEDNSError added in v0.9.3

type ACMEDNSError struct {
	Code       string                     `json:"code"`
	Domain     string                     `json:"domain,omitempty"`
	RetryAfter time.Time                  `json:"retryAfter,omitempty"`
	Completed  []ACMEDNSCertificateResult `json:"completed,omitempty"`
	Err        error                      `json:"-"`
}

ACMEDNSError is serialized by the takod API so callers can distinguish a local retry cooldown from a CA account rate limit and back off correctly.

func (*ACMEDNSError) Error added in v0.9.3

func (e *ACMEDNSError) Error() string

func (*ACMEDNSError) Unwrap added in v0.9.3

func (e *ACMEDNSError) Unwrap() error

type ACMEDNSReconcileRequest added in v0.9.3

type ACMEDNSReconcileRequest struct {
	Project      string                      `json:"project"`
	Environment  string                      `json:"environment"`
	DNSProvider  string                      `json:"dnsProvider"`
	Credentials  map[string]string           `json:"credentials"`
	Certificates []ACMEDNSCertificateRequest `json:"certificates"`
}

type ACMEDNSReconcileResponse added in v0.9.3

type ACMEDNSReconcileResponse struct {
	Certificates []ACMEDNSCertificateResult `json:"certificates"`
}

func FinalizeACMEDNS added in v0.9.3

func FinalizeACMEDNS(ctx context.Context, project, environment string) (*ACMEDNSReconcileResponse, error)

FinalizeACMEDNS promotes a staged provider/ownership document only after the matching route manifest was published successfully. Until this point the previous active document and credentials remain the scheduler's source of truth, so a failed domain replacement cannot orphan a still-live route.

func PrepareACMEDNS added in v0.9.3

func ReconcileACMEDNS added in v0.9.3

ReconcileACMEDNS is the in-process atomic convenience used by tests and callers that do not publish a separate route manifest. The HTTP deploy flow uses PrepareACMEDNS followed by FinalizeACMEDNS after route publication.

type ACMEDNSRemoveResponse added in v0.9.3

type ACMEDNSRemoveResponse struct {
	Project     string   `json:"project"`
	Environment string   `json:"environment"`
	Orphaned    []string `json:"orphaned"`
}

func RemoveACMEDNSConfiguration added in v0.9.3

func RemoveACMEDNSConfiguration(ctx context.Context, project, environment string) (*ACMEDNSRemoveResponse, error)

type ActualRefreshTarget

type ActualRefreshTarget struct {
	Project     string
	Environment string
}

func ListActualRefreshTargets

func ListActualRefreshTargets(dataDir string) ([]ActualRefreshTarget, error)

type ActualService

type ActualService struct {
	Name              string            `json:"name"`
	Image             string            `json:"image,omitempty"`
	RevisionImages    map[string]string `json:"revisionImages,omitempty"`
	Replicas          int               `json:"replicas"`
	Containers        []string          `json:"containers,omitempty"`
	ConfigHash        string            `json:"configHash,omitempty"`
	RuntimeID         string            `json:"runtimeId,omitempty"`
	Persistent        bool              `json:"persistent,omitempty"`
	CurrentRevision   string            `json:"currentRevision,omitempty"`
	PreviousRevision  string            `json:"previousRevision,omitempty"`
	WarmingRevisions  []string          `json:"warmingRevisions,omitempty"`
	DeployStrategy    string            `json:"deployStrategy,omitempty"`
	ActiveContainers  []string          `json:"activeContainers,omitempty"`
	WarmingContainers []string          `json:"warmingContainers,omitempty"`
	// Health aggregates the docker health-check state of the service's
	// active containers (worst wins: unhealthy > starting > healthy).
	// Empty when no active container defines a health check, or when the
	// reporting node agent predates health capture.
	Health string `json:"health,omitempty"`
}

type ActualStateResponse

type ActualStateResponse struct {
	Project     string                    `json:"project"`
	Environment string                    `json:"environment"`
	Services    map[string]*ActualService `json:"services"`
	// Jobs carries the node's scheduled jobs: kind:job services have no
	// long-running containers, so their actual state is the cron schedule.
	Jobs map[string]*JobStatus `json:"jobs,omitempty"`
}

func GatherActualState

func GatherActualState(ctx context.Context, project string, environment string) (*ActualStateResponse, error)

func ParseActualState

func ParseActualState(project string, environment string, dockerPSOutput string) *ActualStateResponse

type AllocationAuthorizationRequest added in v0.10.0

type AllocationAuthorizationRequest struct {
	Project      string                          `json:"project"`
	Environment  string                          `json:"environment"`
	Allocations  []nodeidentity.ActiveAllocation `json:"allocations"`
	Phase        string                          `json:"phase,omitempty"`
	ProposalID   string                          `json:"proposalId,omitempty"`
	TargetNodeID string                          `json:"targetNodeId,omitempty"`
}

type AllocationAuthorizationResponse added in v0.10.0

type AllocationAuthorizationResponse struct {
	ProposalID            string                               `json:"proposalId,omitempty"`
	Snapshot              nodeidentity.SignedInventorySnapshot `json:"snapshot,omitempty"`
	RecoveryTargetNodeIDs []string                             `json:"recoveryTargetNodeIds,omitempty"`
	Recovered             bool                                 `json:"recovered,omitempty"`
}

type BackupCleanupResponse

type BackupCleanupResponse struct {
	Deleted int `json:"deleted"`
}

func CleanupOldBackups

func CleanupOldBackups(ctx context.Context, req BackupRequest) (*BackupCleanupResponse, error)

type BackupInfo

type BackupInfo struct {
	ID          string            `json:"id"`
	Service     string            `json:"service,omitempty"`
	Volume      string            `json:"volume"`
	Size        int64             `json:"size"`
	CreatedAt   time.Time         `json:"createdAt"`
	Path        string            `json:"path"`
	Compression string            `json:"compression"`
	Remote      *BackupRemoteInfo `json:"remote,omitempty"`
	Warnings    []string          `json:"warnings,omitempty"`
}

func CreateVolumeBackup

func CreateVolumeBackup(ctx context.Context, req BackupRequest) (*BackupInfo, error)

type BackupListResponse

type BackupListResponse struct {
	Backups []BackupInfo `json:"backups"`
}

func ListVolumeBackups

func ListVolumeBackups(ctx context.Context, req BackupRequest) (*BackupListResponse, error)

type BackupObject added in v0.5.4

type BackupObject struct {
	Project     string
	Environment string
	Volume      string
	BackupID    string
	Path        string
	CreatedAt   time.Time
}

type BackupObjectInfo added in v0.10.0

type BackupObjectInfo struct {
	Size         int64
	LastModified time.Time
}

func InspectBackupObject added in v0.10.0

func InspectBackupObject(ctx context.Context, storage BackupStorageConfig, key string) (*BackupObjectInfo, error)

type BackupObjectRetention added in v0.5.4

type BackupObjectRetention struct {
	Project       string
	Environment   string
	Volume        string
	RetentionDays int
}

type BackupRemoteInfo added in v0.5.4

type BackupRemoteInfo struct {
	Provider string `json:"provider"`
	Bucket   string `json:"bucket"`
	Key      string `json:"key"`
	Endpoint string `json:"endpoint,omitempty"`
}

func UploadBackupObject added in v0.5.4

func UploadBackupObject(ctx context.Context, storage BackupStorageConfig, object BackupObject) (*BackupRemoteInfo, error)

type BackupRequest

type BackupRequest struct {
	Project        string               `json:"project"`
	Environment    string               `json:"environment"`
	Volume         string               `json:"volume,omitempty"`
	DockerVolume   string               `json:"dockerVolume,omitempty"`
	ExternalVolume bool                 `json:"externalVolume,omitempty"`
	BackupID       string               `json:"backupId,omitempty"`
	RetentionDays  int                  `json:"retentionDays,omitempty"`
	Storage        *BackupStorageConfig `json:"storage,omitempty"`
}

type BackupScheduleRequest added in v0.5.4

type BackupScheduleRequest struct {
	Project       string                 `json:"project"`
	Environment   string                 `json:"environment"`
	Service       string                 `json:"service"`
	Schedule      string                 `json:"schedule"`
	RetentionDays int                    `json:"retentionDays,omitempty"`
	Volumes       []BackupScheduleVolume `json:"volumes"`
	Storage       *BackupStorageConfig   `json:"storage,omitempty"`
}

type BackupScheduleResponse added in v0.5.4

type BackupScheduleResponse struct {
	Project     string    `json:"project"`
	Environment string    `json:"environment"`
	Service     string    `json:"service"`
	Scheduled   bool      `json:"scheduled"`
	UpdatedAt   time.Time `json:"updatedAt"`
}

type BackupScheduleVolume added in v0.5.4

type BackupScheduleVolume struct {
	Volume         string `json:"volume"`
	DockerVolume   string `json:"dockerVolume"`
	ExternalVolume bool   `json:"externalVolume,omitempty"`
}

type BackupScheduler added in v0.5.4

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

func NewBackupScheduler added in v0.5.4

func NewBackupScheduler(dataDir string) *BackupScheduler

func (*BackupScheduler) Delete added in v0.5.4

func (s *BackupScheduler) Delete(ctx context.Context, project string, environment string, service string) (*BackupScheduleResponse, error)

func (*BackupScheduler) Run added in v0.5.4

func (s *BackupScheduler) Run(ctx context.Context)

func (*BackupScheduler) Upsert added in v0.5.4

type BackupStorageConfig added in v0.5.4

type BackupStorageConfig struct {
	Provider        string `json:"provider,omitempty"`
	Bucket          string `json:"bucket,omitempty"`
	Region          string `json:"region,omitempty"`
	Endpoint        string `json:"endpoint,omitempty"`
	Prefix          string `json:"prefix,omitempty"`
	AccessKeyID     string `json:"accessKeyId,omitempty"`
	SecretAccessKey string `json:"secretAccessKey,omitempty"`
	SessionToken    string `json:"sessionToken,omitempty"`
	ForcePathStyle  bool   `json:"forcePathStyle,omitempty"`
}

type CertificateScheduler added in v0.9.3

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

CertificateScheduler is takod's sole renewal driver. CertMagic cache maintenance is stopped before foreground operations; this daily loop is the only component allowed to renew managed certificates.

func NewCertificateScheduler added in v0.9.3

func NewCertificateScheduler(dataDir string) *CertificateScheduler

func (*CertificateScheduler) Check added in v0.9.3

func (s *CertificateScheduler) Check(ctx context.Context) error

func (*CertificateScheduler) Run added in v0.9.3

func (s *CertificateScheduler) Run(ctx context.Context)

type CleanupRequest

type CleanupRequest struct {
	Project                string   `json:"project"`
	Environment            string   `json:"environment,omitempty"`
	RemoveContainers       bool     `json:"removeContainers,omitempty"`
	RemoveImages           bool     `json:"removeImages,omitempty"`
	RemoveNetworks         bool     `json:"removeNetworks,omitempty"`
	RemoveDeployFiles      bool     `json:"removeDeployFiles,omitempty"`
	RemoveTakodState       bool     `json:"removeTakodState,omitempty"`
	ProxyFiles             []string `json:"proxyFiles,omitempty"`
	ExternalVolumes        []string `json:"externalVolumes,omitempty"`
	PruneDocker            bool     `json:"pruneDocker,omitempty"`
	ImageRepositories      []string `json:"imageRepositories,omitempty"`
	KeepImages             int      `json:"keepImages,omitempty"`
	CleanOldImages         bool     `json:"cleanOldImages,omitempty"`
	CleanStoppedContainers bool     `json:"cleanStoppedContainers,omitempty"`
	CleanDanglingImages    bool     `json:"cleanDanglingImages,omitempty"`
	CleanBuildCache        bool     `json:"cleanBuildCache,omitempty"`
	BuildCacheKeepStorage  string   `json:"buildCacheKeepStorage,omitempty"`
	CleanUnusedVolumes     bool     `json:"cleanUnusedVolumes,omitempty"`
	SecureLogPermissions   bool     `json:"secureLogPermissions,omitempty"`
}

type CleanupResponse

type CleanupResponse struct {
	Project               string   `json:"project"`
	Environment           string   `json:"environment,omitempty"`
	ContainersRemoved     int      `json:"containersRemoved,omitempty"`
	ImagesRemoved         int      `json:"imagesRemoved,omitempty"`
	NetworksRemoved       int      `json:"networksRemoved,omitempty"`
	JobsRemoved           int      `json:"jobsRemoved,omitempty"`
	ProxyFilesRemoved     int      `json:"proxyFilesRemoved,omitempty"`
	BuildCacheCleaned     bool     `json:"buildCacheCleaned,omitempty"`
	UnusedVolumesCleaned  bool     `json:"unusedVolumesCleaned,omitempty"`
	LogPermissionsSecured bool     `json:"logPermissionsSecured,omitempty"`
	InitialDiskUsage      string   `json:"initialDiskUsage,omitempty"`
	FinalDiskUsage        string   `json:"finalDiskUsage,omitempty"`
	DockerDiskUsage       string   `json:"dockerDiskUsage,omitempty"`
	Warnings              []string `json:"warnings,omitempty"`
}

func CleanupProject

func CleanupProject(ctx context.Context, req CleanupRequest) (*CleanupResponse, error)

type ContainerSpec

type ContainerSpec struct {
	Name           string            `json:"name"`
	NetworkAliases []string          `json:"networkAliases,omitempty"`
	Publishes      []string          `json:"publishes,omitempty"`
	Labels         map[string]string `json:"labels,omitempty"`
}

type ContainerStat

type ContainerStat struct {
	Name       string `json:"name"`
	CPUPercent string `json:"cpuPercent"`
	MemUsage   string `json:"memUsage"`
	MemPercent string `json:"memPercent"`
	NetIO      string `json:"netIO"`
	BlockIO    string `json:"blockIO"`
	PIDs       string `json:"pids"`
}

type EnvBundleRequest

type EnvBundleRequest struct {
	Project     string    `json:"project"`
	Environment string    `json:"environment"`
	Content     string    `json:"content,omitempty"`
	UpdatedAt   time.Time `json:"updatedAt,omitempty"`
}

type EnvBundleResponse

type EnvBundleResponse struct {
	Found     bool      `json:"found"`
	Content   string    `json:"content,omitempty"`
	Path      string    `json:"path,omitempty"`
	UpdatedAt time.Time `json:"updatedAt,omitempty"`
}

func ReadEnvBundle

func ReadEnvBundle(ctx context.Context, dataDir string, req EnvBundleRequest) (*EnvBundleResponse, error)

func WriteEnvBundle

func WriteEnvBundle(ctx context.Context, dataDir string, req EnvBundleRequest) (*EnvBundleResponse, error)

type ExecRequest added in v0.8.0

type ExecRequest struct {
	Project     string   `json:"project"`
	Environment string   `json:"environment"`
	Service     string   `json:"service"`
	Mode        string   `json:"mode"`
	Command     []string `json:"command"`
	// Replica selects the 1-based running replica for attach mode
	// (containers sorted by name); 0 means the first.
	Replica int `json:"replica,omitempty"`
	// Env adds KEY=VALUE pairs on top of EnvFileContent.
	Env []string `json:"env,omitempty"`
	// EnvFileContent carries the service's env/secrets for oneoff mode;
	// it is written to a 0600 temp file and passed via --env-file.
	EnvFileContent string `json:"envFileContent,omitempty"`
	// Image overrides the oneoff image; default is the service's current
	// image from actual state.
	Image         string         `json:"image,omitempty"`
	PullImage     bool           `json:"pullImage,omitempty"`
	RegistryAuths []RegistryAuth `json:"registryAuths,omitempty"`
	// Network attaches the oneoff container; default tako_<project>_<env>.
	Network string `json:"network,omitempty"`
	// Mounts adds --mount specs to oneoff containers (volumes opt-in).
	Mounts             []string                       `json:"mounts,omitempty"`
	ExternalVolumes    []string                       `json:"externalVolumes,omitempty"`
	Files              []ServiceFileBundle            `json:"files,omitempty"`
	FileSetID          string                         `json:"fileSetId,omitempty"`
	CleanupFiles       bool                           `json:"cleanupFiles,omitempty"`
	Entrypoint         []string                       `json:"entrypoint,omitempty"`
	Labels             map[string]string              `json:"labels,omitempty"`
	User               string                         `json:"user,omitempty"`
	WorkingDir         string                         `json:"workingDir,omitempty"`
	StopTimeoutSeconds int                            `json:"stopTimeoutSeconds,omitempty"`
	Init               bool                           `json:"init,omitempty"`
	ExtraHosts         []string                       `json:"extraHosts,omitempty"`
	Ulimits            map[string]config.UlimitConfig `json:"ulimits,omitempty"`
	ShmSize            string                         `json:"shmSize,omitempty"`
	MemoryLimit        string                         `json:"memoryLimit,omitempty"`
	CPULimit           string                         `json:"cpuLimit,omitempty"`
	TimeoutSeconds     int                            `json:"timeoutSeconds,omitempty"`
	// Interactive attaches the caller's stdin over the hijacked frame
	// stream (docker exec/run -i). Requires the Upgrade handshake.
	Interactive bool `json:"interactive,omitempty"`
	// PTY allocates a server-side pseudo-terminal around the docker
	// process (implies Interactive). Cols/Rows set the initial size;
	// resize frames adjust it live.
	PTY  bool `json:"pty,omitempty"`
	Cols int  `json:"cols,omitempty"`
	Rows int  `json:"rows,omitempty"`
	// IdleTimeoutSeconds ends an interactive session after this long
	// without input or output; 0 uses the default.
	IdleTimeoutSeconds int `json:"idleTimeoutSeconds,omitempty"`
}

ExecRequest asks takod to run a command in the context of a service.

type ExportDiscoveryRecord added in v0.4.35

type ExportDiscoveryRecord struct {
	Network     string `json:"network"`
	Project     string `json:"project"`
	Environment string `json:"environment"`
	Service     string `json:"service"`
	Alias       string `json:"alias"`
	Runtime     string `json:"runtime,omitempty"`
}

type ExportDiscoveryResponse added in v0.4.35

type ExportDiscoveryResponse struct {
	Exports []ExportDiscoveryRecord `json:"exports"`
}

func ListExportDiscovery added in v0.4.35

func ListExportDiscovery(ctx context.Context, environment string) (*ExportDiscoveryResponse, error)

type FenceRequest added in v0.10.0

type FenceRequest struct {
	Fence       nodeidentity.OperationFence `json:"fence"`
	HolderToken string                      `json:"holderToken,omitempty"`
	OperationID string                      `json:"operationId,omitempty"`
	Token       uint64                      `json:"token,omitempty"`
	Phase       string                      `json:"phase,omitempty"`
}

type FenceResponse added in v0.10.0

type FenceResponse struct {
	Active    bool                         `json:"active"`
	HighWater uint64                       `json:"highWater"`
	Fence     *nodeidentity.OperationFence `json:"fence,omitempty"`
	Phase     string                       `json:"phase,omitempty"`
}

type HealthSpec

type HealthSpec struct {
	Command             string `json:"command,omitempty"`
	Path                string `json:"path,omitempty"`
	Port                int    `json:"port,omitempty"`
	Scheme              string `json:"scheme,omitempty"`
	Interval            string `json:"interval,omitempty"`
	Timeout             string `json:"timeout,omitempty"`
	Retries             int    `json:"retries,omitempty"`
	StartPeriod         string `json:"startPeriod,omitempty"`
	WaitAttempts        int    `json:"waitAttempts,omitempty"`
	SmokePath           string `json:"smokePath,omitempty"`
	SmokePort           int    `json:"smokePort,omitempty"`
	SmokeExpectedStatus int    `json:"smokeExpectedStatus,omitempty"`
}

type ImageBuildOptions

type ImageBuildOptions struct {
	Dockerfile string
	BuildArgs  map[string]string
	Target     string
}

type ImageBuildResponse

type ImageBuildResponse struct {
	Image   string             `json:"image"`
	Output  string             `json:"output,omitempty"`
	Timings *ImageBuildTimings `json:"timings,omitempty"`
}

func BuildImage

func BuildImage(ctx context.Context, image string, r io.Reader, dockerfile ...string) (*ImageBuildResponse, error)

func BuildImageWithAuth added in v0.8.0

func BuildImageWithAuth(ctx context.Context, image string, r io.Reader, auths []RegistryAuth, dockerfile ...string) (*ImageBuildResponse, error)

BuildImageWithAuth builds like BuildImage; auths feed an ephemeral DOCKER_CONFIG so the daemon can pull private base images during FROM.

func BuildImageWithOptions

func BuildImageWithOptions(ctx context.Context, image string, r io.Reader, auths []RegistryAuth, options ImageBuildOptions) (*ImageBuildResponse, error)

BuildImageWithOptions builds an uploaded context with validated target and build args. Values arrive in the request body preamble, never the URL.

type ImageBuildTimings added in v0.5.4

type ImageBuildTimings struct {
	ExtractMS     int64 `json:"extractMs,omitempty"`
	DockerBuildMS int64 `json:"dockerBuildMs,omitempty"`
	TotalMS       int64 `json:"totalMs,omitempty"`
}

type ImageDescriptor added in v0.10.0

type ImageDescriptor struct {
	Image        string   `json:"image"`
	Exists       bool     `json:"exists"`
	ImageID      string   `json:"imageId,omitempty"`
	RepoDigests  []string `json:"repoDigests,omitempty"`
	OS           string   `json:"os,omitempty"`
	Architecture string   `json:"architecture,omitempty"`
	Variant      string   `json:"variant,omitempty"`
	DaemonID     string   `json:"daemonId,omitempty"`
}

ImageDescriptor is the immutable evidence used for reuse and transfer. ImageID is Docker's config digest; a mutable tag alone is never sufficient. DaemonID distinguishes two Docker stores even when they expose equal tags.

func InspectImage added in v0.10.0

func InspectImage(ctx context.Context, image string) (*ImageDescriptor, error)

InspectImage returns exact image, platform, and daemon identity. A missing image is a successful Exists=false result; malformed daemon output fails closed so callers cannot fall back to tag-only reuse.

type ImageExistsResponse

type ImageExistsResponse struct {
	Image  string `json:"image"`
	Exists bool   `json:"exists"`
}

func ImageExists

func ImageExists(ctx context.Context, image string) (*ImageExistsResponse, error)

type ImageImportResponse

type ImageImportResponse struct {
	Image      string           `json:"image"`
	Output     string           `json:"output,omitempty"`
	Descriptor *ImageDescriptor `json:"descriptor,omitempty"`
}

func ImportImage

func ImportImage(ctx context.Context, image string, r io.Reader, expectedImageIDs ...string) (*ImageImportResponse, error)

type JobRunRecord added in v0.8.0

type JobRunRecord struct {
	Project     string    `json:"project"`
	Environment string    `json:"environment"`
	Job         string    `json:"job"`
	Trigger     string    `json:"trigger"`
	Container   string    `json:"container,omitempty"`
	StartedAt   time.Time `json:"startedAt"`
	FinishedAt  time.Time `json:"finishedAt"`
	DurationMs  int64     `json:"durationMs"`
	ExitCode    int       `json:"exitCode"`
	Status      string    `json:"status"`
	// Output is the bounded tail of the run's combined output.
	Output string `json:"output,omitempty"`
}

JobRunRecord is one completed (or skipped) run in a job's history.

type JobScheduler added in v0.8.0

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

JobScheduler fires job specs with a local cron, mirroring BackupScheduler: specs persist as JSON under the data dir and are reloaded on start.

func NewJobScheduler added in v0.8.0

func NewJobScheduler(dataDir string) *JobScheduler

func (*JobScheduler) Apply added in v0.8.0

Apply reconciles this node's job set for one project/environment.

func (*JobScheduler) List added in v0.8.0

func (s *JobScheduler) List(project string, environment string) []JobStatus

List reports scheduled jobs, optionally filtered by project/environment.

func (*JobScheduler) RemoveProject added in v0.8.0

func (s *JobScheduler) RemoveProject(project string, environment string) ([]string, error)

RemoveProject unschedules every job for a project (one environment, or all when environment is empty) and deletes its specs and run history.

func (*JobScheduler) Run added in v0.8.0

func (s *JobScheduler) Run(ctx context.Context)

Run loads persisted specs, starts the cron, and blocks until ctx ends.

func (*JobScheduler) Runs added in v0.8.0

func (s *JobScheduler) Runs(project string, environment string, job string) ([]JobRunRecord, error)

Runs returns run history for one job, or every job in the environment when job is empty, newest first.

func (*JobScheduler) Trigger added in v0.8.0

func (s *JobScheduler) Trigger(ctx context.Context, project string, environment string, job string, stream io.Writer) error

Trigger runs a scheduled job immediately, streaming raw output framed by the exec markers to stream. An overlapping run surfaces as an error before any bytes are streamed.

type JobSpec added in v0.8.0

type JobSpec struct {
	Project     string            `json:"project"`
	Environment string            `json:"environment"`
	Name        string            `json:"name"`
	Schedule    string            `json:"schedule"`
	Timezone    string            `json:"timezone,omitempty"`
	Image       string            `json:"image"`
	Command     []string          `json:"command"`
	Entrypoint  []string          `json:"entrypoint,omitempty"`
	Labels      map[string]string `json:"labels,omitempty"`
	// EnvFileContent carries the job's env/secrets; it is written to a 0600
	// temp file per run and passed via --env-file.
	EnvFileContent string   `json:"envFileContent,omitempty"`
	Env            []string `json:"env,omitempty"`
	// Network attaches run containers; default tako_<project>_<env>.
	Network            string                         `json:"network,omitempty"`
	Mounts             []string                       `json:"mounts,omitempty"`
	Files              []ServiceFileBundle            `json:"files,omitempty"`
	FileSetID          string                         `json:"fileSetId,omitempty"`
	MemoryLimit        string                         `json:"memoryLimit,omitempty"`
	CPULimit           string                         `json:"cpuLimit,omitempty"`
	User               string                         `json:"user,omitempty"`
	WorkingDir         string                         `json:"workingDir,omitempty"`
	StopTimeoutSeconds int                            `json:"stopTimeoutSeconds,omitempty"`
	Init               bool                           `json:"init,omitempty"`
	ExtraHosts         []string                       `json:"extraHosts,omitempty"`
	Ulimits            map[string]config.UlimitConfig `json:"ulimits,omitempty"`
	ShmSize            string                         `json:"shmSize,omitempty"`
	TimeoutSeconds     int                            `json:"timeoutSeconds,omitempty"`
	// ConfigHash is the deployer's fingerprint of the job's service config,
	// reported back through actual state for drift/plan comparison.
	ConfigHash string `json:"configHash,omitempty"`
}

JobSpec declares one scheduled job on this node. The owning node receives the spec at deploy time via /v1/jobs/apply and fires it with its local cron; each run is a fresh one-off container from Image.

type JobStatus added in v0.8.0

type JobStatus struct {
	Project        string        `json:"project"`
	Environment    string        `json:"environment"`
	Name           string        `json:"name"`
	Schedule       string        `json:"schedule"`
	Timezone       string        `json:"timezone,omitempty"`
	Image          string        `json:"image"`
	Command        []string      `json:"command"`
	TimeoutSeconds int           `json:"timeoutSeconds,omitempty"`
	ConfigHash     string        `json:"configHash,omitempty"`
	NextRun        *time.Time    `json:"nextRun,omitempty"`
	LastRun        *JobRunRecord `json:"lastRun,omitempty"`
}

JobStatus describes a scheduled job without its env-file content, which must never leave the node through list responses.

type JobTriggerRequest added in v0.8.0

type JobTriggerRequest struct {
	Project     string `json:"project"`
	Environment string `json:"environment"`
	Job         string `json:"job"`
}

JobTriggerRequest asks for one immediate run of a scheduled job.

type JobsApplyRequest added in v0.8.0

type JobsApplyRequest struct {
	Project     string    `json:"project"`
	Environment string    `json:"environment"`
	Jobs        []JobSpec `json:"jobs"`
}

JobsApplyRequest declaratively replaces this node's job set for one project/environment: listed jobs are scheduled, absent ones unscheduled.

type JobsApplyResponse added in v0.8.0

type JobsApplyResponse struct {
	Project     string    `json:"project"`
	Environment string    `json:"environment"`
	Applied     []string  `json:"applied,omitempty"`
	Removed     []string  `json:"removed,omitempty"`
	Warnings    []string  `json:"warnings,omitempty"`
	UpdatedAt   time.Time `json:"updatedAt"`
}

JobsApplyResponse reports the applied and removed job names.

type LeaseInfo

type LeaseInfo struct {
	ID          string                       `json:"id"`
	ProjectName string                       `json:"projectName"`
	Environment string                       `json:"environment"`
	Operation   string                       `json:"operation"`
	Who         string                       `json:"who"`
	PID         int                          `json:"pid"`
	CreatedAt   time.Time                    `json:"createdAt"`
	ExpiresAt   time.Time                    `json:"expiresAt"`
	Fence       *nodeidentity.OperationFence `json:"fence,omitempty"`
}

type LeaseRequest

type LeaseRequest struct {
	Project       string                       `json:"project"`
	Environment   string                       `json:"environment"`
	ID            string                       `json:"id,omitempty"`
	Operation     string                       `json:"operation,omitempty"`
	Who           string                       `json:"who,omitempty"`
	PID           int                          `json:"pid,omitempty"`
	TTLSeconds    int64                        `json:"ttlSeconds,omitempty"`
	Renew         bool                         `json:"renew,omitempty"`
	RequestID     string                       `json:"requestId,omitempty"`
	HolderToken   string                       `json:"holderToken,omitempty"`
	TargetNodeIDs []string                     `json:"targetNodeIds,omitempty"`
	Fence         *nodeidentity.OperationFence `json:"fence,omitempty"`
}

type LeaseResponse

type LeaseResponse struct {
	Acquired    bool       `json:"acquired"`
	Found       bool       `json:"found"`
	Lease       *LeaseInfo `json:"lease,omitempty"`
	Message     string     `json:"message,omitempty"`
	HolderToken string     `json:"holderToken,omitempty"`
}

func AcquireLease

func AcquireLease(ctx context.Context, dataDir string, req LeaseRequest) (*LeaseResponse, error)

func ReadLease

func ReadLease(ctx context.Context, dataDir string, req LeaseRequest) (*LeaseResponse, error)

func ReleaseLease

func ReleaseLease(ctx context.Context, dataDir string, req LeaseRequest) (*LeaseResponse, error)

type LogsRequest

type LogsRequest struct {
	Project     string `json:"project"`
	Environment string `json:"environment"`
	Service     string `json:"service"`
	Tail        int    `json:"tail,omitempty"`
	Follow      bool   `json:"follow,omitempty"`
}

type MembershipReconcileResponse added in v0.10.0

type MembershipReconcileResponse struct {
	Generation    uint64 `json:"generation"`
	ProxyStopped  bool   `json:"proxyStopped"`
	InvalidRoutes int    `json:"invalidRoutes"`
}

type MeshApplyRequest

type MeshApplyRequest struct {
	Config mesh.WireGuardConfig `json:"config"`
	Node   mesh.Node            `json:"node"`
	Peers  []mesh.Node          `json:"peers,omitempty"`
}

type MeshApplyResponse

type MeshApplyResponse struct {
	Applied bool         `json:"applied"`
	Status  *mesh.Status `json:"status,omitempty"`
}

func ReconcileMesh

func ReconcileMesh(ctx context.Context, request MeshApplyRequest) (*MeshApplyResponse, error)

type MeshKeyResponse

type MeshKeyResponse struct {
	PublicKey string `json:"publicKey"`
}

func EnsureMeshKey

func EnsureMeshKey(ctx context.Context) (*MeshKeyResponse, error)

type MetadataRequest

type MetadataRequest struct {
	Node  any `json:"node,omitempty"`
	Peers any `json:"peers,omitempty"`
}

type MetadataResponse

type MetadataResponse struct {
	NodePath  string `json:"nodePath,omitempty"`
	PeersPath string `json:"peersPath,omitempty"`
}

func WriteMetadata

func WriteMetadata(ctx context.Context, dataDir string, req MetadataRequest) (*MetadataResponse, error)

type MetricsResponse

type MetricsResponse struct {
	Collected bool            `json:"collected"`
	Metrics   json.RawMessage `json:"metrics"`
}

func ReadNodeMetrics

func ReadNodeMetrics(ctx context.Context, collect bool) (*MetricsResponse, error)

type NetworkAttachmentSpec added in v0.4.12

type NetworkAttachmentSpec struct {
	Network string            `json:"network"`
	Aliases []string          `json:"aliases,omitempty"`
	Create  bool              `json:"create,omitempty"`
	Labels  map[string]string `json:"labels,omitempty"`
}

type OperationStatusResponse added in v0.10.0

type OperationStatusResponse struct {
	Active  *controlOperationRecord  `json:"active,omitempty"`
	History []controlOperationRecord `json:"history,omitempty"`
}

type PlatformResponse added in v0.10.0

type PlatformResponse struct {
	OS           string `json:"os"`
	Architecture string `json:"architecture"`
	Variant      string `json:"variant,omitempty"`
	DaemonID     string `json:"daemonId"`
}

func ReadPlatform added in v0.10.0

func ReadPlatform(ctx context.Context) (*PlatformResponse, error)

ReadPlatform reports the Docker server platform rather than the CLI process architecture, which may differ when DOCKER_HOST is configured.

type PortAllocationRequest

type PortAllocationRequest struct {
	Kind          string `json:"kind"`
	Project       string `json:"project"`
	Environment   string `json:"environment"`
	Service       string `json:"service"`
	Revision      string `json:"revision,omitempty"`
	Slot          int    `json:"slot"`
	HostIP        string `json:"hostIp"`
	ContainerPort int    `json:"containerPort"`
	PreferredPort int    `json:"preferredPort"`
	MinPort       int    `json:"minPort"`
	MaxPort       int    `json:"maxPort"`
}

type PortAllocationResponse

type PortAllocationResponse struct {
	Kind          string    `json:"kind"`
	Project       string    `json:"project"`
	Environment   string    `json:"environment"`
	Service       string    `json:"service"`
	Revision      string    `json:"revision,omitempty"`
	Slot          int       `json:"slot"`
	HostIP        string    `json:"hostIp"`
	HostPort      int       `json:"hostPort"`
	ContainerPort int       `json:"containerPort"`
	Key           string    `json:"key"`
	ClusterID     string    `json:"clusterId,omitempty"`
	NodeID        string    `json:"nodeId,omitempty"`
	Generation    uint64    `json:"generation,omitempty"`
	IssuedAt      time.Time `json:"issuedAt,omitempty"`
	OperationID   string    `json:"operationId,omitempty"`
	FenceToken    uint64    `json:"fenceToken,omitempty"`
	Signature     string    `json:"signature,omitempty"`
}

func AllocatePort

func AllocatePort(ctx context.Context, dataDir string, req PortAllocationRequest) (*PortAllocationResponse, error)

type ProxyCertificateListResponse added in v0.9.2

type ProxyCertificateListResponse struct {
	Certificates []ProxyCertificateMetadata `json:"certificates"`
}

func ListProxyCertificates added in v0.9.2

func ListProxyCertificates(ctx context.Context) (*ProxyCertificateListResponse, error)

type ProxyCertificateMetadata added in v0.9.2

type ProxyCertificateMetadata struct {
	Domain           string     `json:"domain"`
	Source           string     `json:"source"`
	NotBefore        time.Time  `json:"notBefore"`
	NotAfter         time.Time  `json:"notAfter"`
	IssuedAt         time.Time  `json:"issuedAt"`
	UpdatedAt        time.Time  `json:"updatedAt"`
	OwnerProject     string     `json:"ownerProject,omitempty"`
	OwnerEnvironment string     `json:"ownerEnvironment,omitempty"`
	DNSProvider      string     `json:"dnsProvider,omitempty"`
	CAProvider       string     `json:"caProvider,omitempty"`
	Staging          bool       `json:"staging,omitempty"`
	Orphaned         bool       `json:"orphaned,omitempty"`
	LastAttemptAt    *time.Time `json:"lastAttemptAt,omitempty"`
	LastSuccessAt    *time.Time `json:"lastSuccessAt,omitempty"`
	LastError        string     `json:"lastError,omitempty"`
	RetryAfter       *time.Time `json:"retryAfter,omitempty"`
}

type ProxyCertificateMutationResponse added in v0.9.2

type ProxyCertificateMutationResponse struct {
	Certificate ProxyCertificateMetadata `json:"certificate"`
}

func PushProxyCertificate added in v0.9.2

func RemoveProxyCertificate added in v0.9.2

func RemoveProxyCertificate(ctx context.Context, domain string) (*ProxyCertificateMutationResponse, error)

type ProxyCertificatePushRequest added in v0.9.2

type ProxyCertificatePushRequest struct {
	Project     string `json:"project,omitempty"`
	Environment string `json:"environment,omitempty"`
	Domain      string `json:"domain"`
	CertPEM     string `json:"certPem"`
	KeyPEM      string `json:"keyPem"`
}

type ProxyDestination added in v0.10.0

type ProxyDestination struct {
	Kind          string    `json:"kind"`
	URL           string    `json:"url"`
	Project       string    `json:"project"`
	Environment   string    `json:"environment"`
	Service       string    `json:"service"`
	Revision      string    `json:"revision,omitempty"`
	Slot          int       `json:"slot"`
	ClusterID     string    `json:"clusterId,omitempty"`
	NodeID        string    `json:"nodeId,omitempty"`
	AllocationKey string    `json:"allocationKey,omitempty"`
	Generation    uint64    `json:"generation,omitempty"`
	IssuedAt      time.Time `json:"issuedAt,omitempty"`
	OperationID   string    `json:"operationId,omitempty"`
	FenceToken    uint64    `json:"fenceToken,omitempty"`
	Signature     string    `json:"signature,omitempty"`
	ContainerPort int       `json:"containerPort"`
	HostPort      int       `json:"hostPort"`
	HostIP        string    `json:"hostIp,omitempty"`
}

ProxyDestination binds one rendered URL to the workload identity that was authorized by the controller. Raw URLs without this evidence are rejected by enrolled nodes.

type ProxyDynamicDomain added in v0.5.0

type ProxyDynamicDomain struct {
	AskURL      string            `json:"askUrl"`
	Destination *ProxyDestination `json:"destination,omitempty"`
}

type ProxyFileRequest

type ProxyFileRequest struct {
	Name    string `json:"name"`
	Content string `json:"content"`
}

type ProxyFileResponse

type ProxyFileResponse struct {
	Path string `json:"path"`
}

func RemoveProxyFile

func RemoveProxyFile(ctx context.Context, name string) (*ProxyFileResponse, error)

func WriteProxyFile

func WriteProxyFile(ctx context.Context, req ProxyFileRequest) (*ProxyFileResponse, error)

type ProxyRoute added in v0.5.0

type ProxyRoute struct {
	Service        string               `json:"service"`
	Revision       string               `json:"revision,omitempty"`
	Domains        []string             `json:"domains,omitempty"`
	RedirectFrom   []string             `json:"redirectFrom,omitempty"`
	Upstreams      []string             `json:"upstreams"`
	HealthCheck    *ProxyRouteHealth    `json:"healthCheck,omitempty"`
	Sticky         bool                 `json:"sticky,omitempty"`
	Priority       int                  `json:"priority,omitempty"`
	Visibility     string               `json:"visibility,omitempty"`
	DynamicDomain  *ProxyDynamicDomain  `json:"dynamicDomain,omitempty"`
	BasicAuth      *ProxyRouteBasicAuth `json:"basicAuth,omitempty"`
	AllowIPs       []string             `json:"allowIps,omitempty"`
	TrustedProxies []string             `json:"trustedProxies,omitempty"`
	Destinations   []ProxyDestination   `json:"destinations,omitempty"`
}

type ProxyRouteBasicAuth added in v0.8.1

type ProxyRouteBasicAuth struct {
	Username       string `json:"username"`
	PasswordBcrypt string `json:"passwordBcrypt"`
}

ProxyRouteBasicAuth protects a route's serving domains with HTTP basic auth. PasswordBcrypt is a pre-computed hash, never plaintext.

type ProxyRouteHealth added in v0.5.0

type ProxyRouteHealth struct {
	Path     string `json:"path,omitempty"`
	Interval string `json:"interval,omitempty"`
}

type ProxyRouteManifest added in v0.5.0

type ProxyRouteManifest struct {
	Version     int          `json:"version"`
	Project     string       `json:"project"`
	Environment string       `json:"environment"`
	Network     string       `json:"network,omitempty"`
	ClusterID   string       `json:"clusterId,omitempty"`
	Routes      []ProxyRoute `json:"routes"`
}

func ParseProxyRouteManifest added in v0.5.0

func ParseProxyRouteManifest(content string) (*ProxyRouteManifest, error)

type ReconcileProxyRequest

type ReconcileProxyRequest struct {
	Project     string `json:"project,omitempty"`
	Environment string `json:"environment,omitempty"`
	Network     string `json:"network"`
	Email       string `json:"email,omitempty"`
	Image       string `json:"image,omitempty"`
}

type ReconcileProxyResponse

type ReconcileProxyResponse struct {
	Container string `json:"container"`
	Image     string `json:"image"`
}

type ReconcileServiceRequest

type ReconcileServiceRequest struct {
	Project            string                         `json:"project"`
	Environment        string                         `json:"environment"`
	Service            string                         `json:"service"`
	Revision           string                         `json:"revision,omitempty"`
	DeployStrategy     string                         `json:"deployStrategy,omitempty"`
	Image              string                         `json:"image"`
	PullImage          bool                           `json:"pullImage,omitempty"`
	Restart            string                         `json:"restart,omitempty"`
	Network            string                         `json:"network"`
	NetworkAlias       string                         `json:"networkAlias,omitempty"`
	NetworkAttachments []NetworkAttachmentSpec        `json:"networkAttachments,omitempty"`
	EnvFile            string                         `json:"envFile,omitempty"`
	EnvFileContent     string                         `json:"envFileContent,omitempty"`
	Labels             map[string]string              `json:"labels,omitempty"`
	Mounts             []string                       `json:"mounts,omitempty"`
	ExternalVolumes    []string                       `json:"externalVolumes,omitempty"`
	Files              []ServiceFileBundle            `json:"files,omitempty"`
	FileSetID          string                         `json:"fileSetId,omitempty"`
	Containers         []ContainerSpec                `json:"containers"`
	Health             *HealthSpec                    `json:"health,omitempty"`
	Command            config.StringOrList            `json:"command,omitempty,omitzero"`
	Entrypoint         config.StringOrList            `json:"entrypoint,omitempty,omitzero"`
	MemoryLimit        string                         `json:"memoryLimit,omitempty"`
	CPULimit           string                         `json:"cpuLimit,omitempty"`
	User               string                         `json:"user,omitempty"`
	WorkingDir         string                         `json:"workingDir,omitempty"`
	StopTimeoutSeconds int                            `json:"stopTimeoutSeconds,omitempty"`
	Init               bool                           `json:"init,omitempty"`
	ExtraHosts         []string                       `json:"extraHosts,omitempty"`
	Ulimits            map[string]config.UlimitConfig `json:"ulimits,omitempty"`
	ShmSize            string                         `json:"shmSize,omitempty"`
	// RegistryAuths carries request-scoped pull credentials; they feed an
	// ephemeral DOCKER_CONFIG for this reconcile only and are never
	// persisted (ADR 10).
	RegistryAuths []RegistryAuth `json:"registryAuths,omitempty"`
}

type ReconcileServiceResponse

type ReconcileServiceResponse struct {
	Project           string   `json:"project"`
	Environment       string   `json:"environment"`
	Service           string   `json:"service"`
	Containers        []string `json:"containers"`
	RemovedContainers int      `json:"removedContainers,omitempty"`
}

type RegistryAuth

type RegistryAuth struct {
	Registry string `json:"registry"`
	Username string `json:"username"`
	Password string `json:"password"`
}

RegistryAuth carries request-scoped credentials for one registry host. Credentials ride the request body only: they are written to an ephemeral docker config dir for the single docker invocation and never persist to takod state, argv, query strings, or logs (ADR 10).

type RemoveServiceRequest

type RemoveServiceRequest struct {
	Project      string `json:"project"`
	Environment  string `json:"environment"`
	Service      string `json:"service"`
	KeepRevision string `json:"keepRevision,omitempty"`
}

type RemoveServiceResponse

type RemoveServiceResponse struct {
	Project           string `json:"project"`
	Environment       string `json:"environment"`
	Service           string `json:"service"`
	RemovedContainers int    `json:"removedContainers"`
}

type Server

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

func NewServer

func NewServer(socket string, dataDir string, version string) *Server

func NewServerWithOptions

func NewServerWithOptions(socket string, dataDir string, version string, opts ServerOptions) *Server

func (*Server) Run

func (s *Server) Run(ctx context.Context) error

func (*Server) Status

func (s *Server) Status() Status

type ServerOptions

type ServerOptions struct {
	NodeName                string
	IdentityFile            string
	InventoryFile           string
	MembershipFile          string
	ActualRefreshInterval   time.Duration
	BuildCachePruneInterval time.Duration
	BuildCacheKeepStorage   string
	MinimumFreeDiskBytes    int64
	DockerDataRoot          string
	MaximumConcurrentBuilds int
	DiskAvailable           func(string) (int64, error)
	DiskIdentity            func(string) (string, error)
	UploadReadTimeout       time.Duration
}

type ServiceFileBundle added in v0.9.0

type ServiceFileBundle struct {
	Name      string             `json:"name"`
	Target    string             `json:"target"`
	Directory bool               `json:"directory,omitempty"`
	Secret    bool               `json:"secret,omitempty"`
	UID       int                `json:"uid,omitempty"`
	GID       int                `json:"gid,omitempty"`
	Entries   []ServiceFileEntry `json:"entries"`
}

ServiceFileBundle is one operator-managed file or directory mounted into a container. Data is request-scoped and is never written to desired state.

type ServiceFileEntry added in v0.9.0

type ServiceFileEntry struct {
	Path      string `json:"path,omitempty"`
	Data      []byte `json:"data,omitempty"`
	Mode      uint32 `json:"mode"`
	Directory bool   `json:"directory,omitempty"`
}

type ServiceFilesCheckRequest added in v0.9.0

type ServiceFilesCheckRequest struct {
	Project     string `json:"project"`
	Environment string `json:"environment"`
	Service     string `json:"service"`
	FileSetID   string `json:"fileSetId"`
}

type ServiceFilesRequest added in v0.9.0

type ServiceFilesRequest struct {
	Project     string              `json:"project"`
	Environment string              `json:"environment"`
	Service     string              `json:"service"`
	FileSetID   string              `json:"fileSetId"`
	Files       []ServiceFileBundle `json:"files"`
}

type StateDocumentRequest

type StateDocumentRequest struct {
	Project     string `json:"project"`
	Environment string `json:"environment"`
	Document    string `json:"document"`
	Node        string `json:"node,omitempty"`
	RevisionID  string `json:"revisionId,omitempty"`
	Content     string `json:"content,omitempty"`
}

type StateDocumentResponse

type StateDocumentResponse struct {
	Found   bool   `json:"found"`
	Content string `json:"content,omitempty"`
	Path    string `json:"path,omitempty"`
}

func AppendStateEvent

func AppendStateEvent(ctx context.Context, dataDir string, req StateDocumentRequest) (*StateDocumentResponse, error)

func DeleteStateDocument added in v0.4.8

func DeleteStateDocument(ctx context.Context, dataDir string, req StateDocumentRequest) (*StateDocumentResponse, error)

func ReadStateDocument

func ReadStateDocument(ctx context.Context, dataDir string, req StateDocumentRequest) (*StateDocumentResponse, error)

func WriteStateDocument

func WriteStateDocument(ctx context.Context, dataDir string, req StateDocumentRequest) (*StateDocumentResponse, error)

type StatsRequest

type StatsRequest struct {
	Project     string `json:"project,omitempty"`
	Environment string `json:"environment,omitempty"`
	Service     string `json:"service,omitempty"`
	All         bool   `json:"all,omitempty"`
}

type StatsResponse

type StatsResponse struct {
	Stats []ContainerStat `json:"stats"`
}

func ReadContainerStats

func ReadContainerStats(ctx context.Context, req StatsRequest) (*StatsResponse, error)

type Status

type Status struct {
	Runtime string `json:"runtime"`
	Version string `json:"version"`
	// UpgradeProtocol is independent from the application API. Minimum and
	// maximum report the stable lifecycle range accepted during rolling upgrades.
	UpgradeProtocol        int                    `json:"upgradeProtocol"`
	MinimumUpgradeProtocol int                    `json:"minimumUpgradeProtocol"`
	Capabilities           []string               `json:"capabilities,omitempty"`
	Hostname               string                 `json:"hostname"`
	Socket                 string                 `json:"socket"`
	DataDir                string                 `json:"dataDir"`
	StartedAt              time.Time              `json:"startedAt"`
	Now                    time.Time              `json:"now"`
	Identity               *nodeidentity.Identity `json:"identity,omitempty"`
	// EnrollmentRoles are immutable bootstrap facts. Current control-plane
	// roles are separate mutable state and must not be inferred from this list.
	EnrollmentRoles      []string                    `json:"enrollmentRoles,omitempty"`
	Membership           *nodeidentity.InventoryNode `json:"membership,omitempty"`
	MembershipGeneration uint64                      `json:"membershipGeneration,omitempty"`
	Node                 map[string]any              `json:"node,omitempty"`
	Peers                map[string]any              `json:"peers,omitempty"`
}

Jump to

Keyboard shortcuts

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