Documentation
¶
Overview ¶
Package rolloutwait is devctl rollout wait: block until a release's charts run on an installation. A chart is deployed by a Flux HelmRelease (from an OCIRepository or a HelmChart) or an App CR on the installation's management cluster; the wait ends when every one of them has deployed the version (or a newer one), is ready, and the Deployments, StatefulSets and DaemonSets of its Helm release are rolled out.
Index ¶
Constants ¶
const ( VerdictRolledOut agentcli.Verdict = "rolled_out" VerdictRolloutFailed agentcli.Verdict = "rollout_failed" )
The verdicts of a rollout wait beyond the shared table.
const ( KindHelmRelease = "HelmRelease" KindApp = "App" )
The kinds of object that deploy a chart on an installation.
const ( // StateRolledOut: the version (or a newer one) is deployed, the object // is ready and its workloads are rolled out. StateRolledOut = "rolled_out" // StateProgressing: not there yet; the message says what is missing. StateProgressing = "progressing" // StateFailed: the version was attempted and failed. StateFailed = "failed" // StateNotFollowing: the object's source pins a version or a range that // excludes the version; it will never get there on its own. StateNotFollowing = "not_following" // StateSuspended: Flux does not reconcile the object. StateSuspended = "suspended" )
The states of one deployment.
const ( IntervalFloor = 5 * time.Second IntervalCeiling = 30 * time.Second )
The poll interval at scale 1: IntervalFloor after the first read, doubling to IntervalCeiling. A handful of list requests against one management cluster each time.
const Command = "rollout wait"
Command is the command's name in its document.
const ContextPrefix = "teleport.giantswarm.io-"
ContextPrefix names the kube context of an installation's management cluster that tsh kube login writes: the prefix and the installation.
const DefaultTimeout = 30 * time.Minute
DefaultTimeout bounds a rollout that gets no --timeout.
Variables ¶
This section is empty.
Functions ¶
func ChartName ¶
ChartName is the chart of a chart artifact reference, registry/charts/<org>/<name>:<tag>.
func ListKinds ¶
func ListKinds() map[schema.GroupVersionResource]string
ListKinds are the list kinds of the resources a rollout wait reads, what a fake dynamic client needs to serve them.
func OpenCluster ¶
func OpenCluster(installation, kubeContext string, wrap func(http.RoundTripper) http.RoundTripper) (dynamic.Interface, error)
OpenCluster opens the kube context from the default kubeconfig loading rules (KUBECONFIG, ~/.kube/config) with the requests going through wrap. A context that does not exist is a usage error naming tsh kube login.
Types ¶
type Config ¶
type Config struct {
// Installation is the installation's name; KubeContext the context it
// is read through.
Installation string
KubeContext string
// Version is the release's version, with or without a leading v.
Version string
// Charts are the names of the release's charts.
Charts []string
// Client reads the management cluster.
Client dynamic.Interface
// Timeout bounds the wait; zero means DefaultTimeout.
Timeout time.Duration
// Reconcile asks Flux to reconcile the sources and HelmReleases that
// are behind once, instead of waiting for their next interval.
Reconcile bool
Clock agentcli.Clock
Progress *agentcli.Progress
Warn func(message string)
}
Config is one rollout wait.
type Deployment ¶
type Deployment struct {
// Kind is HelmRelease or App.
Kind string `json:"kind"`
Namespace string `json:"namespace"`
Name string `json:"name"`
Chart string `json:"chart"`
// Source is where the chart comes from: "OCIRepository <ns>/<name>",
// "HelmChart <ns>/<name>" or "catalog <name>".
Source string `json:"source"`
// Follows is the version selector of the source: "semver <range>",
// "tag <tag>", "digest <digest>" or, for an App, "version <v>".
Follows string `json:"follows"`
// RunningVersion is the deployed chart version without build
// metadata; empty before the first deployment.
RunningVersion string `json:"runningVersion"`
// State is rolled_out, progressing, failed, not_following or suspended.
State string `json:"state"`
// Message says why the deployment is not rolled out; empty when it is.
Message string `json:"message"`
// Workloads are the Deployments, StatefulSets and DaemonSets of the
// Helm release, read once the version is deployed.
Workloads []Workload `json:"workloads"`
// contains filtered or unexported fields
}
Deployment is one HelmRelease or App CR that deploys a chart of the release, and where it stands.
type Document ¶
type Document struct {
agentcli.Envelope
// Release is the release wait's outcome and result.
Release prmerge.Release `json:"release"`
Result
}
Document is the command's JSON: the envelope, the release the rollout waited for first, and the rollout.
type Result ¶
type Result struct {
// Installation is the installation waited on.
Installation string `json:"installation"`
// Context is the kube context the installation was read through.
Context string `json:"context"`
// Version is the bare version waited for.
Version string `json:"version"`
// Charts are the charts of the release, the names deployments are
// matched by.
Charts []string `json:"charts"`
// Deployments are the HelmReleases and App CRs that deploy one of the
// charts, as of the last poll.
Deployments []Deployment `json:"deployments"`
}
Result is what the rollout wait found on the installation.
type Waiter ¶
type Waiter struct {
// contains filtered or unexported fields
}
Waiter runs one rollout wait.
func (*Waiter) Wait ¶
Wait polls the installation until the release runs there, fails, turns out never to get there, or the timeout passes, and fills result with the last poll. The error places the outcome in the exit-code table: nil when every deployment that follows the version has rolled out, exit 1 when one failed, 2 at the timeout, 3 when no deployment of the charts exists or none follows the version.
type Workload ¶
type Workload struct {
Kind string `json:"kind"`
Namespace string `json:"namespace"`
Name string `json:"name"`
Ready bool `json:"ready"`
// Message says what the rollout still waits for; empty when ready.
Message string `json:"message"`
}
Workload is one Deployment, StatefulSet or DaemonSet of a release.