Documentation
¶
Overview ¶
Package deploywatch pins released images as rollback targets and watches each new release after cutover, rolling it back when it misbehaves.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type PinStore ¶
type PinStore interface {
LatestDeployAttemptFor(ctx context.Context, serviceName, image string) (*store.DeployAttempt, error)
SaveRollbackPin(ctx context.Context, p store.RollbackPin) error
ListRollbackPins(ctx context.Context, serviceName string) ([]store.RollbackPin, error)
DeleteRollbackPin(ctx context.Context, serviceName, attemptID string) error
}
PinStore is the store surface the Pinner needs. *store.DB satisfies it.
type Pinner ¶
type Pinner struct {
Store PinStore
Images docker.ImagePinner
Keep int
Namespace string
LocalNodeID string
Logger *slog.Logger
}
Pinner tags each release that takes traffic with an extra local reference, keeping the newest Keep per app. It only pins apps on the local node, where its image client can reach the image.
func (*Pinner) PinServing ¶
func (p *Pinner) PinServing(ctx context.Context, desired store.DesiredService, imageID string) (string, error)
PinServing implements application.RollbackPinner. It returns the new pin reference, or "" when nothing needed pinning.
type RestartCounter ¶
RestartCounter counts container restarts per resource since a time. alerting.RestartTracker satisfies it.
type WatchStore ¶
type WatchStore interface {
deploy.ImageDeployStore
ListGateEventsSince(ctx context.Context, phase, status string, since time.Time) ([]store.DeployGateEvent, error)
ListGateEvents(ctx context.Context, attemptID string) ([]store.DeployGateEvent, error)
RecordGateEvent(ctx context.Context, e store.DeployGateEvent) error
GetDesiredService(ctx context.Context, name string) (*store.DesiredService, error)
GetDeployAttempt(ctx context.Context, id string) (*store.DeployAttempt, error)
ListDeployAttempts(ctx context.Context, serviceName string) ([]store.DeployAttempt, error)
GetDeploySafetySettings(ctx context.Context, serviceName string) (store.DeploySafetySettings, error)
FailDeployAttemptWithReason(ctx context.Context, id, reason, message string) (bool, error)
SetDeployAttemptReason(ctx context.Context, id, reason string) error
ListRollbackPins(ctx context.Context, serviceName string) ([]store.RollbackPin, error)
}
WatchStore is the store surface the Watcher needs. *store.DB satisfies it.
type Watcher ¶
type Watcher struct {
Store WatchStore
Defaults deploysafety.Effective
// Inspectors returns the exit-state inspector for an app's node.
Inspectors func(nodeID string) (docker.ExitStateInspector, error)
Restarts RestartCounter
Metrics telemetry.MetricsQuerier
Resolver docker.ImageResolver
Nudger deploy.ReconcileNudger
Notify Notifier
// SampleInterval is the request sampler's tick; samples within one tick
// of cutover are left out of the 5xx rate.
SampleInterval time.Duration
Logger *slog.Logger
// contains filtered or unexported fields
}
Watcher watches each release for its post-deploy window.