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
- func AffectedApps(paths []string, installation string) (apps map[string]bool, global []string)
- func ChartName(reference string) string
- func ListKinds() map[schema.GroupVersionResource]string
- func OpenCluster(installation, kubeContext string, ...) (dynamic.Interface, error)
- type Config
- type Deployment
- type Document
- type GitHub
- type NotFetchedError
- type Result
- type Waiter
- type Workload
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 ( KindGitRepository = "GitRepository" KindKustomization = "Kustomization" KindKonfiguration = "Konfiguration" )
The kinds of object a revision rolls out through.
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 AffectedApps ¶ added in v8.111.0
AffectedApps reads the apps a configuration change touches on an installation from the paths of giantswarm-configs and shared-configs: installations/<installation>/apps/<app>/ and default/apps/<app>/ change <app>; the rest of installations/<installation>/, default/, include/ and stages/ changes values beyond one app's (global); another installation's files and the repository's own (README, workflows) change nothing here.
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; empty with Revision.
Charts []string
// Revision is, for a pull request that releases nothing (a
// configuration change), its merge commit in Repository (owner/repo):
// the wait follows it through the Flux GitRepositories of the
// repository to what applies them, and the HelmReleases of the apps
// Paths, the files the pull request changed, touch. GitHub answers
// whether a fetched commit contains it. Version is empty then.
Revision string
Repository string
Paths []string
GitHub GitHub
// HelmReleases name HelmReleases to wait for whatever chart they
// deploy, as <name> (any namespace) or <namespace>/<name>.
HelmReleases []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; for a revision also GitRepository,
// Kustomization or Konfiguration.
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 GitHub ¶ added in v8.111.0
type GitHub interface {
// Reachable says whether ref is in the history of branch, a branch or
// a commit.
Reachable(ctx context.Context, owner, repo, ref, branch string) (bool, error)
}
GitHub answers whether a commit contains another; *githubclient.Client is one.
type NotFetchedError ¶ added in v8.111.0
type NotFetchedError struct{ Reason string }
NotFetchedError says that nothing on the installation fetches the repository: a pull request of it that releases nothing does not roll out there.
func (*NotFetchedError) Error ¶ added in v8.111.0
func (e *NotFetchedError) Error() string
func (*NotFetchedError) ExitCode ¶ added in v8.111.0
func (e *NotFetchedError) ExitCode() int
ExitCode places it in the exit-code table: not applicable.
func (*NotFetchedError) ExitVerdict ¶ added in v8.111.0
func (e *NotFetchedError) ExitVerdict() agentcli.Verdict
ExitVerdict is no_release: neither a release nor a configuration source follows the pull request.
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; empty for a revision.
Version string `json:"version"`
// Revision is the merge commit of a configuration change waited for;
// empty for a version.
Revision string `json:"revision,omitempty"`
// 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.