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 ¶
- type AuthSettings
- type DeployOpts
- type HelmClient
- func (h HelmClient) DownloadChart(url string, chartName string, version string, dest string, auth AuthSettings) (string, error)
- func (h HelmClient) GetMetadata(releaseName string) (*action.Metadata, error)
- func (h HelmClient) Install(chartLoc string, releaseName string, values map[string]interface{}, ...) (*release.Release, error)
- func (h HelmClient) InstallOrUpgrade(chartLoc string, releaseName string, values map[string]interface{}, ...) (*release.Release, error)
- func (h HelmClient) Rollback(releaseName string) error
- func (h HelmClient) Uninstall(releaseName string) (*release.UninstallReleaseResponse, error)
- func (h HelmClient) Upgrade(chartLoc, releaseName string, values map[string]interface{}, ...) (*release.Release, error)
- type HelmSettings
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 // PlainHTTP enforces using plain HTTP, useful for when the protocol // cannot be inferred directly (for example because OCI can be accessed // both via HTTP and HTTPS). PlainHTTP bool // Insecure disables certificate verification. Insecure bool // CAFile is an optional path to a custom CA certificate file, PEM-encoded. CAFile 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) GetMetadata ¶ added in v2.24.9
func (h HelmClient) GetMetadata(releaseName string) (*action.Metadata, error)
GetMetadata wraps helms GetMetadata command to be used with our ActionConfig.
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) Rollback ¶ added in v2.24.9
func (h HelmClient) Rollback(releaseName string) error
Rollback wraps helms Rollback command to be used with our ActionConfig.
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.