Documentation
¶
Index ¶
- Constants
- Variables
- func IsCannotReuseRelease(err error) bool
- func IsEmptyChartTemplates(err error) bool
- func IsExecutionFailed(err error) bool
- func IsInvalidConfig(err error) bool
- func IsInvalidGZipHeader(err error) bool
- func IsInvalidManifest(err error) bool
- func IsNotFound(err error) bool
- func IsParsingDestFailedError(err error) bool
- func IsParsingSrcFailedError(err error) bool
- func IsPullChartFailedError(err error) bool
- func IsPullChartNotFound(err error) bool
- func IsPullChartTimeout(err error) bool
- func IsReleaseAlreadyExists(err error) bool
- func IsReleaseNameInvalid(err error) bool
- func IsReleaseNotDeployed(err error) bool
- func IsReleaseNotFound(err error) bool
- func IsTarballNotFound(err error) bool
- func IsTestReleaseFailure(err error) bool
- func IsTestReleaseTimeout(err error) bool
- func IsTooManyResults(err error) bool
- func IsValidationFailedError(err error) bool
- func IsYamlConversionFailed(err error) bool
- func MergeValues(destMap, srcMap map[string][]byte) (map[string]interface{}, error)
- type Chart
- type Client
- func (c *Client) DeleteRelease(ctx context.Context, namespace, releaseName string) error
- func (c *Client) GetReleaseContent(ctx context.Context, namespace, releaseName string) (*ReleaseContent, error)
- func (c *Client) GetReleaseHistory(ctx context.Context, namespace, releaseName string) (*ReleaseHistory, error)
- func (c *Client) InstallReleaseFromTarball(ctx context.Context, chartPath, namespace string, ...) error
- func (c *Client) ListReleaseContents(ctx context.Context, namespace string) ([]*ReleaseContent, error)
- func (c *Client) LoadChart(ctx context.Context, chartPath string) (Chart, error)
- func (c *Client) PullChartTarball(ctx context.Context, tarballURL string) (string, error)
- func (c *Client) Rollback(ctx context.Context, namespace, releaseName string, revision int, ...) error
- func (c *Client) RunReleaseTest(ctx context.Context, namespace, releaseName string) error
- func (c *Client) UpdateReleaseFromTarball(ctx context.Context, chartPath, namespace, releaseName string, ...) error
- type Config
- type InstallOptions
- type Interface
- type RESTClientGetter
- type ReleaseContent
- type ReleaseHistory
- type RollbackOptions
- type UpdateOptions
Constants ¶
const ( PrometheusNamespace = "helmclient" PrometheusSubsystem = "library" )
const ( // StatusUnknown indicates that a release is in an uncertain state. StatusUnknown = "unknown" // StatusDeployed indicates that the release has been pushed to Kubernetes. StatusDeployed = "deployed" // StatusUninstalled indicates that a release has been uninstalled from Kubernetes. StatusUninstalled = "uninstalled" // StatusSuperseded indicates that this release object is outdated and a newer one exists. StatusSuperseded = "superseded" // StatusFailed indicates that the release was not successfully deployed. StatusFailed = "failed" // StatusUninstalling indicates that a uninstall operation is underway. StatusUninstalling = "uninstalling" // StatusPendingInstall indicates that an install operation is underway. StatusPendingInstall = "pending-install" // StatusPendingUpgrade indicates that an upgrade operation is underway. StatusPendingUpgrade = "pending-upgrade" // StatusPendingRollback indicates that an rollback operation is underway. StatusPendingRollback = "pending-rollback" )
Describes the status of a release. This needs to be kept in sync with upstream but it allows us to have constants without importing Helm packages.
See: https://github.com/helm/helm/blob/master/pkg/release/status.go
Variables ¶
var ( // ReleaseTransitionStatuses is used to determine if the Helm Release is // currently being updated. ReleaseTransitionStatuses = map[string]bool{ StatusUninstalled: true, StatusPendingInstall: true, StatusPendingUpgrade: true, StatusPendingRollback: true, } )
Functions ¶
func IsCannotReuseRelease ¶
IsCannotReuseRelease asserts cannotReuseReleaseError.
func IsEmptyChartTemplates ¶
IsEmptyChartTemplates asserts emptyChartTemplatesError.
func IsExecutionFailed ¶
IsExecutionFailed asserts executionFailedError.
func IsInvalidConfig ¶
IsInvalidConfig asserts invalidConfigError.
func IsInvalidGZipHeader ¶
IsInvalidGZipHeader asserts invalidGZipHeaderError.
func IsInvalidManifest ¶ added in v1.0.1
IsInvalidManifest asserts invalidManifestError.
func IsParsingDestFailedError ¶ added in v0.2.3
IsParsingDestFailedError asserts parsingDestFailedError.
func IsParsingSrcFailedError ¶ added in v0.2.3
IsparsingSrcFailedError asserts parsingSrcFailedError.
func IsPullChartFailedError ¶
IsPullChartFailedError asserts pullChartFailedError.
func IsPullChartNotFound ¶
IsPullChartNotFound asserts pullChartNotFoundError.
func IsPullChartTimeout ¶
IsPullChartTimeout asserts pullChartTimeoutError.
func IsReleaseAlreadyExists ¶
IsReleaseAlreadyExists asserts releaseAlreadyExistsError.
func IsReleaseNameInvalid ¶
IsReleaseNameInvalid asserts releaseNameInvalidError.
func IsReleaseNotDeployed ¶
IsReleaseNotDeployed asserts releaseNotDeployedError.
func IsReleaseNotFound ¶
IsReleaseNotFound asserts releaseNotFoundError.
func IsTarballNotFound ¶
IsTarballNotFound asserts tarballNotFoundError.
func IsTestReleaseFailure ¶
IsTestReleaseFailure asserts testReleaseFailureError.
func IsTestReleaseTimeout ¶
IsTestReleaseTimeout asserts testReleaseTimeoutError.
func IsTooManyResults ¶
IsTooManyResults asserts tooManyResultsError.
func IsValidationFailedError ¶ added in v1.0.2
IsValidationFailedError asserts validationFailedError.
func IsYamlConversionFailed ¶
IsYamlConversionFailed asserts yamlConversionFailedError.
func MergeValues ¶
MergeValues merges config values so they can be used when installing or updating Helm releases. It takes in 2 maps with a string key and YAML values passed as a byte array.
A deep merge is performed into a single map[string]interface{} output. If a value is present in both then the source map is preferred.
The YAML values are parsed using yamlToStringMap. This is because the default behaviour of the YAML parser is to unmarshal into map[interface{}]interface{} which causes problems with the merge logic. See https://github.com/go-yaml/yaml/issues/139.
Types ¶
type Chart ¶
type Chart struct { // Version is the version of the Helm Chart. Version string }
Chart returns information about a Helm Chart.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client knows how to talk with Helm.
func (*Client) DeleteRelease ¶
DeleteRelease uninstalls a chart given its release name.
func (*Client) GetReleaseContent ¶
func (c *Client) GetReleaseContent(ctx context.Context, namespace, releaseName string) (*ReleaseContent, error)
GetReleaseContent gets the current status of the Helm Release including any values provided when the chart was installed. The releaseName is the name of the Helm Release that is set when the Helm Chart is installed.
func (*Client) GetReleaseHistory ¶
func (c *Client) GetReleaseHistory(ctx context.Context, namespace, releaseName string) (*ReleaseHistory, error)
GetReleaseHistory gets the current installed version of the Helm Release. The releaseName is the name of the Helm Release that is set when the Helm Chart is installed.
func (*Client) InstallReleaseFromTarball ¶
func (c *Client) InstallReleaseFromTarball(ctx context.Context, chartPath, namespace string, values map[string]interface{}, options InstallOptions) error
InstallReleaseFromTarball installs a chart packaged in the given tarball.
func (*Client) ListReleaseContents ¶
func (c *Client) ListReleaseContents(ctx context.Context, namespace string) ([]*ReleaseContent, error)
ListReleaseContents gets the current status of all Helm Releases.
func (*Client) LoadChart ¶
LoadChart loads a Helm Chart and returns relevant parts of its structure.
func (*Client) PullChartTarball ¶
PullChartTarball downloads a tarball from the provided tarball URL, returning the file path.
func (*Client) Rollback ¶ added in v1.0.6
func (c *Client) Rollback(ctx context.Context, namespace, releaseName string, revision int, options RollbackOptions) error
Rollback executes a rollback to a previous revision of a Helm release.
func (*Client) RunReleaseTest ¶
RunReleaseTest runs the tests for a Helm Release. The releaseName is the name of the Helm Release that is set when the Helm Chart is installed. This is the same action as running the helm test command.
func (*Client) UpdateReleaseFromTarball ¶
func (c *Client) UpdateReleaseFromTarball(ctx context.Context, chartPath, namespace, releaseName string, values map[string]interface{}, options UpdateOptions) error
UpdateReleaseFromTarball updates the given release using the chart packaged in the tarball.
type Config ¶
type Config struct { Fs afero.Fs // HelmClient sets a helm client used for all operations of the initiated // client. If this is nil, a new helm client will be created. Setting the // helm client here manually might only be sufficient for testing or // whenever you know what you do. HelmClient Interface K8sClient k8sclient.Interface Logger micrologger.Logger HTTPClientTimeout time.Duration }
Config represents the configuration used to create a helm client.
type InstallOptions ¶ added in v1.0.0
InstallOptions is the subset of supported options when installing Helm releases.
type Interface ¶
type Interface interface { // DeleteRelease uninstalls a chart given its release name. DeleteRelease(ctx context.Context, namespace, releaseName string) error // GetReleaseContent gets the current status of the Helm Release. The // releaseName is the name of the Helm Release that is set when the Chart // is installed. GetReleaseContent(ctx context.Context, namespace, releaseName string) (*ReleaseContent, error) // GetReleaseHistory gets the current installed version of the Helm Release. // The releaseName is the name of the Helm Release that is set when the Helm // Chart is installed. GetReleaseHistory(ctx context.Context, namespace, releaseName string) (*ReleaseHistory, error) // InstallReleaseFromTarball installs a Helm Chart packaged in the given tarball. InstallReleaseFromTarball(ctx context.Context, chartPath, namespace string, values map[string]interface{}, options InstallOptions) error // ListReleaseContents gets the current status of all Helm Releases. ListReleaseContents(ctx context.Context, namespace string) ([]*ReleaseContent, error) // LoadChart loads a Helm Chart and returns its structure. LoadChart(ctx context.Context, chartPath string) (Chart, error) // PullChartTarball downloads a tarball from the provided tarball URL, // returning the file path. PullChartTarball(ctx context.Context, tarballURL string) (string, error) // Rollback executes a rollback to a previous revision of a Helm release. Rollback(ctx context.Context, namespace, releaseName string, revision int, options RollbackOptions) error // RunReleaseTest runs the tests for a Helm Release. This is the same // action as running the helm test command. RunReleaseTest(ctx context.Context, namespace, releaseName string) error // UpdateReleaseFromTarball updates the given release using the chart packaged // in the tarball. UpdateReleaseFromTarball(ctx context.Context, chartPath, namespace, releaseName string, values map[string]interface{}, options UpdateOptions) error }
Interface describes the methods provided by the Helm client.
type RESTClientGetter ¶ added in v1.0.0
type RESTClientGetter interface { // ToDiscoveryClient returns discovery client ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error) // ToRawKubeConfigLoader return kubeconfig loader as-is ToRawKubeConfigLoader() clientcmd.ClientConfig // ToRESTConfig returns restconfig ToRESTConfig() (*rest.Config, error) // ToRESTMapper returns a restmapper ToRESTMapper() (meta.RESTMapper, error) }
RESTClientGetter is used to configure the action package which is the Helm Go client.
type ReleaseContent ¶
type ReleaseContent struct { // AppVersion is the app version of the Helm Chart that has been deployed. AppVersion string // Description is a human-friendly "log entry" about this Helm release. Description string // LastDeployed is the time the Helm Chart was last deployed. LastDeployed time.Time // Name is the name of the Helm Release. Name string // Revision is the revision number of the Helm Release. Revision int // Status is the Helm status code of the Release. Status string // Values are the values provided when installing the Helm Release. Values map[string]interface{} // Version is the version of the Helm Chart that has been deployed. Version string }
ReleaseContent returns status information about a Helm Release.
type ReleaseHistory ¶
type ReleaseHistory struct { // AppVersion is the app version of the Helm Chart that has been deployed. AppVersion string // Description is a human-friendly "log entry" about this Helm release. Description string // LastDeployed is the time the Helm Chart was last deployed. LastDeployed time.Time // Name is the name of the Helm Release. Name string // Version is the version of the Helm Chart that has been deployed. Version string }
ReleaseHistory returns version information about a Helm Release.
type RollbackOptions ¶ added in v1.0.6
RollbackOptions is the subset of supported options when rollback back Helm releases.