backend

package
v1.3.0 Latest Latest
Warning

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

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

Documentation

Overview

Package backend defines how a package component reaches the cluster.

The operator decides what to apply and in which order; a backend only knows how to install, upgrade, inspect, roll back and remove one Helm release. Two backends exist: helm, which runs the Helm SDK in-process, and flux, which delegates to Flux helm-controller through HelmRelease objects.

Index

Constants

This section is empty.

Variables

View Source
var ErrUninstalling = errors.New("still being removed")

ErrUninstalling is returned by Uninstall while the delivery tool is still removing what it deployed; the operator asks again later and removes nothing else meanwhile.

Functions

func AcceptedBySchema

func AcceptedBySchema(platform map[string]any, chartDir string) (map[string]any, error)

AcceptedBySchema leaves out of platform values the top-level keys a chart's values.schema.json does not accept. Platform values go to every component, and a chart whose schema forbids additional properties would refuse them all for one key meant for other charts. The package's own values are not filtered: a wrong key there is a mistake worth seeing.

func ResolveValues

func ResolveValues(ctx context.Context, secrets kubernetes.Interface, c Component) (map[string]any, error)

ResolveValues layers the component's values over the values.yaml of each ValuesFromSecrets Secret, named namespace/name or, like Flux valuesFrom, by name alone in the release namespace. A missing Secret is an error: installing without platform settings would produce a release that looks healthy and is configured wrong. Backends whose installer cannot read Secrets itself pass the result on as plain values.

Types

type Backend

type Backend interface {
	// Name is the backend identifier used in flags and status.
	Name() string
	// Apply installs or upgrades the release so it matches c and returns the
	// state right after the call. The helm backend waits for readiness up to
	// c.Timeout; the flux backend returns at once with Progressing set.
	Apply(ctx context.Context, c Component) (State, error)
	// Status reports the current state of the release.
	Status(ctx context.Context, c Component) (State, error)
	// Rollback returns the release to an earlier backend revision.
	Rollback(ctx context.Context, c Component, toRevision int) (State, error)
	// Uninstall removes the release. Removing a missing release is not an error.
	Uninstall(ctx context.Context, c Component) error
}

Backend applies components. Every method must be idempotent: the operator calls them again after restarts and on every reconcile.

type Chart

type Chart struct {
	// Repository is an http(s):// Helm repository or an oci:// path; the
	// chart is <repository>/<name> in a registry.
	Repository string
	Name       string
	Version    string
	// Digest is the sha256 of the chart archive, when known.
	Digest string
	// PlainHTTP means the chart's registry is reached without TLS.
	PlainHTTP bool
}

Chart is one version of a published Helm chart.

func (*Chart) OCI

func (c *Chart) OCI() bool

OCI reports whether the chart lives in an OCI registry.

type Component

type Component struct {
	// Package and Name identify the component; ReleaseName and Namespace
	// identify the release it becomes.
	Package     string
	Name        string
	ReleaseName string
	Namespace   string

	// Adopt takes over objects the release would create that exist but
	// were installed another way, and a release of the same name.
	Adopt bool
	// ChartDir is a composed chart on local disk (helm backend).
	ChartDir string
	// Chart is a published chart, for backends that hand charts to another
	// installer (flux, argo) instead of reading them from disk.
	Chart *Chart

	// Values are the user overrides, merged over the chart's own values.
	Values map[string]any
	// ValuesFromSecrets names Secrets whose values.yaml is layered under
	// Values: namespace/name, or a bare name in the release namespace. The
	// flux backend supports bare names only, a limit of Flux valuesFrom.
	ValuesFromSecrets []string

	// DependsOn lists other releases, as namespace/name, that must be ready
	// before this one (flux backend orders through it; the operator orders
	// the helm backend itself).
	DependsOn []string

	Labels      map[string]string
	Annotations map[string]string

	UpgradeCRDs      string
	WaitStrategy     string
	HealthCheckExprs []kustomize.CustomHealthCheck
	Timeout          time.Duration
}

Component is one Helm release of a package revision.

func (Component) Key

func (c Component) Key() string

Key is the release identity, namespace/name.

type State

type State struct {
	// Exists is false when the release has never been installed or was removed.
	Exists bool
	// Ready means the release reached a deployed, healthy state.
	Ready bool
	// Failed means the last operation on the release failed; Ready is false.
	Failed bool
	// Progressing means an operation is still running (flux backend).
	Progressing bool
	// Revision is the backend's revision number of the current release,
	// e.g. the Helm release version. Rollback targets these numbers.
	Revision int
	Message  string
}

State is what the backend sees of a release.

Directories

Path Synopsis
Package argo is the backend that installs through Argo CD: one Application per component, pointing at the component's published chart, synced automatically.
Package argo is the backend that installs through Argo CD: one Application per component, pointing at the component's published chart, synced automatically.
Package flux is the backend that installs through Flux: for every component it writes the chart's source (an OCIRepository for charts in a registry, a HelmRepository otherwise) and a HelmRelease, and lets source-controller and helm-controller do the rest.
Package flux is the backend that installs through Flux: for every component it writes the chart's source (an OCIRepository for charts in a registry, a HelmRepository otherwise) and a HelmRelease, and lets source-controller and helm-controller do the rest.
Package helm is the backend that installs charts with the Helm SDK inside the operator.
Package helm is the backend that installs charts with the Helm SDK inside the operator.
Package werf is the backend that installs through Nelm, the deployment engine of werf: the operator prepares charts as for the helm backend and runs nelm for each component.
Package werf is the backend that installs through Nelm, the deployment engine of werf: the operator prepares charts as for the helm backend and runs nelm for each component.

Jump to

Keyboard shortcuts

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