helm

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2023 License: Apache-2.0 Imports: 48 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDockerhubHelmRepository added in v0.1.5

func GetDockerhubHelmRepository(ctx context.Context, repo *corev1alpha1.Repository) ([]string, error)

GetDockerhubHelmRepository retrieves the Dockerhub Helm repository based on the given path and repository.

func GetGithubHelmRepository added in v0.1.5

func GetGithubHelmRepository(ctx context.Context, repo *corev1alpha1.Repository) ([]string, error)

GetGithubHelmRepository retrieves the GitHub packages repository based on the given path and repository.

func GetHarborRepository added in v0.1.5

func GetHarborRepository(ctx context.Context, repo *corev1alpha1.Repository) ([]string, error)

GetHarborRepository retrieves the Harbor packages repository based on the given path and repository.

func GetLastRelease added in v0.1.1

func GetLastRelease(getter genericclioptions.RESTClientGetter, logger logr.Logger, cpl *corev1alpha1.ComponentPlan) (rel *release.Release, err error)

GetLastRelease get last release revision

func GetManifests

func GetManifests(ctx context.Context, getter genericclioptions.RESTClientGetter, cli client.Client, logger logr.Logger, cpl *corev1alpha1.ComponentPlan, repo *corev1alpha1.Repository, chartName string) (data string, err error)

GetManifests get helm templates

func GetOCIRepoCharts added in v0.1.5

func GetOCIRepoCharts(ctx context.Context, getter genericclioptions.RESTClientGetter, cli client.Client, logger logr.Logger, ns, pullURL string, repo *corev1alpha1.Repository, skipTags map[string]bool) (latest *chart.Metadata, all []*hrepo.ChartVersion, err error)

GetOCIRepoCharts retrieves the latest chart metadata and all component versions for a given OCI repository.

func GetOCIRepoList added in v0.1.5

func GetOCIRepoList(ctx context.Context, repo *corev1alpha1.Repository) ([]string, error)

GetOCIRepoList retrieves the OCI packages repository based on the given path and repository. TODO need add auth for private repo

func InstallOrUpgrade added in v0.1.1

func InstallOrUpgrade(ctx context.Context, getter genericclioptions.RESTClientGetter, cli client.Client, logger logr.Logger, cpl *corev1alpha1.ComponentPlan, repo *corev1alpha1.Repository, chartName string) (rel *release.Release, err error)

InstallOrUpgrade installs / ungrade a helm chart to the cluster

func ParseDescription added in v0.1.4

func ParseDescription(desc string) (ns, name, uid string, generation int64, raw string)

func ParseDigestFromPullOut added in v0.1.5

func ParseDigestFromPullOut(out string) string

ParseDigestFromPullOut extracts the sha256 digest from the `helm pull` output string. It takes a string as input parameter which represents the output string. It returns a string which is the extracted sha256 digest.

func ReleaseLog added in v0.1.2

func ReleaseLog(rel *release.Release) []interface{}

ReleaseLog generates a log slice for a Helm release object.

func RepoAdd

func RepoAdd(ctx context.Context, logger logr.Logger, entry repo.Entry, httpRequestTimeout time.Duration) (err error)

RepoAdd adds a chart repository inspire by https://github.com/helm/helm/blob/dbc6d8e20fe1d58d50e6ed30f09a04a77e4c68db/cmd/helm/repo_add.go some difference with `helm repo add` command 1. when the same repo name is added, it will overwrite 2. many options we do not need now are not supported yet.

func RepoRemove

func RepoRemove(ctx context.Context, logger logr.Logger, name string) (err error)

RepoRemove inspire by https://github.com/helm/helm/blob/dbc6d8e20fe1d58d50e6ed30f09a04a77e4c68db/cmd/helm/repo_remove.go#L117 some difference with `helm repo remove` command 1. only support remove one repo 2. many options we do not need now are not supported yet.

func RepoUpdate

func RepoUpdate(ctx context.Context, logger logr.Logger, name string, httpRequestTimeout time.Duration) (err error)

RepoUpdate inspire by https://github.com/helm/helm/blob/dbc6d8e20fe1d58d50e6ed30f09a04a77e4c68db/cmd/helm/repo_update.go#L117 some difference with `helm repo update` command 1. only support update one repo 2. many options we do not need now are not supported yet.

func RollBack added in v0.1.4

func Uninstall added in v0.1.1

func Uninstall(ctx context.Context, getter genericclioptions.RESTClientGetter, logger logr.Logger, cpl *corev1alpha1.ComponentPlan) (err error)

Uninstall installs a helm chart to the cluster

Types

type HelmWrapper added in v0.1.1

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

HelmWrapper is a wrapper for helm command

func NewHelmWrapper added in v0.1.3

func NewHelmWrapper(getter genericclioptions.RESTClientGetter, namespace string, logger logr.Logger) (*HelmWrapper, error)

NewHelmWrapper returns a new helmWrapper instance

func (*HelmWrapper) Pull added in v0.1.4

func (h *HelmWrapper) Pull(ctx context.Context, logger logr.Logger, cli client.Client, repo *corev1alpha1.Repository, pullURL, version string) (out string, chartRequested *chart.Chart, err error)

Pull inspire by https://github.com/helm/helm/blob/main/cmd/helm/pull.go

type ReleaseWorkerPool added in v0.1.4

type ReleaseWorkerPool interface {
	// GetManifests is a synchronization function
	GetManifests(ctx context.Context, plan *v1alpha1.ComponentPlan, repo *v1alpha1.Repository, chartName string) (data string, err error)
	// InstallOrUpgrade is an asynchronous function.
	InstallOrUpgrade(ctx context.Context, plan *v1alpha1.ComponentPlan, repo *v1alpha1.Repository, chartName string) (rel *release.Release, doing bool, err error)
	// Uninstall is an asynchronous function.
	Uninstall(ctx context.Context, plan *v1alpha1.ComponentPlan) (doing bool, err error)
	// GetLastRelease is a synchronization function
	GetLastRelease(plan *v1alpha1.ComponentPlan) (rel *release.Release, err error)
	// RollBack is an asynchronous function
	RollBack(ctx context.Context, plan *v1alpha1.ComponentPlan) (rel *release.Release, doing bool, err error)
}

ReleaseWorkerPool handle all helm action.we can mock it for testing

type WorkerPool added in v0.1.4

type WorkerPool struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewWorkerPool added in v0.1.4

func NewWorkerPool(logger logr.Logger, cli client.Client) *WorkerPool

func (*WorkerPool) GetLastRelease added in v0.1.4

func (r *WorkerPool) GetLastRelease(plan *v1alpha1.ComponentPlan) (rel *release.Release, err error)

func (*WorkerPool) GetManifests added in v0.1.4

func (r *WorkerPool) GetManifests(ctx context.Context, plan *v1alpha1.ComponentPlan, repo *v1alpha1.Repository, chartName string) (data string, err error)

func (*WorkerPool) InstallOrUpgrade added in v0.1.4

func (r *WorkerPool) InstallOrUpgrade(ctx context.Context, plan *v1alpha1.ComponentPlan, repo *v1alpha1.Repository, chartName string) (rel *release.Release, isRunning bool, err error)

func (*WorkerPool) RollBack added in v0.1.4

func (r *WorkerPool) RollBack(ctx context.Context, plan *v1alpha1.ComponentPlan) (rel *release.Release, doing bool, err error)

func (*WorkerPool) Uninstall added in v0.1.4

func (r *WorkerPool) Uninstall(ctx context.Context, plan *v1alpha1.ComponentPlan) (doing bool, err error)

Jump to

Keyboard shortcuts

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