helm

package
v0.0.0-...-eef33a9 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2019 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MockHookTemplate = `apiVersion: v1
kind: Job
metadata:
  annotations:
    "helm.sh/hook": pre-install
`

MockHookTemplate is the hook template used for all mock release objects.

View Source
var MockManifest = `apiVersion: v1
kind: Secret
metadata:
  name: fixture
`

MockManifest is the manifest used for all mock release objects.

Functions

func ReleaseMock

func ReleaseMock(opts *MockReleaseOptions) *release.Release

ReleaseMock creates a mock release object based on options set by MockReleaseOptions. This function should typically not be used outside of testing.

Types

type Client

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

Client manages client side of the Helm-Tiller protocol.

func NewClient

func NewClient(opts ...Option) *Client

NewClient creates a new client.

func (*Client) GetTiller

func (c *Client) GetTiller() *tiller.ReleaseServer

func (*Client) InstallRelease

func (c *Client) InstallRelease(chstr, ns string, opts ...InstallOption) (*release.Release, error)

InstallRelease loads a chart from chstr, installs it, and returns the release response.

func (*Client) InstallReleaseFromChart

func (c *Client) InstallReleaseFromChart(chart *chart.Chart, ns string, opts ...InstallOption) (*release.Release, error)

InstallReleaseFromChart installs a new chart and returns the release response.

func (*Client) Option

func (c *Client) Option(opts ...Option) *Client

Option configures the Helm client with the provided options.

func (*Client) ReleaseContent

func (c *Client) ReleaseContent(name string, version int) (*release.Release, error)

ReleaseContent returns the configuration for a given release.

func (*Client) ReleaseHistory

func (c *Client) ReleaseHistory(rlsName string, max int) ([]*release.Release, error)

ReleaseHistory returns a release's revision history.

func (*Client) ReleaseStatus

func (c *Client) ReleaseStatus(rlsName string, version int) (*hapi.GetReleaseStatusResponse, error)

ReleaseStatus returns the given release's status.

func (*Client) RollbackRelease

func (c *Client) RollbackRelease(rlsName string, opts ...RollbackOption) (*release.Release, error)

RollbackRelease rolls back a release to the previous version.

func (*Client) RunReleaseTest

func (c *Client) RunReleaseTest(rlsName string, opts ...ReleaseTestOption) (<-chan *hapi.TestReleaseResponse, <-chan error)

RunReleaseTest executes a pre-defined test on a release.

func (*Client) UninstallRelease

func (c *Client) UninstallRelease(rlsName string, opts ...UninstallOption) (*hapi.UninstallReleaseResponse, error)

UninstallRelease uninstalls a named release and returns the response.

func (*Client) UpdateRelease

func (c *Client) UpdateRelease(rlsName, chstr string, opts ...UpdateOption) (*release.Release, error)

UpdateRelease loads a chart from chstr and updates a release to a new/different chart.

func (*Client) UpdateReleaseFromChart

func (c *Client) UpdateReleaseFromChart(rlsName string, chart *chart.Chart, opts ...UpdateOption) (*release.Release, error)

UpdateReleaseFromChart updates a release to a new/different chart.

type FakeClient

type FakeClient struct {
	Rels          []*release.Release
	TestRunStatus map[string]release.TestRunStatus
	Opts          options
}

FakeClient implements Interface

func (*FakeClient) InstallRelease

func (c *FakeClient) InstallRelease(chStr, ns string, opts ...InstallOption) (*release.Release, error)

InstallRelease creates a new release and returns the release

func (*FakeClient) InstallReleaseFromChart

func (c *FakeClient) InstallReleaseFromChart(chart *chart.Chart, ns string, opts ...InstallOption) (*release.Release, error)

InstallReleaseFromChart adds a new MockRelease to the fake client and returns the release

func (*FakeClient) Option

func (c *FakeClient) Option(opts ...Option) Interface

Option returns the fake release client

func (*FakeClient) ReleaseContent

func (c *FakeClient) ReleaseContent(rlsName string, version int) (*release.Release, error)

ReleaseContent returns the configuration for the matching release name in the fake release client.

func (*FakeClient) ReleaseHistory

func (c *FakeClient) ReleaseHistory(rlsName string, max int) ([]*release.Release, error)

ReleaseHistory returns a release's revision history.

func (*FakeClient) ReleaseStatus

func (c *FakeClient) ReleaseStatus(rlsName string, version int) (*hapi.GetReleaseStatusResponse, error)

ReleaseStatus returns a release status response with info from the matching release name.

func (*FakeClient) RollbackRelease

func (c *FakeClient) RollbackRelease(rlsName string, opts ...RollbackOption) (*release.Release, error)

RollbackRelease returns nil, nil

func (*FakeClient) RunReleaseTest

func (c *FakeClient) RunReleaseTest(rlsName string, opts ...ReleaseTestOption) (<-chan *hapi.TestReleaseResponse, <-chan error)

RunReleaseTest executes a pre-defined tests on a release

func (*FakeClient) UninstallRelease

func (c *FakeClient) UninstallRelease(rlsName string, opts ...UninstallOption) (*hapi.UninstallReleaseResponse, error)

UninstallRelease uninstalls a release from the FakeClient

func (*FakeClient) UpdateRelease

func (c *FakeClient) UpdateRelease(rlsName, chStr string, opts ...UpdateOption) (*release.Release, error)

UpdateRelease returns the updated release, if it exists

func (*FakeClient) UpdateReleaseFromChart

func (c *FakeClient) UpdateReleaseFromChart(rlsName string, chart *chart.Chart, opts ...UpdateOption) (*release.Release, error)

UpdateReleaseFromChart returns the updated release, if it exists

type InstallOption

type InstallOption func(*options)

InstallOption allows specifying various settings configurable by the helm client user for overriding the defaults used when running the `helm install` command.

func InstallDisableHooks

func InstallDisableHooks(disable bool) InstallOption

InstallDisableHooks disables hooks during installation.

func InstallDryRun

func InstallDryRun(dry bool) InstallOption

InstallDryRun will (if true) execute an installation as a dry run.

func InstallReuseName

func InstallReuseName(reuse bool) InstallOption

InstallReuseName will (if true) instruct Helm to re-use an existing name.

func InstallTimeout

func InstallTimeout(timeout int64) InstallOption

InstallTimeout specifies the number of seconds before kubernetes calls timeout

func InstallWait

func InstallWait(wait bool) InstallOption

InstallWait specifies whether or not to wait for all resources to be ready

func ReleaseName

func ReleaseName(name string) InstallOption

ReleaseName specifies the name of the release when installing.

func ValueOverrides

func ValueOverrides(raw map[string]interface{}) InstallOption

ValueOverrides specifies a list of values to include when installing.

type Interface

type Interface interface {
	InstallRelease(chStr, namespace string, opts ...InstallOption) (*release.Release, error)
	InstallReleaseFromChart(chart *chart.Chart, namespace string, opts ...InstallOption) (*release.Release, error)
	UninstallRelease(rlsName string, opts ...UninstallOption) (*hapi.UninstallReleaseResponse, error)
	ReleaseStatus(rlsName string, version int) (*hapi.GetReleaseStatusResponse, error)
	UpdateRelease(rlsName, chStr string, opts ...UpdateOption) (*release.Release, error)
	UpdateReleaseFromChart(rlsName string, chart *chart.Chart, opts ...UpdateOption) (*release.Release, error)
	RollbackRelease(rlsName string, opts ...RollbackOption) (*release.Release, error)
	ReleaseContent(rlsName string, version int) (*release.Release, error)
	ReleaseHistory(rlsName string, max int) ([]*release.Release, error)
	RunReleaseTest(rlsName string, opts ...ReleaseTestOption) (<-chan *hapi.TestReleaseResponse, <-chan error)
}

Interface for helm client for mocking in tests

type MockReleaseOptions

type MockReleaseOptions struct {
	Name      string
	Version   int
	Chart     *chart.Chart
	Status    release.Status
	Namespace string
}

MockReleaseOptions allows for user-configurable options on mock release objects.

type Option

type Option func(*options)

Option allows specifying various settings configurable by the helm client user for overriding the defaults.

func BeforeCall

func BeforeCall(fn func(interface{}) error) Option

BeforeCall returns an option that allows intercepting a helm client rpc before being sent OTA to tiller. The intercepting function should return an error to indicate that the call should not proceed or nil otherwise.

func Discovery

func Discovery(dc discovery.DiscoveryInterface) Option

Discovery sets the discovery interface

func Driver

func Driver(d driver.Driver) Option

Driver set the driver option

func KubeClient

func KubeClient(kc environment.KubeClient) Option

KubeClient sets the cluster environment

type ReleaseTestOption

type ReleaseTestOption func(*options)

ReleaseTestOption allows configuring optional request data for issuing a TestRelease rpc.

func ReleaseTestCleanup

func ReleaseTestCleanup(cleanup bool) ReleaseTestOption

ReleaseTestCleanup is a boolean value representing whether to cleanup test pods

func ReleaseTestTimeout

func ReleaseTestTimeout(timeout int64) ReleaseTestOption

ReleaseTestTimeout specifies the number of seconds before kubernetes calls timeout

type RollbackOption

type RollbackOption func(*options)

RollbackOption allows specififying various settings configurable by the helm client user for overriding the defaults used when running the `helm rollback` command.

func RollbackDisableHooks

func RollbackDisableHooks(disable bool) RollbackOption

RollbackDisableHooks will disable hooks for a rollback operation

func RollbackDryRun

func RollbackDryRun(dry bool) RollbackOption

RollbackDryRun will (if true) execute a rollback as a dry run.

func RollbackForce

func RollbackForce(force bool) RollbackOption

RollbackForce will (if true) force resource update through uninstall/recreate if needed

func RollbackRecreate

func RollbackRecreate(recreate bool) RollbackOption

RollbackRecreate will (if true) recreate pods after rollback.

func RollbackTimeout

func RollbackTimeout(timeout int64) RollbackOption

RollbackTimeout specifies the number of seconds before kubernetes calls timeout

func RollbackVersion

func RollbackVersion(ver int) RollbackOption

RollbackVersion sets the version of the release to deploy.

func RollbackWait

func RollbackWait(wait bool) RollbackOption

RollbackWait specifies whether or not to wait for all resources to be ready

type UninstallOption

type UninstallOption func(*options)

UninstallOption allows setting optional attributes when performing a UninstallRelease tiller rpc.

func UninstallDisableHooks

func UninstallDisableHooks(disable bool) UninstallOption

UninstallDisableHooks will disable hooks for a deletion operation.

func UninstallDryRun

func UninstallDryRun(dry bool) UninstallOption

UninstallDryRun will (if true) execute a deletion as a dry run.

func UninstallPurge

func UninstallPurge(purge bool) UninstallOption

UninstallPurge removes the release from the store and make its name free for later use.

func UninstallTimeout

func UninstallTimeout(timeout int64) UninstallOption

UninstallTimeout specifies the number of seconds before kubernetes calls timeout

type UpdateOption

type UpdateOption func(*options)

UpdateOption allows specifying various settings configurable by the helm client user for overriding the defaults used when running the `helm upgrade` command.

func MaxHistory

func MaxHistory(maxHistory int) UpdateOption

MaxHistory limits the maximum number of revisions saved per release

func ResetValues

func ResetValues(reset bool) UpdateOption

ResetValues will (if true) trigger resetting the values to their original state.

func ReuseValues

func ReuseValues(reuse bool) UpdateOption

ReuseValues will cause Helm to reuse the values from the last release. This is ignored if ResetValues is true.

func UpdateValueOverrides

func UpdateValueOverrides(raw map[string]interface{}) UpdateOption

UpdateValueOverrides specifies a list of values to include when upgrading

func UpgradeDisableHooks

func UpgradeDisableHooks(disable bool) UpdateOption

UpgradeDisableHooks will disable hooks for an upgrade operation.

func UpgradeDryRun

func UpgradeDryRun(dry bool) UpdateOption

UpgradeDryRun will (if true) execute an upgrade as a dry run.

func UpgradeForce

func UpgradeForce(force bool) UpdateOption

UpgradeForce will (if true) force resource update through uninstall/recreate if needed

func UpgradeRecreate

func UpgradeRecreate(recreate bool) UpdateOption

UpgradeRecreate will (if true) recreate pods after upgrade.

func UpgradeTimeout

func UpgradeTimeout(timeout int64) UpdateOption

UpgradeTimeout specifies the number of seconds before kubernetes calls timeout

func UpgradeWait

func UpgradeWait(wait bool) UpdateOption

UpgradeWait specifies whether or not to wait for all resources to be ready

Directories

Path Synopsis
Package environment describes the operating environment for Tiller.
Package environment describes the operating environment for Tiller.

Jump to

Keyboard shortcuts

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