helmclient

package
v2.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	HelmPluginsDirectory = "/app/.helm/helmplugin"
)

Variables

This section is empty.

Functions

func MergeOverrideValues

func MergeOverrideValues(valuesYaml, defaultValues, overrideYaml, overrideValues string, imageKvs []*KV) (string, error)

MergeOverrideValues merge override yaml and override kvs defaultValues overrideYaml used for -f option overrideValues used for --set option

Types

type HelmClient

type HelmClient struct {
	*hc.HelmClient

	Namespace string

	RestConfig *rest.Config
	// contains filtered or unexported fields
}

func NewClient

func NewClient() (*HelmClient, error)

NewClient returns a new Helm client with no construct parameters used to update helm repo data and download index.yaml or helm charts

func NewClientFromNamespace

func NewClientFromNamespace(clusterID, namespace string) (*HelmClient, error)

NewClientFromNamespace returns a new Helm client constructed with the provided clusterID and namespace a kubeClient will be initialized to support necessary k8s operations when install/upgrade helm charts

func NewClientFromRestConf

func NewClientFromRestConf(restConfig *rest.Config, ns string) (*HelmClient, error)

NewClientFromRestConf returns a new Helm client constructed with the provided REST config options only used to list/uninstall helm release because kubeClient is nil

func (*HelmClient) Clone

func (hClient *HelmClient) Clone() (*HelmClient, error)

NOTE: When using this method, pay attention to whether restConfig is present in the original client.

func (*HelmClient) DownloadChart

func (hClient *HelmClient) DownloadChart(repoEntry *repo.Entry, chartRef string, chartVersion string, destDir string, unTar bool) error

DownloadChart works like executing `helm pull repoName/chartName --version=version' since pulling from OCI Registry is still considered as an EXPERIMENTAL feature we DO NOT support pulling charts by pulling OCI Artifacts from OCI Registry NOTE consider using os.execCommand('helm pull') to reduce code complexity of offering compatibility since third-party plugins CANNOT be used as SDK if unTar is true, no need to mkdir for destDir if unTar is no, your need to mkdir for destDir yourself

func (*HelmClient) FetchIndexYaml

func (hClient *HelmClient) FetchIndexYaml(repoEntry *repo.Entry) (*repo.IndexFile, error)

FetchIndexYaml fetch index.yaml from remote chart repo `helm repo add` and `helm repo update` will be executed

func (*HelmClient) GetChartValues

func (hClient *HelmClient) GetChartValues(repoEntry *repo.Entry, projectName, releaseName, chartRepo, chartName, chartVersion string, isProduction bool) (string, error)

func (*HelmClient) InstallOrUpgradeChart

func (hClient *HelmClient) InstallOrUpgradeChart(ctx context.Context, spec *hc.ChartSpec, opts *hc.GenericHelmOptions) (*release.Release, error)

InstallOrUpgradeChart install or upgrade helm chart, use the same rule with helm to determine weather to install or upgrade

func (*HelmClient) PushChart

func (hClient *HelmClient) PushChart(repoEntry *repo.Entry, chartPath string) error

func (*HelmClient) UpdateChartRepo

func (hClient *HelmClient) UpdateChartRepo(repoEntry *repo.Entry) (string, error)

UpdateChartRepo works like executing `helm repo update` environment `HELM_REPO_USERNAME` and `HELM_REPO_PASSWORD` are only required for ali acr repos

type KV

type KV struct {
	Key   string      `json:"key"`
	Value interface{} `json:"value"`
}

Jump to

Keyboard shortcuts

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