Documentation
¶
Overview ¶
Package rolloutpolicy resolves a rolling deploy's max_surge, max_unavailable and min_available into replica counts, and tracks the live progress of each rollout for the API.
Index ¶
- Constants
- func CheckDisruption(app, action string, minAvailable, available, removing int) error
- func ClearHold(service string)
- func Held(service string) bool
- func ParseValue(v string) (n int, percent bool, err error)
- func Record(service string, p Progress)
- func RestorePause(service string)
- func SetLiveEnv(e Env)
- func ShouldHold(service, releaseKey string) bool
- type DisruptionError
- type Env
- type Policy
- type Progress
- type Resolved
Constants ¶
const ( EnvMaxSurge = "APP_ROLLOUT_MAX_SURGE" EnvMinAvailable = "APP_ROLLOUT_MIN_AVAILABLE" )
Env names for the platform defaults an app's rollout: block overrides.
const ( PhaseRolling = "rolling" PhasePaused = "paused" PhaseComplete = "complete" PhaseFailed = "failed" )
Rollout phases.
Variables ¶
This section is empty.
Functions ¶
func CheckDisruption ¶
CheckDisruption refuses taking removing replicas out of available ones when that would drop below minAvailable. Zero minAvailable never blocks.
func ClearHold ¶
func ClearHold(service string)
ClearHold drops any pause for service, used when its rollout ends.
func ParseValue ¶
ParseValue validates an int or percent value without resolving it.
func RestorePause ¶
func RestorePause(service string)
RestorePause re-arms a pause saved with a rollout's progress after a restart.
func SetLiveEnv ¶
func SetLiveEnv(e Env)
SetLiveEnv points the defaults at the runtime settings so a change applies to the next rollout. nil goes back to the process environment alone.
func ShouldHold ¶
ShouldHold is asked by the controller before it starts a wave. A hold taken for one release lapses when the release changes, so a rollback is not held.
Types ¶
type DisruptionError ¶
type DisruptionError struct {
App string
Action string
MinAvailable int
Available int
Remaining int
}
DisruptionError is returned when a voluntary operation would breach an app's min_available budget.
func (*DisruptionError) Error ¶
func (e *DisruptionError) Error() string
type Env ¶
Env reads a variable; OSEnv is the live settings lookup with the process environment behind it.
type Policy ¶
type Policy struct {
MaxSurge string `json:"max_surge,omitempty"`
MinAvailable string `json:"min_available,omitempty"`
}
Policy is an app's rollout settings as written: an int ("2") or a percent of replicas ("25%"). Empty inherits the env default.
type Progress ¶
type Progress struct {
Active bool `json:"active"`
Phase string `json:"phase"`
Wave int `json:"wave"`
Waves int `json:"waves"`
Desired int `json:"desired"`
Updated int `json:"updated"`
Ready int `json:"ready"`
Surge int `json:"surge"`
MaxSurge int `json:"max_surge"`
Paused bool `json:"paused,omitempty"`
Message string `json:"message,omitempty"`
StartedAt time.Time `json:"started_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Progress is one app's rolling deploy as the reconciler last saw it.
func RequestPause ¶
RequestPause holds service's rolling deploy at the next wave boundary. It reports false when no rollout is in progress.