drift

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActualService

type ActualService struct {
	Name     string
	Image    string
	Replicas int
	Running  int
}

ActualService represents a running service

type ActualServiceProvider added in v0.3.0

type ActualServiceProvider func() (map[string]ActualService, error)

type Detector

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

Detector performs continuous drift detection

func NewDetector

func NewDetector(client *ssh.Client, cfg *config.Config, environment string, notifier *notification.Notifier, verbose bool) *Detector

NewDetector creates a new drift detector

func NewDetectorWithActualProvider added in v0.3.0

func NewDetectorWithActualProvider(cfg *config.Config, environment string, notifier *notification.Notifier, verbose bool, provider ActualServiceProvider) *Detector

func (*Detector) CheckOnce

func (d *Detector) CheckOnce() (*DriftState, error)

CheckOnce performs a single drift detection check

func (*Detector) GetLastState

func (d *Detector) GetLastState() *DriftState

GetLastState returns the last drift state

func (*Detector) SaveState

func (d *Detector) SaveState(path string) error

SaveState saves the drift state to a file

func (*Detector) Start

func (d *Detector) Start(ctx context.Context, interval time.Duration) error

Start begins continuous drift detection

func (*Detector) Stop

func (d *Detector) Stop()

Stop stops continuous drift detection

type DriftReport

type DriftReport struct {
	Service    string            `json:"service"`
	Type       DriftType         `json:"type"`
	Expected   string            `json:"expected"`
	Actual     string            `json:"actual"`
	Details    map[string]string `json:"details,omitempty"`
	DetectedAt time.Time         `json:"detected_at"`
	Severity   string            `json:"severity"` // low, medium, high, critical
}

DriftReport represents a drift detection report

type DriftState

type DriftState struct {
	Project       string        `json:"project"`
	Environment   string        `json:"environment"`
	LastCheck     time.Time     `json:"last_check"`
	Drifts        []DriftReport `json:"drifts"`
	ServicesOK    []string      `json:"services_ok"`
	CheckDuration time.Duration `json:"check_duration"`
}

DriftState represents the current drift state

type DriftType

type DriftType string

DriftType represents the type of drift detected

const (
	DriftNone          DriftType = "none"
	DriftImageChanged  DriftType = "image_changed"
	DriftReplicasDown  DriftType = "replicas_down"
	DriftServiceGone   DriftType = "service_gone"
	DriftEnvChanged    DriftType = "env_changed"
	DriftConfigChanged DriftType = "config_changed"
	DriftUnexpected    DriftType = "unexpected_service"
)

Jump to

Keyboard shortcuts

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