helm

package
v2.10.0-rancher7+incom... Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2019 License: Apache-2.0 Imports: 22 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 NewContext

func NewContext() context.Context

NewContext creates a versioned context.

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) DeleteRelease

func (h *Client) DeleteRelease(rlsName string, opts ...DeleteOption) (*rls.UninstallReleaseResponse, error)

DeleteRelease uninstalls a named release and returns the response.

func (*Client) GetVersion

func (h *Client) GetVersion(opts ...VersionOption) (*rls.GetVersionResponse, error)

GetVersion returns the server version.

func (*Client) InstallRelease

func (h *Client) InstallRelease(chstr, ns string, opts ...InstallOption) (*rls.InstallReleaseResponse, error)

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

func (*Client) InstallReleaseFromChart

func (h *Client) InstallReleaseFromChart(chart *chart.Chart, ns string, opts ...InstallOption) (*rls.InstallReleaseResponse, error)

InstallReleaseFromChart installs a new chart and returns the release response.

func (*Client) ListReleases

func (h *Client) ListReleases(opts ...ReleaseListOption) (*rls.ListReleasesResponse, error)

ListReleases lists the current releases.

func (*Client) Option

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

Option configures the Helm client with the provided options.

func (*Client) PingTiller

func (h *Client) PingTiller() error

PingTiller pings the Tiller pod and ensure's that it is up and running

func (*Client) ReleaseContent

func (h *Client) ReleaseContent(rlsName string, opts ...ContentOption) (*rls.GetReleaseContentResponse, error)

ReleaseContent returns the configuration for a given release.

func (*Client) ReleaseHistory

func (h *Client) ReleaseHistory(rlsName string, opts ...HistoryOption) (*rls.GetHistoryResponse, error)

ReleaseHistory returns a release's revision history.

func (*Client) ReleaseStatus

func (h *Client) ReleaseStatus(rlsName string, opts ...StatusOption) (*rls.GetReleaseStatusResponse, error)

ReleaseStatus returns the given release's status.

func (*Client) RollbackRelease

func (h *Client) RollbackRelease(rlsName string, opts ...RollbackOption) (*rls.RollbackReleaseResponse, error)

RollbackRelease rolls back a release to the previous version.

func (*Client) RunReleaseTest

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

RunReleaseTest executes a pre-defined test on a release.

func (*Client) UpdateRelease

func (h *Client) UpdateRelease(rlsName string, chstr string, opts ...UpdateOption) (*rls.UpdateReleaseResponse, error)

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

func (*Client) UpdateReleaseFromChart

func (h *Client) UpdateReleaseFromChart(rlsName string, chart *chart.Chart, opts ...UpdateOption) (*rls.UpdateReleaseResponse, error)

UpdateReleaseFromChart updates a release to a new/different chart.

type ContentOption

type ContentOption func(*options)

ContentOption allows setting optional attributes when performing a GetReleaseContent tiller rpc.

func ContentReleaseVersion

func ContentReleaseVersion(version int32) ContentOption

ContentReleaseVersion will instruct Tiller to retrieve the content of a particular version of a release.

type DeleteOption

type DeleteOption func(*options)

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

func DeleteDescription

func DeleteDescription(description string) DeleteOption

DeleteDescription specifies the description for the release

func DeleteDisableHooks

func DeleteDisableHooks(disable bool) DeleteOption

DeleteDisableHooks will disable hooks for a deletion operation.

func DeleteDryRun

func DeleteDryRun(dry bool) DeleteOption

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

func DeletePurge

func DeletePurge(purge bool) DeleteOption

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

func DeleteTimeout

func DeleteTimeout(timeout int64) DeleteOption

DeleteTimeout specifies the number of seconds before kubernetes calls timeout

type FakeClient

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

FakeClient implements Interface

func (*FakeClient) DeleteRelease

func (c *FakeClient) DeleteRelease(rlsName string, opts ...DeleteOption) (*rls.UninstallReleaseResponse, error)

DeleteRelease deletes a release from the FakeClient

func (*FakeClient) GetVersion

func (c *FakeClient) GetVersion(opts ...VersionOption) (*rls.GetVersionResponse, error)

GetVersion returns a fake version

func (*FakeClient) InstallRelease

func (c *FakeClient) InstallRelease(chStr, ns string, opts ...InstallOption) (*rls.InstallReleaseResponse, error)

InstallRelease creates a new release and returns a InstallReleaseResponse containing that release

func (*FakeClient) InstallReleaseFromChart

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

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

func (*FakeClient) ListReleases

func (c *FakeClient) ListReleases(opts ...ReleaseListOption) (*rls.ListReleasesResponse, error)

ListReleases lists the current releases

func (*FakeClient) Option

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

Option returns the fake release client

func (*FakeClient) PingTiller

func (c *FakeClient) PingTiller() error

PingTiller pings the Tiller pod and ensure's that it is up and running

func (*FakeClient) ReleaseContent

func (c *FakeClient) ReleaseContent(rlsName string, opts ...ContentOption) (resp *rls.GetReleaseContentResponse, err error)

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

func (*FakeClient) ReleaseHistory

func (c *FakeClient) ReleaseHistory(rlsName string, opts ...HistoryOption) (*rls.GetHistoryResponse, error)

ReleaseHistory returns a release's revision history.

func (*FakeClient) ReleaseStatus

func (c *FakeClient) ReleaseStatus(rlsName string, opts ...StatusOption) (*rls.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) (*rls.RollbackReleaseResponse, error)

RollbackRelease returns nil, nil

func (*FakeClient) RunReleaseTest

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

RunReleaseTest executes a pre-defined tests on a release

func (*FakeClient) UpdateRelease

func (c *FakeClient) UpdateRelease(rlsName string, chStr string, opts ...UpdateOption) (*rls.UpdateReleaseResponse, error)

UpdateRelease returns an UpdateReleaseResponse containing the updated release, if it exists

func (*FakeClient) UpdateReleaseFromChart

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

UpdateReleaseFromChart returns an UpdateReleaseResponse containing the updated release, if it exists

type HistoryOption

type HistoryOption func(*options)

HistoryOption allows configuring optional request data for issuing a GetHistory rpc.

func WithMaxHistory

func WithMaxHistory(max int32) HistoryOption

WithMaxHistory sets the max number of releases to return in a release history query.

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 InstallDescription

func InstallDescription(description string) InstallOption

InstallDescription specifies the description for the release

func InstallDisableCRDHook

func InstallDisableCRDHook(disable bool) InstallOption

InstallDisableCRDHook disables CRD hook during installation.

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 Tiller 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 []byte) InstallOption

ValueOverrides specifies a list of values to include when installing.

type Interface

type Interface interface {
	ListReleases(opts ...ReleaseListOption) (*rls.ListReleasesResponse, error)
	InstallRelease(chStr, namespace string, opts ...InstallOption) (*rls.InstallReleaseResponse, error)
	InstallReleaseFromChart(chart *chart.Chart, namespace string, opts ...InstallOption) (*rls.InstallReleaseResponse, error)
	DeleteRelease(rlsName string, opts ...DeleteOption) (*rls.UninstallReleaseResponse, error)
	ReleaseStatus(rlsName string, opts ...StatusOption) (*rls.GetReleaseStatusResponse, error)
	UpdateRelease(rlsName, chStr string, opts ...UpdateOption) (*rls.UpdateReleaseResponse, error)
	UpdateReleaseFromChart(rlsName string, chart *chart.Chart, opts ...UpdateOption) (*rls.UpdateReleaseResponse, error)
	RollbackRelease(rlsName string, opts ...RollbackOption) (*rls.RollbackReleaseResponse, error)
	ReleaseContent(rlsName string, opts ...ContentOption) (*rls.GetReleaseContentResponse, error)
	ReleaseHistory(rlsName string, opts ...HistoryOption) (*rls.GetHistoryResponse, error)
	GetVersion(opts ...VersionOption) (*rls.GetVersionResponse, error)
	RunReleaseTest(rlsName string, opts ...ReleaseTestOption) (<-chan *rls.TestReleaseResponse, <-chan error)
	PingTiller() error
}

Interface for helm client for mocking in tests

type MockReleaseOptions

type MockReleaseOptions struct {
	Name        string
	Version     int32
	Chart       *chart.Chart
	StatusCode  release.Status_Code
	Namespace   string
	Description 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 used when issuing rpc's to the Tiller release server.

func BeforeCall

func BeforeCall(fn func(context.Context, proto.Message) 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 ConnectTimeout

func ConnectTimeout(timeout int64) Option

ConnectTimeout specifies the duration (in seconds) Helm will wait to establish a connection to tiller

func Host

func Host(host string) Option

Host specifies the host address of the Tiller release server, (default = ":44134").

func WithTLS

func WithTLS(cfg *tls.Config) Option

WithTLS specifies the tls configuration if the helm client is enabled to use TLS.

type ReleaseListOption

type ReleaseListOption func(*options)

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

func ReleaseListFilter

func ReleaseListFilter(filter string) ReleaseListOption

ReleaseListFilter specifies a filter to apply a list of releases.

func ReleaseListLimit

func ReleaseListLimit(limit int) ReleaseListOption

ReleaseListLimit set an upper bound on the number of releases returned.

func ReleaseListNamespace

func ReleaseListNamespace(namespace string) ReleaseListOption

ReleaseListNamespace specifies the namespace to list releases from

func ReleaseListOffset

func ReleaseListOffset(offset string) ReleaseListOption

ReleaseListOffset specifies the offset into a list of releases.

func ReleaseListOrder

func ReleaseListOrder(order int32) ReleaseListOption

ReleaseListOrder specifies how to order a list of releases.

func ReleaseListSort

func ReleaseListSort(sort int32) ReleaseListOption

ReleaseListSort specifies how to sort a release list.

func ReleaseListStatuses

func ReleaseListStatuses(statuses []release.Status_Code) ReleaseListOption

ReleaseListStatuses specifies which status codes should be returned.

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 RollbackDescription

func RollbackDescription(description string) RollbackOption

RollbackDescription specifies the description for the release

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 delete/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 int32) 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 StatusOption

type StatusOption func(*options)

StatusOption allows setting optional attributes when performing a GetReleaseStatus tiller rpc.

func StatusReleaseVersion

func StatusReleaseVersion(version int32) StatusOption

StatusReleaseVersion will instruct Tiller to retrieve the status of a particular version of a release.

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 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 Tiller to reuse the values from the last release. This is ignored if ResetValues is true.

func UpdateValueOverrides

func UpdateValueOverrides(raw []byte) UpdateOption

UpdateValueOverrides specifies a list of values to include when upgrading

func UpgradeDescription

func UpgradeDescription(description string) UpdateOption

UpgradeDescription specifies the description for the update

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 delete/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

type VersionOption

type VersionOption func(*options)

VersionOption -- TODO

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