deployer

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

Documentation

Index

Constants

View Source
const DefaultDeployRunTimeout = time.Hour
View Source
const DefaultReleaseTimeout = 5 * time.Minute

DefaultReleaseTimeout bounds a release command when the config sets none.

Variables

This section is empty.

Functions

func PrepareServiceFilesPayload added in v0.9.0

func PrepareServiceFilesPayload(project, environment, serviceName string, service *config.ServiceConfig) ([]takod.ServiceFileBundle, []string, string, error)

func ServiceFileMounts added in v0.9.0

func ServiceFileMounts(project, environment, serviceName string, files []config.ServiceFileConfig, contentHash string) ([]string, error)

func ServiceFileSetID added in v0.9.0

func ServiceFileSetID(contentHash string) (string, error)

func ServiceRevisionID added in v0.5.4

func ServiceRevisionID(project string, environment string, serviceName string, imageRef string, service config.ServiceConfig) string

Types

type DeployRunResult added in v0.9.0

type DeployRunResult struct {
	Service    string
	Server     string
	Image      string
	Command    []string
	ExitCode   int
	DurationMs int64
}

DeployRunResult is the machine/history record of a kind:run execution.

type Deployer

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

Deployer handles deployment operations

func NewDeployer

func NewDeployer(client any, cfg *config.Config, environment string, verbose bool) *Deployer

NewDeployer creates a new deployer

func NewDeployerWithPool

func NewDeployerWithPool(client any, cfg *config.Config, environment string, sshPool *ssh.Pool, verbose bool) *Deployer

NewDeployerWithPool creates a deployer with SSH pool for multi-server support

func (*Deployer) ActivateTakodServiceRevision added in v0.5.4

func (d *Deployer) ActivateTakodServiceRevision(serviceName string, service *config.ServiceConfig, imageRef string) error

func (*Deployer) ApplyJobSchedules added in v0.8.0

func (d *Deployer) ApplyJobSchedules(services map[string]config.ServiceConfig) error

ApplyJobSchedules declaratively reconciles the environment's whole job set on every target node: each job lands on its owning node's payload and is absent from every other node's, so stale schedules (moved or removed jobs) are unscheduled in the same pass.

func (*Deployer) BuildImage

func (d *Deployer) BuildImage(serviceName string, service *config.ServiceConfig, imageRef ...string) (string, error)

BuildImage builds a Docker image for a service without deploying it.

func (*Deployer) BuildSharedTakodImage added in v0.9.0

func (d *Deployer) BuildSharedTakodImage(buildName string, build config.SharedBuildConfig, imageRef string, consumers map[string]config.ServiceConfig) error

BuildSharedTakodImage builds one top-level build exactly once across the union of nodes used by its consumers.

func (*Deployer) DeployPreparedServiceTakod added in v0.9.0

func (d *Deployer) DeployPreparedServiceTakod(serviceName string, service *config.ServiceConfig, imageRef string, warmOnly bool) error

DeployPreparedServiceTakod reconciles a service whose shared image was already built and transferred to every node selected for its placement.

func (*Deployer) DeployServiceTakod added in v0.3.0

func (d *Deployer) DeployServiceTakod(serviceName string, service *config.ServiceConfig, imageRef string) error

DeployServiceTakod reconciles one service through standalone Docker containers on the nodes chosen by takod placement.

func (*Deployer) DeployServiceTakodWarmOnly added in v0.5.4

func (d *Deployer) DeployServiceTakodWarmOnly(serviceName string, service *config.ServiceConfig, imageRef string) error

func (*Deployer) EnsurePreparedServiceImage added in v0.9.0

func (d *Deployer) EnsurePreparedServiceImage(serviceName string, service *config.ServiceConfig, imageRef string) error

EnsurePreparedServiceImage transfers an existing exact shared image to newly selected nodes before scale/rollback reconciliation. It never rebuilds.

func (*Deployer) EnsureSharedTakodImage added in v0.9.0

func (d *Deployer) EnsureSharedTakodImage(buildName string, imageRef string, consumers map[string]config.ServiceConfig) error

func (*Deployer) JobOwnerServer added in v0.8.0

func (d *Deployer) JobOwnerServer(serviceName string, service *config.ServiceConfig) (string, error)

JobOwnerServer resolves the single node that runs a job's cron schedule: the job's first placement target, deterministic for a stable config.

func (*Deployer) MovePreparedServiceTakod added in v0.10.0

func (d *Deployer) MovePreparedServiceTakod(serviceName string, service *config.ServiceConfig, imageRef string, destinationNodes, sourceNodes []string) error

MovePreparedServiceTakod applies a reviewed stateless movement in safe order: copy the exact image, reconcile every destination, then remove or reduce replicas on sources. It does not rebuild or run release commands.

func (*Deployer) PreflightAssignmentMutations added in v0.10.0

func (d *Deployer) PreflightAssignmentMutations(services map[string]config.ServiceConfig) error

PreflightAssignmentMutations rejects deterministic lifecycle failures for the complete mutation set before the first image, container, schedule, or proxy mutation begins.

func (*Deployer) PreflightAssignmentRemovals added in v0.10.0

func (d *Deployer) PreflightAssignmentRemovals(serviceNames []string) error

PreflightAssignmentRemovals proves every previously assigned node can receive cleanup before desired state drops the service binding.

func (*Deployer) PreflightTakodProxyCapabilities added in v0.9.2

func (d *Deployer) PreflightTakodProxyCapabilities(services map[string]config.ServiceConfig) error

PreflightTakodProxyCapabilities verifies every proxy target understands all route-manifest fields before an applying workflow mutates service state.

func (*Deployer) PrepareServiceFiles added in v0.9.0

func (d *Deployer) PrepareServiceFiles(serviceName string, service *config.ServiceConfig) ([]takod.ServiceFileBundle, []string, string, error)

PrepareServiceFiles reads operator-managed files without text conversion, builds their request-scoped payload and read-only mounts, and returns a non-reversible content fingerprint.

func (*Deployer) PruneTakodServiceRevisions added in v0.5.4

func (d *Deployer) PruneTakodServiceRevisions(services map[string]config.ServiceConfig, keepRevisions map[string]string) error

func (*Deployer) ReconcileTakodProxy added in v0.3.0

func (d *Deployer) ReconcileTakodProxy(services map[string]config.ServiceConfig) error

func (*Deployer) ReconcileTakodProxyWithActiveRevisions added in v0.5.4

func (d *Deployer) ReconcileTakodProxyWithActiveRevisions(services map[string]config.ServiceConfig, activeRevisions map[string]string) error

func (*Deployer) ReleaseRunFor added in v0.8.0

func (d *Deployer) ReleaseRunFor(serviceName string) *ReleaseRun

ReleaseRunFor returns the recorded release run for a service in this deploy, or nil when no release command ran.

func (*Deployer) RemoveServiceTakod added in v0.3.0

func (d *Deployer) RemoveServiceTakod(serviceName string) error

func (*Deployer) ResolveAllAssignments added in v0.10.0

func (d *Deployer) ResolveAllAssignments(services map[string]config.ServiceConfig) error

ResolveAllAssignments plans every desired service without mutating nodes. This ensures a successful state write never omits bindings merely because a service happened to be up to date or had no proxy route in this operation.

func (*Deployer) ResolvedAssignments added in v0.10.0

func (d *Deployer) ResolvedAssignments() map[string][]scheduler.Assignment

ResolvedAssignments returns every prior or newly planned binding known to this deployer, suitable for the next desired-state revision.

func (*Deployer) RollbackToState

func (d *Deployer) RollbackToState(serviceName string, serviceState *state.ServiceState) error

RollbackToState converges a service back to a saved takod deployment state.

func (*Deployer) RunDeployStep added in v0.9.0

func (d *Deployer) RunDeployStep(serviceName string, service *config.ServiceConfig, imageRef string, pullImage bool) (*DeployRunResult, error)

RunDeployStep executes one kind:run service on its deterministic placement owner. It blocks until exit and treats every non-zero/missing status as a deployment failure.

func (*Deployer) RunDeployStepOnNodes added in v0.9.0

func (d *Deployer) RunDeployStepOnNodes(serviceName string, service *config.ServiceConfig, imageRef string, pullImage bool, availableImageNodes []string) (*DeployRunResult, error)

RunDeployStepOnNodes restricts execution to nodes known to carry a local build-backed image. A nil restriction is used for pullable images and full deploys where the source build has just run on its planned node.

func (*Deployer) RunInputHash added in v0.9.0

func (d *Deployer) RunInputHash(service *config.ServiceConfig) (string, error)

RunInputHash returns a non-reversible digest of the exact env-file content a deploy-time run will receive, including resolved env files and secrets.

func (*Deployer) SetBaseContext added in v0.8.0

func (d *Deployer) SetBaseContext(ctx context.Context)

SetBaseContext threads the caller's context into long-running deployer streams (image builds, build-context archive uploads, service reconcile pulls) so cancelling a deploy interrupts in-flight remote work instead of waiting for it to finish.

func (*Deployer) SetCLIVersion added in v0.3.0

func (d *Deployer) SetCLIVersion(version string)

func (*Deployer) SetEventSink added in v0.8.0

func (d *Deployer) SetEventSink(sink events.Sink)

SetEventSink routes release-command lifecycle events to an engine event stream; without one, event messages fall back to the progress output.

func (*Deployer) SetOutput added in v0.7.0

func (d *Deployer) SetOutput(w io.Writer)

SetOutput redirects deployer progress output. Passing nil resets output to os.Stdout.

func (*Deployer) SetPlacementMovementTargets added in v0.10.0

func (d *Deployer) SetPlacementMovementTargets(serverNames []string) error

SetPlacementMovementTargets is reserved for a controller-fenced reviewed movement plan. It may include a cordoned/draining source solely so the reconcile request can remove its old replica.

func (*Deployer) SetPriorAssignments added in v0.10.0

func (d *Deployer) SetPriorAssignments(assignments map[string][]scheduler.Assignment)

SetPriorAssignments seeds the scheduler with the last persisted desired replica bindings. The map is copied because planning mutates its own view.

func (*Deployer) SetRuntimeFactory added in v0.10.0

func (d *Deployer) SetRuntimeFactory(factory *nodeclient.Factory)

SetRuntimeFactory shares the caller-owned identity-aware runtime transport across state, deploy, and image operations. The caller remains responsible for closing its idle connections after the operation.

func (*Deployer) SetSkipBuild added in v0.4.47

func (d *Deployer) SetSkipBuild(skip bool)

func (*Deployer) SetTargetServers added in v0.3.0

func (d *Deployer) SetTargetServers(serverNames []string) error

SetTargetServers restricts takod reconciliation to a validated subset of the environment nodes. Passing an empty slice restores the full environment.

func (*Deployer) SetupTakodRuntime added in v0.3.0

func (d *Deployer) SetupTakodRuntime() error

SetupTakodRuntime prepares every selected environment server for the takod runtime.

type IgnoreParser

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

IgnoreParser handles parsing of .gitignore and .dockerignore files

func NewIgnoreParser

func NewIgnoreParser() *IgnoreParser

NewIgnoreParser creates a new ignore parser

func (*IgnoreParser) AddDefaultExclusions

func (ip *IgnoreParser) AddDefaultExclusions()

AddDefaultExclusions adds commonly excluded patterns

func (*IgnoreParser) GetExcludedPatterns

func (ip *IgnoreParser) GetExcludedPatterns() []string

GetExcludedPatterns returns all exclusion patterns

func (*IgnoreParser) LoadIgnoreFile

func (ip *IgnoreParser) LoadIgnoreFile(filePath string) error

LoadIgnoreFile loads patterns from a .gitignore or .dockerignore file

func (*IgnoreParser) ShouldIgnore

func (ip *IgnoreParser) ShouldIgnore(relPath string) bool

ShouldIgnore checks if a file path should be ignored

type RegistryAuthError added in v0.8.0

type RegistryAuthError struct {
	Node string
	Err  error
}

RegistryAuthError marks an image pull/build failure caused by registry credentials (missing, wrong, or expired) rather than a missing image, so callers can prompt for credential rotation instead of retrying.

func (*RegistryAuthError) Error added in v0.8.0

func (e *RegistryAuthError) Error() string

func (*RegistryAuthError) Unwrap added in v0.8.0

func (e *RegistryAuthError) Unwrap() error

type ReleaseRun added in v0.8.0

type ReleaseRun struct {
	Service    string
	Server     string
	Image      string
	Command    []string
	ExitCode   int
	DurationMs int64
}

ReleaseRun records one executed release command for the deploy result.

Jump to

Keyboard shortcuts

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