Documentation
¶
Index ¶
- Constants
- Variables
- func PersistDesiredToServers(pool *ssh.Pool, cfg *config.Config, environment string, serverNames []string, ...) error
- func PersistToServers(pool *ssh.Pool, cfg *config.Config, environment string, serverNames []string, ...) error
- func StaleNodeActualNames(previous *ActualSnapshot, current *ActualSnapshot, ...) []string
- type ActualNodeSnapshot
- type ActualService
- type ActualSnapshot
- func BuildActualSnapshot(project string, environment string, targetNodes []string, ...) *ActualSnapshot
- func BuildActualSnapshotWithNodes(project string, environment string, targetNodes []string, ...) *ActualSnapshot
- func BuildNodeActualSnapshot(project string, environment string, node string, ...) *ActualSnapshot
- type DesiredBuild
- type DesiredRevision
- func BuildDesiredRevision(cfg *config.Config, environment string, source string, ...) (*DesiredRevision, error)
- func BuildDesiredRevisionWithAssignments(cfg *config.Config, environment string, source string, ...) (*DesiredRevision, error)
- func BuildDesiredRevisionWithPlacementIntent(cfg *config.Config, environment string, source string, ...) (*DesiredRevision, error)
- func BuildDesiredRevisionWithPlacementSnapshot(cfg *config.Config, environment string, source string, ...) (*DesiredRevision, error)
- type DesiredService
- type Event
- type GitInfo
- type Manager
- func (m *Manager) AppendEvent(event Event) error
- func (m *Manager) DeleteNodeActual(node string) error
- func (m *Manager) ReadActual() (*ActualSnapshot, error)
- func (m *Manager) ReadDesired() (*DesiredRevision, error)
- func (m *Manager) ReadNodeActual(node string) (*ActualSnapshot, error)
- func (m *Manager) WithRequestTimeout(timeout time.Duration) *Manager
- func (m *Manager) WriteActual(snapshot *ActualSnapshot) error
- func (m *Manager) WriteDesired(revision *DesiredRevision) error
- func (m *Manager) WriteNodeActual(node string, snapshot *ActualSnapshot) error
Constants ¶
const (
SchemaVersion = 1
)
Variables ¶
var ErrNotFound = errors.New("takod state not found")
Functions ¶
func PersistDesiredToServers ¶ added in v0.10.0
func PersistDesiredToServers(pool *ssh.Pool, cfg *config.Config, environment string, serverNames []string, desired *DesiredRevision, event Event, verbose bool) error
PersistDesiredToServers durably records placement/config intent before any workload mutation. Actual snapshots remain untouched until reconciliation finishes, so an interrupted operation is visible as desired/actual drift.
func PersistToServers ¶
func PersistToServers(pool *ssh.Pool, cfg *config.Config, environment string, serverNames []string, desired *DesiredRevision, actual *ActualSnapshot, nodeActual map[string]*ActualSnapshot, event Event, verbose bool) error
func StaleNodeActualNames ¶ added in v0.4.8
func StaleNodeActualNames(previous *ActualSnapshot, current *ActualSnapshot, currentNodeActual map[string]*ActualSnapshot) []string
StaleNodeActualNames returns previous node snapshots that are no longer active.
Types ¶
type ActualNodeSnapshot ¶
type ActualNodeSnapshot struct {
Node string `json:"node"`
Services map[string]ActualService `json:"services"`
CapturedAt time.Time `json:"capturedAt"`
}
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"`
}
type ActualSnapshot ¶
type ActualSnapshot struct {
SchemaVersion int `json:"schemaVersion"`
Project string `json:"project"`
Environment string `json:"environment"`
Node string `json:"node,omitempty"`
TargetNodes []string `json:"targetNodes,omitempty"`
Services map[string]ActualService `json:"services"`
Nodes map[string]ActualNodeSnapshot `json:"nodes,omitempty"`
CapturedAt time.Time `json:"capturedAt"`
}
func BuildActualSnapshot ¶
func BuildActualSnapshot(project string, environment string, targetNodes []string, actual map[string]*reconcile.ActualService) *ActualSnapshot
func BuildActualSnapshotWithNodes ¶
func BuildActualSnapshotWithNodes(project string, environment string, targetNodes []string, actual map[string]*reconcile.ActualService, nodeActual map[string]map[string]*reconcile.ActualService) *ActualSnapshot
func BuildNodeActualSnapshot ¶
func BuildNodeActualSnapshot(project string, environment string, node string, actual map[string]*reconcile.ActualService) *ActualSnapshot
type DesiredBuild ¶ added in v0.9.0
type DesiredRevision ¶
type DesiredRevision struct {
SchemaVersion int `json:"schemaVersion"`
RevisionID string `json:"revisionId"`
Project string `json:"project"`
Environment string `json:"environment"`
Source string `json:"source"`
TargetNodes []string `json:"targetNodes"`
Builds map[string]DesiredBuild `json:"builds,omitempty"`
Services map[string]DesiredService `json:"services"`
Git GitInfo `json:"git,omitempty"`
CreatedAt time.Time `json:"createdAt"`
}
func BuildDesiredRevision ¶
func BuildDesiredRevisionWithAssignments ¶ added in v0.10.0
func BuildDesiredRevisionWithPlacementIntent ¶ added in v0.10.0
func BuildDesiredRevisionWithPlacementIntent(cfg *config.Config, environment string, source string, services map[string]config.ServiceConfig, imageRefs map[string]string, targetNodes []string, assignments map[string][]scheduler.Assignment, pendingRemovals map[string]config.ServiceConfig, git GitInfo) (*DesiredRevision, error)
BuildDesiredRevisionWithPlacementIntent retains removal-pending service bindings until cleanup succeeds, making interrupted removals retryable.
func BuildDesiredRevisionWithPlacementSnapshot ¶ added in v0.10.0
func BuildDesiredRevisionWithPlacementSnapshot(cfg *config.Config, environment string, source string, services map[string]config.ServiceConfig, imageRefs map[string]string, targetNodes []string, assignments map[string][]scheduler.Assignment, pendingRemovals map[string]config.ServiceConfig, preservedServices map[string]DesiredService, git GitInfo) (*DesiredRevision, error)
BuildDesiredRevisionWithPlacementSnapshot carries prior desired-service records that are outside the current workflow's scope. This is necessary for targeted and non-removal operations: rewriting desired state must not clear an unrelated removalPending marker or forget a workload removed from the operator's current config before a full deploy reconciles it.
type DesiredService ¶
type DesiredService struct {
APIVersion string `json:"apiVersion,omitempty"`
Kind string `json:"kind,omitempty"`
Name string `json:"name"`
WorkloadKind string `json:"workloadKind,omitempty"`
Type string `json:"type"`
Image string `json:"image,omitempty"`
ImageFrom string `json:"imageFrom,omitempty"`
Build string `json:"build,omitempty"`
BuildArgKeys []string `json:"buildArgKeys,omitempty"`
BuildTarget string `json:"buildTarget,omitempty"`
Command string `json:"command,omitempty"`
CommandArgs []string `json:"commandArgs,omitempty"`
Entrypoint string `json:"entrypoint,omitempty"`
EntrypointArgs []string `json:"entrypointArgs,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Port int `json:"port,omitempty"`
Replicas int `json:"replicas"`
Assignments []scheduler.Assignment `json:"assignments,omitempty"`
Restart string `json:"restart,omitempty"`
Persistent bool `json:"persistent,omitempty"`
Placement *config.PlacementConfig `json:"placement,omitempty"`
Domains []string `json:"domains,omitempty"`
Volumes []string `json:"volumes,omitempty"`
Files []config.ServiceFileConfig `json:"files,omitempty"`
EnvKeys []string `json:"envKeys,omitempty"`
EnvFile bool `json:"envFile,omitempty"`
User string `json:"user,omitempty"`
WorkingDir string `json:"workingDir,omitempty"`
StopGracePeriod string `json:"stopGracePeriod,omitempty"`
Init bool `json:"init,omitempty"`
ExtraHosts []string `json:"extraHosts,omitempty"`
Ulimits map[string]config.UlimitConfig `json:"ulimits,omitempty"`
ShmSize string `json:"shmSize,omitempty"`
SecretRefs []string `json:"secretRefs,omitempty"`
DependsOn []string `json:"dependsOn,omitempty"`
HealthCheck config.HealthCheckConfig `json:"healthCheck,omitempty"`
DeployStrategy string `json:"deployStrategy,omitempty"`
RemovalPending bool `json:"removalPending,omitempty"`
}
type Event ¶
type Event struct {
SchemaVersion int `json:"schemaVersion"`
Type string `json:"type"`
Project string `json:"project"`
Environment string `json:"environment"`
RevisionID string `json:"revisionId,omitempty"`
Service string `json:"service,omitempty"`
Message string `json:"message,omitempty"`
Details map[string]string `json:"details,omitempty"`
Time time.Time `json:"time"`
}
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) AppendEvent ¶
func (*Manager) DeleteNodeActual ¶ added in v0.4.8
func (*Manager) ReadActual ¶
func (m *Manager) ReadActual() (*ActualSnapshot, error)
func (*Manager) ReadDesired ¶
func (m *Manager) ReadDesired() (*DesiredRevision, error)
func (*Manager) ReadNodeActual ¶
func (m *Manager) ReadNodeActual(node string) (*ActualSnapshot, error)
func (*Manager) WithRequestTimeout ¶ added in v0.4.16
WithRequestTimeout returns a shallow copy that uses a custom takod request deadline. A non-positive timeout keeps the package default.
func (*Manager) WriteActual ¶
func (m *Manager) WriteActual(snapshot *ActualSnapshot) error
func (*Manager) WriteDesired ¶
func (m *Manager) WriteDesired(revision *DesiredRevision) error
func (*Manager) WriteNodeActual ¶
func (m *Manager) WriteNodeActual(node string, snapshot *ActualSnapshot) error