status

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

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

func Report

func Report(ctx context.Context, cfg Config, registry *Registry) error

Report prints each target's SPECTRE mirror status and git commit for the config's service. Per-target errors are printed; they do not abort the report.

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 File

type File string

File is a filesystem path to a file.

type GitCommit

type GitCommit string

GitCommit is the git commit an image was built from, or "" when unknown.

func (GitCommit) String added in v0.35.0

func (c GitCommit) String() string

String returns the commit hash.

type Image

type Image string

Image is a container image reference, optionally pinned with an "@" digest.

func (Image) String added in v0.35.0

func (i Image) String() string

String returns the image reference.

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
	// Commit is the git commit the mirror runs when it differs from its image's,
	// e.g. for code synced over the image, or "" to resolve it from the image.
	Commit GitCommit
}

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

type PlatformFactory func(app string) (Platform, error)

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 NewRegistry

func NewRegistry() *Registry

NewRegistry returns an empty platform registry.

func (*Registry) New

func (r *Registry) New(name, app string) (Platform, error)

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.

Jump to

Keyboard shortcuts

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