helm

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNamespace = errorx.NewNamespace("helm")

	ErrNotFound               = ErrNamespace.NewType("not_found", errorx.NotFound()) // Release or resource not found
	ErrRepoInvalid            = ErrNamespace.NewType("repo_invalid")                 // Repo invalid or unreachable
	ErrChartDependencyMissing = ErrNamespace.NewType("chart_dependency_missing")     // Chart dependencies missing
	ErrChartLoadFailed        = ErrNamespace.NewType("chart_load_failed")            // Failed to load chart from path or repo
	ErrInstallFailed          = ErrNamespace.NewType("install_failed")               // Helm install failed
	ErrUpgradeFailed          = ErrNamespace.NewType("upgrade_failed")               // Helm upgrade failed
	ErrUninstallFailed        = ErrNamespace.NewType("uninstall_failed")             // Helm uninstall failed
	ErrWaitTimeout            = ErrNamespace.NewType("wait_timeout", errorx.Timeout())
)
View Source
var ErrChecksumMismatch = ErrNamespace.NewType("checksum_mismatch")

ErrChecksumMismatch is returned when a pulled chart's digest does not match the value recorded in the infrastructure catalog.

Functions

This section is empty.

Types

type DeployChartOptions

type DeployChartOptions struct {
	ValueOpts       *values.Options
	Atomic          bool
	Wait            bool
	Timeout         time.Duration
	CreateNamespace bool
	ReuseValues     bool
	Labels          map[string]string
}

DeployChartOptions for idempotent install/upgrade

type InstallChartOptions

type InstallChartOptions struct {
	ValueOpts       *values.Options
	Atomic          bool
	Wait            bool
	Timeout         time.Duration
	CreateNamespace bool
	Labels          map[string]string
}

InstallChartOptions for installing Helm charts

type Manager

type Manager interface {
	// AddRepo adds a Helm chart repository with the given options and updates it.
	AddRepo(name, url string, o RepoAddOptions) (*repo.ChartRepository, error)

	// PullAndVerify pulls a Helm chart into destDir and verifies its integrity
	// against the expected checksum recorded in the infrastructure catalog.
	// destDir is created on demand. For classic charts (chartRef without an
	// "oci://" scheme) the local .tgz is SHA256-hashed; for OCI charts the
	// manifest digest reported by the registry client is compared. The returned
	// path points at the local .tgz so callers can hand it to InstallChart /
	// UpgradeChart / DeployChart without a second pull. algorithm currently
	// must be "sha256"; any other value is a configuration error.
	//
	// ctx is accepted for API symmetry but is not propagated into the pull:
	// the Helm SDK version we vendor exposes no context-aware Pull entrypoint
	// (neither action.Pull.Run nor registry.Client.Pull take a context). An
	// in-flight pull therefore runs to completion regardless of cancellation;
	// a slow pull will block the step until the underlying HTTP transport's
	// own deadlines fire.
	PullAndVerify(ctx context.Context, destDir, chartRef, version, algorithm, expectedChecksum string) (string, error)

	// InstallChart installs a Helm chart with the given options
	InstallChart(ctx context.Context, releaseName, chartRef, chartVersion, namespace string, o InstallChartOptions) (*release.Release, error)

	// UninstallChart uninstalls a Helm release by name in the specified namespace
	UninstallChart(releaseName, namespace string) error

	// UpgradeChart upgrades a Helm chart with the given options
	UpgradeChart(ctx context.Context, releaseName, chartRef, chartVersion, namespace string, o UpgradeChartOptions) (*release.Release, error)

	// DeployChart installs or upgrades a Helm chart with the given options
	// This is equivalent to "helm upgrade --install"
	DeployChart(ctx context.Context, releaseName, chartRef, chartVersion, namespace string, o DeployChartOptions) (*release.Release, error)

	// List lists Helm releases in the specified namespace
	// It only lists releases in deployed state
	List(namespace string, allNamespaces bool) ([]*release.Release, error)

	// ListAll lists Helm releases in all namespaces
	// It only lists releases in deployed state
	ListAll() ([]*release.Release, error)

	// GetRelease retrieves a Helm release by name in the specified namespace
	GetRelease(releaseName, namespace string) (*release.Release, error)

	// IsInstalled checks if a Helm release is installed in the specified namespace
	// It considers only releases in deployed state as "installed"
	IsInstalled(releaseName, namespace string) (bool, error)

	// WaitFor waits until the Helm release reaches the desired status or the timeout is reached
	WaitFor(rel *release.Release, status Status, timeout time.Duration) error
}

Manager defines the interface for managing Helm charts and releases

func NewManager

func NewManager(opts ...Option) (Manager, error)

NewManager creates a new Helm manager

type Option

type Option func(*helmManager)

func WithLogger

func WithLogger(log zerolog.Logger) Option

type RepoAddOptions

type RepoAddOptions struct {
	RepoFile  string
	RepoCache string
}

RepoAddOptions holds options for adding a Helm repo

type Status

type Status string
const (
	DefaultTimeout        = 5 * time.Minute
	StatusReady    Status = "ready"
	StatusDeleted  Status = "deleted"
)

type UpgradeChartOptions

type UpgradeChartOptions struct {
	ValueOpts   *values.Options
	Atomic      bool
	Wait        bool
	Timeout     time.Duration
	ReuseValues bool
	Labels      map[string]string
}

UpgradeChartOptions for upgrading Helm charts

Jump to

Keyboard shortcuts

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