helmclient

package
v2.25.3 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package helmclient contains tools to interact with Helm API for downloading, installing, upgrading, and uninstalling Helm Chart. If you are looking for an example, please look at pkg/applications/installer.go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthSettings

type AuthSettings struct {
	// Username used for basic authentication
	Username string

	// Password used for basic authentication
	Password string

	// RegistryConfigFile is the path to registry config file. It's dockercfg
	// file that follows the same format rules as ~/.docker/config.json
	RegistryConfigFile string
}

AuthSettings holds the different kinds of credentials for Helm repository and registry.

type DeployOpts added in v2.22.0

type DeployOpts struct {
	// contains filtered or unexported fields
}

DeployOpts holds the options for installing or upgrading a Helm chart.

func NewDeployOpts added in v2.22.0

func NewDeployOpts(wait bool, timeout time.Duration, atomic bool, enableDNS bool) (*DeployOpts, error)

NewDeployOpts creates a new DeployOpts. It raises an error if the inputs are not valid.

type HelmClient

type HelmClient struct {
	// contains filtered or unexported fields
}

HelmClient is a client that allows interacting with Helm. If you want to use it in a concurrency context, you must create several clients with different HelmSettings. Otherwise writing repository.xml or download index file may fails as it will be written by several threads.

func NewClient

func NewClient(ctx context.Context, restClientGetter genericclioptions.RESTClientGetter, settings HelmSettings, targetNamespace string, logger *zap.SugaredLogger) (*HelmClient, error)

func (HelmClient) DownloadChart

func (h HelmClient) DownloadChart(url string, chartName string, version string, dest string, auth AuthSettings) (string, error)

DownloadChart from url into dest folder and return the chart location (eg /tmp/foo/apache-1.0.0.tgz) The dest folder must exist.

func (HelmClient) Install

func (h HelmClient) Install(chartLoc string, releaseName string, values map[string]interface{}, deployOpts DeployOpts, auth AuthSettings) (*release.Release, error)

Install the chart located at chartLoc into targetNamespace. If the chart was already installed, an error is returned. charLoc is the path to the chart archive (eg /tmp/foo/apache-1.0.0.tgz) or folder containing the chart (e.g. /tmp/mychart/apache).

func (HelmClient) InstallOrUpgrade

func (h HelmClient) InstallOrUpgrade(chartLoc string, releaseName string, values map[string]interface{}, deployOpts DeployOpts, auth AuthSettings) (*release.Release, error)

InstallOrUpgrade installs the chart located at chartLoc into targetNamespace if it's not already installed. Otherwise it upgrades the chart. charLoc is the path to the chart archive (e.g. /tmp/foo/apache-1.0.0.tgz) or folder containing the chart (e.g. /tmp/mychart/apache).

func (HelmClient) Uninstall

func (h HelmClient) Uninstall(releaseName string) (*release.UninstallReleaseResponse, error)

Uninstall the release in targetNamespace.

func (HelmClient) Upgrade

func (h HelmClient) Upgrade(chartLoc, releaseName string, values map[string]interface{}, deployOpts DeployOpts, auth AuthSettings) (*release.Release, error)

Upgrade the chart located at chartLoc into targetNamespace. If the chart is not already installed, an error is returned. charLoc is the path to the chart archive (e.g. /tmp/foo/apache-1.0.0.tgz) or folder containing the chart (e.g. /tmp/mychart/apache).

type HelmSettings

type HelmSettings struct {
	// RepositoryConfig is the path to the repositories file.
	RepositoryConfig string

	// RepositoryCache is the path to the repository cache directory.
	RepositoryCache string
}

HelmSettings holds the Helm configuration for caching repositories.

func NewSettings

func NewSettings(rootDir string) HelmSettings

NewSettings creates a new HelmSettings which store caching configuration to rootDir.

func (HelmSettings) GetterProviders

func (s HelmSettings) GetterProviders() getter.Providers

GetterProviders build the getter.Providers from the HelmSettings.

Jump to

Keyboard shortcuts

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