Documentation
¶
Overview ¶
Package status reports the SPECTRE migration status for a service: whether each environment in its migration config runs a SPECTRE mirror, the commit it runs, and its live candidate status. The deploy platform is pluggable: a custom binary registers one through spectre.WithStatusPlatform.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// ConfigFile is the path to the SPECTRE migration config TOML file.
ConfigFile File `default:"spectre/migration.toml" help:"Path to the SPECTRE migration config TOML file."`
}
Config configures the status command.
type Digest ¶
type Digest string
Digest is an image's "@" content digest, or "" when the image carries none.
type GitCommit ¶
type GitCommit string
GitCommit is the git commit an image was built from, or "" when unknown.
type Image ¶
type Image string
Image is a container image reference, optionally pinned with an "@" digest.
type MigrationConfig ¶
type MigrationConfig struct {
// App is the service name the config migrates.
App string `toml:"app"`
// Platform names the deploy platform the service runs on, e.g. ski.
Platform string `toml:"platform"`
// Environments lists the <env>-<region> targets to check, e.g. staging-us-west-2.
Environments []string `toml:"environments"`
}
MigrationConfig describes a SPECTRE migration for one application: the deploy platform it runs on and the environments that run a SPECTRE mirror.
func LoadMigrationConfig ¶
func LoadMigrationConfig(path File) (MigrationConfig, error)
LoadMigrationConfig reads and validates the migration config TOML file at path.
type MirrorState ¶
type MirrorState struct {
// Enabled is true when the target deploys a SPECTRE mirror.
Enabled bool
// Image is the mirror's full image reference, including its digest.
Image Image
// Digest is the mirror image's "@" digest, or "" when it carries none.
Digest Digest
}
MirrorState is a service's SPECTRE mirror state for one deploy target.
type Platform ¶
type Platform interface {
// Mirror reports the SPECTRE mirror state for one <env>-<region> target. It
// fails when the platform cannot tell whether the target runs a mirror.
Mirror(ctx context.Context, target string) (MirrorState, error)
// ResolveCommit returns the git commit for image, or "" when unknown.
ResolveCommit(ctx context.Context, image Image) (GitCommit, error)
// ResolveStatus reads the live candidate quarantine status for one target.
ResolveStatus(ctx context.Context, target string) (QuarantineReport, error)
}
Platform inspects a service's SPECTRE mirror on a specific deploy platform: how the mirror is deployed, the commit it runs, and its live status.
type PlatformFactory ¶
PlatformFactory builds the Platform that inspects app's SPECTRE mirror.
type QuarantineReport ¶
type QuarantineReport struct {
// Quarantined is true when any proxy has quarantined the candidate.
Quarantined bool `json:"quarantined"`
// Sources is the per-proxy quarantine state.
Sources []SourceStatus `json:"sources"`
}
QuarantineReport is the live SPECTRE status read from a mirror.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry maps a config's platform name to the factory that builds it. A custom binary populates it through spectre.WithStatusPlatform.
func (*Registry) New ¶
New builds the platform named in a config for app. An unregistered name yields a dummy platform whose inspections fail, naming the platform the build lacks.
func (*Registry) Register ¶
func (r *Registry) Register(name string, factory PlatformFactory)
Register adds the factory for a platform name, replacing any earlier one.
type SourceStatus ¶
type SourceStatus struct {
// Name identifies the proxy, e.g. "ingress" or "egress".
Name string `json:"name"`
// Quarantined is true once this proxy has refused candidate traffic.
Quarantined bool `json:"quarantined"`
// Reason is the error that triggered quarantine, empty while healthy.
Reason string `json:"reason"`
// Since is when quarantine began, as RFC 3339, empty while healthy.
Since string `json:"since"`
}
SourceStatus is one proxy's quarantine state in a QuarantineReport.