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 ¶
const ( KindEnv = "env" KindSecret = "secret" KindScale = "scale" KindResources = "resources" KindDomains = "domains" KindHealth = "health" )
Change kinds, one per revertible area.
const MaskedValue = "[masked]"
MaskedValue stands in for a withheld env value.
Variables ¶
This section is empty.
Functions ¶
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.