helmClient

package
v0.0.0-...-b5a8d59 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChartSpec

type ChartSpec struct {
	ReleaseName string `json:"release"`
	ChartName   string `json:"chart"`
	// Namespace where the chart release is deployed.
	// Note that helmclient.Options.Namespace should ideally match the namespace configured here.
	Namespace string `json:"namespace"`
	// ValuesYaml is the values.yaml content.
	// use string instead of map[string]interface{}
	// https://github.com/kubernetes-sigs/kubebuilder/issues/528#issuecomment-466449483
	// and https://github.com/kubernetes-sigs/controller-tools/pull/317
	// +optional
	ValuesYaml string `json:"valuesYaml,omitempty"`
	// Version of the chart release.
	// +optional
	Version string `json:"version,omitempty"`
	// CreateNamespace indicates whether to create the namespace if it does not exist.
	// +optional
	CreateNamespace bool `json:"createNamespace,omitempty"`
	// DisableHooks indicates whether to disable hooks.
	// +optional
	DisableHooks bool `json:"disableHooks,omitempty"`
	// Replace indicates whether to replace the chart release if it already exists.
	// +optional
	Replace bool `json:"replace,omitempty"`
	// Wait indicates whether to wait for the release to be deployed or not.
	// +optional
	Wait bool `json:"wait,omitempty"`
	// DependencyUpdate indicates whether to update the chart release if the dependencies have changed.
	// +optional
	DependencyUpdate bool `json:"dependencyUpdate,omitempty"`
	// Timeout configures the time to wait for any individual Kubernetes operation (like Jobs for hooks).
	// +optional
	Timeout time.Duration `json:"timeout,omitempty"`
	// GenerateName indicates that the release name should be generated.
	// +optional
	GenerateName bool `json:"generateName,omitempty"`
	// NameTemplate is the template used to generate the release name if GenerateName is configured.
	// +optional
	NameTemplate string `json:"NameTemplate,omitempty"`
	// Atomic indicates whether to install resources atomically.
	// 'Wait' will automatically be set to true when using Atomic.
	// +optional
	Atomic bool `json:"atomic,omitempty"`
	// SkipCRDs indicates whether to skip CRDs during installation.
	// +optional
	SkipCRDs bool `json:"skipCRDs,omitempty"`
	// Upgrade indicates whether to perform a CRD upgrade during installation.
	// +optional
	UpgradeCRDs bool `json:"upgradeCRDs,omitempty"`
	// SubNotes indicates whether to print sub-notes.
	// +optional
	SubNotes bool `json:"subNotes,omitempty"`
	// Force indicates whether to force the operation.
	// +optional
	Force bool `json:"force,omitempty"`
	// ResetValues indicates whether to reset the values.yaml file during installation.
	// +optional
	ResetValues bool `json:"resetValues,omitempty"`
	// ReuseValues indicates whether to reuse the values.yaml file during installation.
	// +optional
	ReuseValues bool `json:"reuseValues,omitempty"`
	// Recreate indicates whether to recreate the release if it already exists.
	// +optional
	Recreate bool `json:"recreate,omitempty"`
	// MaxHistory limits the maximum number of revisions saved per release.
	// +optional
	MaxHistory int `json:"maxHistory,omitempty"`
	// CleanupOnFail indicates whether to cleanup the release on failure.
	// +optional
	CleanupOnFail bool `json:"cleanupOnFail,omitempty"`
	// DryRun indicates whether to perform a dry run.
	// +optional
	DryRun bool `json:"dryRun,omitempty"`
	// WaitForJobs indicates whether to wait for completion of release Jobs before marking the release as successful.
	// 'Wait' has to be specified for this to take effect.
	// The timeout may be specified via the 'Timeout' field.
	WaitForJobs bool `json:"waitForJobs,omitempty"`
	// KubeVersion indicates Kubernetes version used for Capabilities.KubeVersion
	KubeVersion    string `json:"kubeVersion,omitempty"`
	RepoURL        string `json:"repoURL,omitempty"`
	RegistryClient *registry.Client
}

ChartSpec defines the values of a helm chart

type Client

type Client interface {
	ListDeployedReleases() ([]*release.Release, error)
	GetRelease(name string) (*release.Release, error)
	ListReleaseHistory(name string, max int) ([]*release.Release, error)
	ListAllReleases() ([]*release.Release, error)
	UninstallReleaseByName(name string) error
	UpgradeRelease(ctx context.Context, chart *chart.Chart, updatedChartSpec *ChartSpec) (*release.Release, error)
	AddOrUpdateChartRepo(entry repo.Entry) error
	InstallChart(ctx context.Context, spec *ChartSpec) (*release.Release, error)
	UpgradeReleaseWithChartInfo(ctx context.Context, spec *ChartSpec) (*release.Release, error)
	IsReleaseInstalled(ctx context.Context, releaseName string, releaseNamespace string) (bool, error)
	RollbackRelease(spec *ChartSpec, version int) error
	TemplateChart(spec *ChartSpec, options *HelmTemplateOptions, chartData []byte) ([]byte, error)
	GetNotes(spec *ChartSpec, options *HelmTemplateOptions) ([]byte, error)
}

Client holds the method signatures for a Helm client.

func NewClientFromRestConf

func NewClientFromRestConf(options *RestConfClientOptions) (Client, error)

NewClientFromRestConf returns a new Helm client constructed with the provided REST config options

type HelmClient

type HelmClient struct {
	Settings  *cli.EnvSettings
	Providers getter.Providers

	ActionConfig *action.Configuration

	DebugLog action.DebugLog
	// contains filtered or unexported fields
}

HelmClient Client defines the values of a helm client

func (*HelmClient) AddOrUpdateChartRepo

func (c *HelmClient) AddOrUpdateChartRepo(entry repo.Entry) error

AddOrUpdateChartRepo adds or updates the provided helm chart repository.

func (*HelmClient) GetNotes

func (c *HelmClient) GetNotes(spec *ChartSpec, options *HelmTemplateOptions) ([]byte, error)

func (*HelmClient) GetRelease

func (c *HelmClient) GetRelease(name string) (*release.Release, error)

GetRelease returns a release specified by name.

func (*HelmClient) InstallChart

func (c *HelmClient) InstallChart(ctx context.Context, spec *ChartSpec) (*release.Release, error)

InstallChart installs the provided chart and returns the corresponding release. Namespace and other context is provided via the helmclient.Options struct when instantiating a client.

func (*HelmClient) IsReleaseInstalled

func (c *HelmClient) IsReleaseInstalled(ctx context.Context, releaseName string, releaseNamespace string) (bool, error)

func (*HelmClient) ListAllReleases

func (c *HelmClient) ListAllReleases() ([]*release.Release, error)

func (*HelmClient) ListDeployedReleases

func (c *HelmClient) ListDeployedReleases() ([]*release.Release, error)

ListDeployedReleases lists all deployed releases. Namespace and other context is provided via the Options struct when instantiating a client.

func (*HelmClient) ListReleaseHistory

func (c *HelmClient) ListReleaseHistory(name string, max int) ([]*release.Release, error)

ListReleaseHistory lists the last 'max' number of entries in the history of the release identified by 'name'.

func (*HelmClient) RollbackRelease

func (c *HelmClient) RollbackRelease(spec *ChartSpec, version int) error

RollbackRelease rollbacks a release to a specific version. Specifying '0' as the value for 'version' will result in a rollback to the previous release version.

func (*HelmClient) TemplateChart

func (c *HelmClient) TemplateChart(spec *ChartSpec, options *HelmTemplateOptions, chartData []byte) ([]byte, error)

func (*HelmClient) UninstallReleaseByName

func (c *HelmClient) UninstallReleaseByName(name string) error

UninstallReleaseByName uninstalls a release identified by the provided 'name'.

func (*HelmClient) UpgradeRelease

func (c *HelmClient) UpgradeRelease(ctx context.Context, chart *chart.Chart, updatedChartSpec *ChartSpec) (*release.Release, error)

UpgradeRelease upgrades the provided chart and returns the corresponding release. Namespace and other context is provided via the helmclient.Options struct when instantiating a client.

func (*HelmClient) UpgradeReleaseWithChartInfo

func (c *HelmClient) UpgradeReleaseWithChartInfo(ctx context.Context, spec *ChartSpec) (*release.Release, error)

UpgradeReleaseWithChartInfo installs the provided chart and returns the corresponding release. Namespace and other context is provided via the helmclient.Options struct when instantiating a client.

type HelmTemplateOptions

type HelmTemplateOptions struct {
	KubeVersion *chartutil.KubeVersion
	// APIVersions defined here will be appended to the default list helm provides
	APIVersions chartutil.VersionSet
}

type Options

type Options struct {
	Namespace        string
	RepositoryConfig string
	RepositoryCache  string
	Debug            bool
	Linting          bool
	DebugLog         action.DebugLog
}

Options defines the options of a client

type RESTClientGetter

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

RESTClientGetter defines the values of a helm REST client

func NewRESTClientGetter

func NewRESTClientGetter(namespace string, kubeConfig []byte, restConfig *rest.Config) *RESTClientGetter

NewRESTClientGetter returns a RESTClientGetter using the provided 'namespace', 'kubeConfig' and 'restConfig'.

source: https://github.com/helm/helm/issues/6910#issuecomment-601277026

func (*RESTClientGetter) ToDiscoveryClient

func (c *RESTClientGetter) ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)

ToDiscoveryClient returns a CachedDiscoveryInterface that can be used as a discovery client.

func (*RESTClientGetter) ToRESTConfig

func (c *RESTClientGetter) ToRESTConfig() (*rest.Config, error)

ToRESTConfig returns a REST config build from a given kubeconfig

func (*RESTClientGetter) ToRESTMapper

func (c *RESTClientGetter) ToRESTMapper() (meta.RESTMapper, error)

func (*RESTClientGetter) ToRawKubeConfigLoader

func (c *RESTClientGetter) ToRawKubeConfigLoader() clientcmd.ClientConfig

type RestConfClientOptions

type RestConfClientOptions struct {
	*Options
	RestConfig *rest.Config
}

RestConfClientOptions defines the options used for constructing a client via REST config

Jump to

Keyboard shortcuts

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