helm

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 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 (
	EverestChartName            = "everest"
	EverestDBNamespaceChartName = "everest-db-namespace"
)

Everest Helm chart names.

View Source
const DefaultHelmRepoURL = "https://percona.github.io/percona-helm-charts/"

DefaultHelmRepoURL is the default Helm repository URL to download the Everest charts.

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             string
	RepoURL              string
	Values               values.Options
	Devel                bool
	ReuseValues          bool
	ResetValues          bool
	ResetThenReuseValues bool
}

CLIOptions contains common options for the CLI.

func (*CLIOptions) BindViperFlags

func (o *CLIOptions) BindViperFlags()

BindViperFlags parses the CLI flags from Viper and binds them to the CLI options.

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            string
	ReleaseNamespace       string
	Values                 map[string]interface{}
	CreateReleaseNamespace bool
	// contains filtered or unexported fields
}

Installer installs a Helm chart.

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