reconcile

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GatherActualState

func GatherActualState(
	client *ssh.Client,
	projectName string,
	environment string,
	stateMgr *localstate.Manager,
) (map[string]*ActualService, error)

GatherActualState collects information about currently running services Returns a map of serviceName -> ActualService

func GetServiceInspectData

func GetServiceInspectData(client *ssh.Client, serviceName string, isSwarm bool) (map[string]interface{}, error)

GetServiceInspectData retrieves detailed service information

Types

type ActualService

type ActualService struct {
	Name           string
	Image          string
	Replicas       int
	Containers     []string
	ConfigSnapshot *config.ServiceConfig // Last deployed config
}

ActualService represents a currently running service

type ActualServiceDetails added in v0.1.3

type ActualServiceDetails struct {
	Name     string
	Image    string
	Replicas int
	Env      map[string]string
	Volumes  []string // Mount targets
	Labels   map[string]string
}

ActualServiceDetails contains detailed actual state of a service

func GatherActualServiceDetails added in v0.1.3

func GatherActualServiceDetails(client *ssh.Client, fullServiceName string) (*ActualServiceDetails, error)

GatherActualServiceDetails retrieves full details for a service

type ChangeType

type ChangeType string

ChangeType represents the type of change needed

const (
	ChangeAdd    ChangeType = "add"    // New service in config
	ChangeUpdate ChangeType = "update" // Service exists but changed
	ChangeRemove ChangeType = "remove" // Service removed from config
	ChangeNone   ChangeType = "none"   // No changes needed
)

type DriftChange added in v0.1.3

type DriftChange struct {
	Field        string // "env", "volume", "label", "replicas", "image"
	Key          string // Environment variable name, volume path, label key, etc.
	ActualValue  string
	DesiredValue string
	IsManual     bool // True if this appears to be a manual change
}

DriftChange represents a detected drift in a service

func DetectDrift added in v0.1.3

func DetectDrift(actual *ActualServiceDetails, desired *config.ServiceConfig) []DriftChange

DetectDrift compares actual state with desired state and returns drift changes

type ReconciliationPlan

type ReconciliationPlan struct {
	ProjectName string
	Environment string
	Changes     []ServiceChange
	Summary     ReconciliationSummary
}

ReconciliationPlan represents the full plan of changes

func ComputePlan

func ComputePlan(
	projectName string,
	environment string,
	desiredServices map[string]config.ServiceConfig,
	actualServices map[string]*ActualService,
) *ReconciliationPlan

ComputePlan compares desired state (config) with actual state (running services) and generates a reconciliation plan

func (*ReconciliationPlan) FormatPlan

func (p *ReconciliationPlan) FormatPlan() string

FormatPlan returns a human-readable formatted plan

func (*ReconciliationPlan) FormatPlanVerbose added in v0.0.3

func (p *ReconciliationPlan) FormatPlanVerbose(showUnchanged bool) string

FormatPlanVerbose returns a detailed formatted plan with optional unchanged services

func (*ReconciliationPlan) HasDestructiveChanges

func (p *ReconciliationPlan) HasDestructiveChanges() bool

HasDestructiveChanges returns true if plan includes removals

func (*ReconciliationPlan) IsEmpty

func (p *ReconciliationPlan) IsEmpty() bool

IsEmpty returns true if no changes needed

func (*ReconciliationPlan) NeedsConfirmation

func (p *ReconciliationPlan) NeedsConfirmation() bool

NeedsConfirmation returns true if user should confirm before proceeding

type ReconciliationSummary

type ReconciliationSummary struct {
	Total   int
	Adds    int
	Updates int
	Removes int
	NoOps   int
}

ReconciliationSummary provides counts of changes

type ServiceChange

type ServiceChange struct {
	Type        ChangeType
	ServiceName string
	OldConfig   *config.ServiceConfig // nil for adds
	NewConfig   *config.ServiceConfig // nil for removes
	Reasons     []string              // Why this change is needed
}

ServiceChange represents a change to be made to a service

Jump to

Keyboard shortcuts

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