configrev

package
v1.5.8 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package configrev versions the revertible part of an app definition (env, scale, resources, domains, health) and plans a revert to an earlier version. Secret values never enter a snapshot: they appear as references only.

Index

Constants

View Source
const (
	KindEnv       = "env"
	KindSecret    = "secret"
	KindScale     = "scale"
	KindResources = "resources"
	KindDomains   = "domains"
	KindHealth    = "health"
)

Change kinds, one per revertible area.

View Source
const MaskedValue = "[masked]"

MaskedValue stands in for a withheld env value.

Variables

This section is empty.

Functions

func Equal

func Equal(a, b Snapshot) bool

Equal reports whether two snapshots describe the same definition.

func Kinds

func Kinds(changes []FieldChange) []string

Kinds lists the distinct kinds in a diff.

func Marshal

func Marshal(s Snapshot) (string, error)

Marshal and Unmarshal keep the JSON form in one place.

Types

type FieldChange

type FieldChange struct {
	Kind  string `json:"kind"`
	Field string `json:"field"`
	From  string `json:"from,omitempty"`
	To    string `json:"to,omitempty"`
}

FieldChange is one line of a diff. From and To are never secret values: a masked env key shows MaskedValue, a secret reference shows "secret:NAME".

func Diff

func Diff(old, next Snapshot) []FieldChange

Diff lists what differs going from old to next.

type Plan

type Plan struct {
	Service store.DesiredService
	// Skipped names env keys whose masked value cannot be restored.
	Skipped []string
}

Plan is the result of applying a target snapshot onto the live service.

func Apply

func Apply(live store.DesiredService, target Snapshot) Plan

Apply returns the live service with the revertible fields set to the target. A masked env key keeps its current value, and is reported in Skipped when the target had it but the live service no longer does. Nothing outside the revertible fields (databases, volumes, image) is touched.

type Snapshot

type Snapshot struct {
	// Env holds plain values only. A key the classifier calls sensitive is listed
	// in EnvMasked and its value is dropped.
	Env       map[string]string       `json:"env,omitempty"`
	EnvMasked []string                `json:"env_masked,omitempty"`
	SecretEnv []store.SecretEnvRef    `json:"secret_env,omitempty"`
	Replicas  int                     `json:"replicas"`
	Strategy  string                  `json:"strategy"`
	Resources *store.ServiceResources `json:"resources,omitempty"`
	Health    *store.ServiceHealth    `json:"health,omitempty"`
	Domains   []string                `json:"domains,omitempty"`
}

Snapshot is the stored, secret-free form of the revertible fields.

func Capture

func Capture(svc store.DesiredService) Snapshot

Capture builds the snapshot of a service.

func Unmarshal

func Unmarshal(raw string) (Snapshot, error)

Unmarshal decodes a stored snapshot.

Jump to

Keyboard shortcuts

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