helm

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2025 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package helm has the logic to install and uninstall Helm charts.

Index

Constants

View Source
const (
	// FlagChartDir is a CLI flag for specifying the chart directory.
	FlagChartDir = "chart-dir"
	// FlagRepository is a CLI flag for specifying the Helm repository.
	FlagRepository = "helm.repository"
	// FlagHelmSet is a CLI flag for setting Helm values.
	FlagHelmSet = "helm.set"
	// FlagHelmValues is a CLI flag for specifying Helm values files.
	FlagHelmValues = "helm.values"
	// FlagHelmReuseValues is a CLI flag for reusing Helm values.
	FlagHelmReuseValues = "helm.reuse-values"
	// FlagHelmResetValues is a CLI flag for resetting Helm values.
	FlagHelmResetValues = "helm.reset-values"
	// FlagHelmResetThenReuseValues is a CLI flag for resetting then reusing Helm values.
	FlagHelmResetThenReuseValues = "helm.reset-then-reuse-values"
)
View Source
const (
	// DefaultHelmRepoURL is the default Helm repository URL to download the Everest charts.
	DefaultHelmRepoURL = "https://percona.github.io/percona-helm-charts/"
	// EverestChartName is the name of the Everest Helm chart that installs the Everest operator.
	EverestChartName = "everest"
	// EverestDBNamespaceChartName is the name of the Everest Helm chart that is installed
	// into DB namespaces managed by Everest.
	EverestDBNamespaceChartName = "everest-db-namespace"
	// EverestCRDChartName is the name of the Everest Helm chart that installs the Everest CRDs.
	EverestCRDChartName = "everest-crds"
)

Everest Helm chart names.

Variables

This section is empty.

Functions

func NewValues

func NewValues(v Values) map[string]string

NewValues creates a map of values that can be used to render the Helm chart.

Types

type CLIOptions

type CLIOptions struct {
	// ChartDir path to the local directory with the Helm chart to be installed.
	ChartDir string
	// RepoURL URL of the Helm repository to download the chart from.
	RepoURL string
	// Values Helm values to be used during installation.
	Values values.Options
	// Devel indicates whether to use development versions of Helm charts, if available.
	Devel bool
	// ReuseValues indicates whether to reuse the last release's values during release upgrade.
	ReuseValues bool
	// ResetValues indicates whether to reset the last release's values during release upgrade.
	ResetValues bool
	// ResetThenReuseValues indicates whether to reset the last release's values then reuse them during release upgrade.
	ResetThenReuseValues bool
}

CLIOptions contains common options for the CLI.

type ChartOptions

type ChartOptions struct {
	// Directory to load the Helm chart from.
	// If set, ignores URL.
	Directory string
	// URL of the repository to pull the chart from.
	URL string
	// Version of the helm chart to install.
	// If loading from a directory, needs to match the chart version.
	Version string
	// Name of the Helm chart to install.
	// Required only if pulling from the specified URL.
	Name string
}

ChartOptions provide the options for loading a Helm chart.

type Installer

type Installer struct {
	// ReleaseName is the name of the Helm release.
	ReleaseName string
	// ReleaseNamespace is the namespace where the Helm release will be installed.
	ReleaseNamespace string
	// Values are the Helm values to be used during installation.
	Values map[string]interface{}
	// CreateReleaseNamespace indicates whether to create the release namespace.
	CreateReleaseNamespace bool
	// contains filtered or unexported fields
}

Installer installs a Helm chart.

func (*Installer) GetParsedValues added in v1.7.0

func (i *Installer) GetParsedValues() *utils.Values

GetParsedValues returns the values parsed into a struct with the known values.

func (*Installer) GetRelease

func (i *Installer) GetRelease() (*release.Release, error)

GetRelease gets the installed Helm release.

func (*Installer) Init

func (i *Installer) Init(kubeconfigPath string, o ChartOptions) error

Init initializes the Installer with the specified options.

func (*Installer) Install

func (i *Installer) Install(ctx context.Context) error

Install the Helm chart. Calling Install multiple times is idempotent; it will re-apply the manifests using upgrade.

func (*Installer) RenderTemplates

func (i *Installer) RenderTemplates(ctx context.Context) (RenderedTemplate, error)

RenderTemplates renders the Helm templates from the provided chart. If the chart has been installed, it returns the rendered templates from the installed release. If the chart has not been installed, it returns the rendered templates from a dry-run install. In the latter case, the installation step does not talk to the kube-apiserver. So Helm functions like `lookup` will not work.

func (*Installer) Upgrade

func (i *Installer) Upgrade(ctx context.Context, opts UpgradeOptions) error

Upgrade the Helm chart.

type RenderedTemplate

type RenderedTemplate []string

RenderedTemplate represents a Helm template that has been rendered using RenderTemplate(). It is a slice of strings, where each string is a YAML document.

func (*RenderedTemplate) GetCRDs

func (t *RenderedTemplate) GetCRDs() ([]string, error)

GetCRDs returns the CRDs in the RenderedTemplate.

func (*RenderedTemplate) GetEverestCatalogNamespace

func (t *RenderedTemplate) GetEverestCatalogNamespace() (string, error)

GetEverestCatalogNamespace gets the name of the namespace where the Everest catalog is installed.

func (*RenderedTemplate) GetUninstallManifests

func (t *RenderedTemplate) GetUninstallManifests() (RenderedTemplate, error)

GetUninstallManifests returns the uninstall manifests in the RenderedTemplate.

func (*RenderedTemplate) Strings

func (t *RenderedTemplate) Strings() []string

Strings returns the RenderedTemplate as a slice of strings.

type Uninstaller

type Uninstaller struct {
	ReleaseName      string
	ReleaseNamespace string
	// contains filtered or unexported fields
}

Uninstaller uninstalls a Helm release.

func NewUninstaller

func NewUninstaller(relName, relNamespace, kubeconfigPath string) (*Uninstaller, error)

NewUninstaller creates a new Uninstaller.

func (*Uninstaller) Uninstall

func (u *Uninstaller) Uninstall(dryRun bool) (bool, error)

Uninstall a Helm release. Returns true if a release was found. If dryRun is set, returns true if a release exists, but doesn't actually uninstall it.

type UpgradeOptions

type UpgradeOptions struct {
	DisableHooks         bool
	ReuseValues          bool
	ResetValues          bool
	ResetThenReuseValues bool
	Force                bool
}

UpgradeOptions provide options for upgrading a Helm chart.

type Values

type Values struct {
	ClusterType        kubernetes.ClusterType
	VersionMetadataURL string
}

Values contains the different values that can be set in the Helm chart.

Directories

Path Synopsis
Package utils provides utility functions for the Helm.
Package utils provides utility functions for the Helm.

Jump to

Keyboard shortcuts

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