helmclient

package
Version: v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2021 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultCachePath            = "/tmp/.helmcache"
	DefaultRepositoryConfigPath = "/tmp/.helmrepo"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChartOption

type ChartOption struct {
	ChartPath string `json:"chart_path"`
}

type ChartSpec

type ChartSpec struct {
	ReleaseName string `json:"release"`
	ChartName   string `json:"chart"`
	Namespace   string `json:"namespace"`

	// 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"`

	// +optional
	Version string `json:"version,omitempty"`

	// +optional
	DisableHooks bool `json:"disableHooks,omitempty"`

	// +optional
	Replace bool `json:"replace,omitempty"`

	// +optional
	Wait bool `json:"wait,omitempty"`

	// +optional
	DependencyUpdate bool `json:"dependencyUpdate,omitempty"`

	// +optional
	Timeout time.Duration `json:"timeout,omitempty"`

	// +optional
	GenerateName bool `json:"generateName,omitempty"`

	// +optional
	NameTemplate string `json:"NameTemplate,omitempty"`

	// +optional
	Atomic bool `json:"atomic,omitempty"`

	// +optional
	SkipCRDs bool `json:"skipCRDs,omitempty"`

	// +optional
	UpgradeCRDs bool `json:"upgradeCRDs,omitempty"`

	// +optional
	SubNotes bool `json:"subNotes,omitempty"`

	// +optional
	Force bool `json:"force,omitempty"`

	// +optional
	ResetValues bool `json:"resetValues,omitempty"`

	// +optional
	ReuseValues bool `json:"reuseValues,omitempty"`

	// +optional
	Recreate bool `json:"recreate,omitempty"`

	// +optional
	MaxHistory int `json:"maxHistory,omitempty"`

	// +optional
	CleanupOnFail bool `json:"cleanupOnFail,omitempty"`

	// +optional
	DryRun bool `json:"dry_run,omitempty"`
}

ChartSpec defines the values of a helm chart

func (*ChartSpec) GetValuesMap

func (spec *ChartSpec) GetValuesMap() (map[string]interface{}, error)

GetValuesMap returns the mapped out values of a chart

type Client

type Client interface {
	AddOrUpdateChartRepo(entry repo.Entry, isUpdate bool, log *zap.SugaredLogger) error
	UpdateChartRepos(log *zap.SugaredLogger) error
	InstallOrUpgradeChart(ctx context.Context, spec *ChartSpec, chartOption *ChartOption, log *zap.SugaredLogger) error
	DeleteChartFromCache(spec *ChartSpec, chartOption *ChartOption) error
	UninstallRelease(spec *ChartSpec) error
	TemplateChart(spec *ChartSpec, chartOption *ChartOption, log *zap.SugaredLogger) ([]byte, error)
	LintChart(spec *ChartSpec, chartOption *ChartOption, log *zap.SugaredLogger) error
}

func NewClientFromKubeConf

func NewClientFromKubeConf(options *KubeConfClientOptions) (Client, error)

NewClientFromKubeConf returns a new Helm client constructed with the provided kubeconfig options

func NewClientFromRestConf

func NewClientFromRestConf(restConfig *rest.Config, namespace string) (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

	DryRun bool
	// contains filtered or unexported fields
}

Client defines the values of a helm client

func (*HelmClient) AddOrUpdateChartRepo

func (c *HelmClient) AddOrUpdateChartRepo(entry repo.Entry, isUpdate bool, log *zap.SugaredLogger) error

AddOrUpdateChartRepo adds or updates the provided helm chart repository

func (*HelmClient) DeleteChartFromCache

func (c *HelmClient) DeleteChartFromCache(spec *ChartSpec, chartOption *ChartOption) error

DeleteChartFromCache deletes the provided chart from the client's cache

func (*HelmClient) InstallOrUpgradeChart

func (c *HelmClient) InstallOrUpgradeChart(ctx context.Context, spec *ChartSpec, chartOption *ChartOption, log *zap.SugaredLogger) error

InstallOrUpgradeChart triggers the installation of the provided chart. If the chart is already installed, trigger an upgrade instead

func (*HelmClient) LintChart

func (c *HelmClient) LintChart(spec *ChartSpec, chartOption *ChartOption, log *zap.SugaredLogger) error

检测chart信息

func (*HelmClient) TemplateChart

func (c *HelmClient) TemplateChart(spec *ChartSpec, chartOption *ChartOption, log *zap.SugaredLogger) ([]byte, error)

chart template

func (*HelmClient) UninstallRelease

func (c *HelmClient) UninstallRelease(spec *ChartSpec) error

UninstallRelease uninstalls the provided release

func (*HelmClient) UpdateChartRepos

func (c *HelmClient) UpdateChartRepos(log *zap.SugaredLogger) error

UpdateChartRepos updates the list of chart repositories stored in the client's cache

type KubeConfClientOptions

type KubeConfClientOptions struct {
	*Options
	KubeContext string
	KubeConfig  []byte
}

KubeConfClientOptions defines the options used for constructing a client via kubeconfig

type Options

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

Options defines the options of a client

type RESTClientGetter

type RESTClientGetter struct {
	DryRun bool
	// 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

func (*RESTClientGetter) ToDiscoveryClient

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

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
t or T : Toggle theme light dark auto
y or Y : Canonical URL