Help us shape the future of Go! Take the 2026 Go Developer Survey

rollout

package
v1.37.1-stratum.0-rc.2 Latest Latest
Warning

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

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

Documentation

Overview

Package rollout restarts the in-cluster workloads Stratum owns, so that every command that has to do it (snapshot restore, and rotate-ca) rolls one list.

Index

Constants

This section is empty.

Variables

View Source
var Workloads = []Workload{
	{"cilium agent + operator", "kube-system", "ds/cilium", []string{"ds/cilium", "deploy/cilium-operator"}},
	{"coredns", "kube-system", "deploy/coredns", []string{"deploy/coredns"}},
	{"local-path provisioner", "local-path-storage", "deploy/local-path-provisioner", []string{"deploy/local-path-provisioner"}},
	{"dashboard", "stratum-dashboard", "deploy/stratum-dashboard", []string{"deploy/stratum-dashboard"}},
}

Workloads are restarted after the control plane's own watchers. Cilium's service table and endpoint state, and CoreDNS's Service and EndpointSlice view (headless-Service names answer from it), are built from watches that now point past etcd's restored resourceVersions. The local-path provisioner watches PersistentVolumeClaims, so a claim restored from the snapshot stays unprovisioned until it has restarted. It is there only when the cluster's default storage is local-path, and each workload is found by its own namespace and skipped when absent.

What is not here, and why: cilium-envoy has no ClusterRole, takes its config from a mounted ConfigMap and the agent, and opens no API watch; containerd and the cluster controller (`stratum up`) hold no long watch; and user workloads, and third-party controllers and operators, are never restarted by the restore, since that would widen a destructive command to what it does not own (snapshot-restore.md gives the command to restart them by hand).

Functions

func Owned

func Owned(namespace, kind, name string) bool

Owned reports whether kind (a Kubernetes kind: Deployment or DaemonSet) named name in namespace is one of the Targets Stratum rolls itself, so a caller that looks for workloads Stratum does not own can leave these out.

func RestartCommands

func RestartCommands(kubectl string) []string

RestartCommands is one `rollout restart` command per namespace for the workloads the restore rolls, each prefixed with kubectl, for the guidance that tells an operator to restart them by hand or to repeat the restore's restarts. One list, so the guidance cannot drift from what the restore does.

Types

type Result

type Result struct {
	Name      string
	Present   bool // false when the cluster does not run it
	Warn, Err error
}

Result is what Roller.Restart reports for one Workload. Err joins the restarts that failed: those components still hold their old watches. Warn joins the rollouts that did not finish in time. They were restarted and may yet finish, so that is a warning, not a failure: the operator's recovery steps must not wait on it.

type Roller

type Roller struct {
	// Kubectl runs one kubectl call under its own deadline and returns its
	// output (combined with stderr when combined is set). A call that gets no
	// answer in time must be killed and reported, never waited on.
	Kubectl func(ctx context.Context, timeout time.Duration, combined bool, args ...string) ([]byte, error)
	// Hint is the command line an operator runs by hand against the same
	// apiserver, for args.
	Hint func(args string) string
	// CallTimeout bounds one discovery or restart call.
	CallTimeout time.Duration
	// Wait is how long Restart waits for all the rollouts it started, in total.
	Wait time.Duration
}

Roller restarts Workloads through the apiserver its Kubectl talks to.

func (Roller) Restart

func (r Roller) Restart() []Result

Restart rolls every Workload the cluster runs. Each target is always restarted, and every rollout that started is checked.

func (Roller) RestartOf

func (r Roller) RestartOf(ws []Workload) []Result

RestartOf is Restart for ws, so a caller can roll workloads that are not Stratum's own (rotate-ca's --restart-workloads) with the same waiting and reporting.

type Workload

type Workload struct {
	Name      string   // as reported to the operator
	Namespace string   // where its targets live
	Probe     string   // an object whose presence says the cluster runs it
	Targets   []string // what is rolled
}

Workload is a set of in-cluster workloads that hold watches or credentials from before an operation, and are restarted together as one entry in its report.

Jump to

Keyboard shortcuts

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