Documentation
¶
Overview ¶
Package action contains the logic for each action that Helm can perform.
This is a library for calling top-level Helm actions like 'install', 'upgrade', or 'list'. Actions approximately match the command line invocations that the Helm client uses.
Index ¶
- Constants
- Variables
- func CheckDependencies(ch ci.Charter, reqs []ci.Dependency) error
- func GetVersionSet(client discovery.ServerResourcesInterface) (common.VersionSet, error)
- type ChartPathOptions
- type Configuration
- func (cfg *Configuration) Init(getter genericclioptions.RESTClientGetter, namespace, helmDriver string) error
- func (cfg *Configuration) KubernetesClientSet() (kubernetes.Interface, error)
- func (cfg *Configuration) Now() time.Time
- func (cfg *Configuration) SetHookOutputFunc(hookOutputFunc func(_, _, _ string) io.Writer)
- type ConfigurationOption
- type Dependency
- type DryRunStrategy
- type History
- type List
- type ListStates
- type Package
- type PostRenderStrategy
- type Pull
- type PullOpt
- type Push
- type PushOpt
- type RESTClientGetter
- type RegistryLogin
- type RegistryLoginOpt
- type RegistryLogout
- type Show
- type ShowOutputFormat
- type Sorter
- type Status
- type Verify
Constants ¶
const ListAll = ListDeployed | ListUninstalled | ListUninstalling | ListPendingInstall | ListPendingRollback | ListPendingUpgrade | ListSuperseded | ListFailed
ListAll is a convenience for enabling all list filters
Variables ¶
var Timestamper = time.Now
Timestamper is a function capable of producing a timestamp.Timestamper.
By default, this is a time.Time function from the Helm time package. This can be overridden for testing though, so that timestamps are predictable.
Functions ¶
func CheckDependencies ¶
func CheckDependencies(ch ci.Charter, reqs []ci.Dependency) error
CheckDependencies checks the dependencies for a chart.
func GetVersionSet ¶
func GetVersionSet(client discovery.ServerResourcesInterface) (common.VersionSet, error)
GetVersionSet retrieves a set of available k8s API versions
Types ¶
type ChartPathOptions ¶
type ChartPathOptions struct {
CaFile string // --ca-file
CertFile string // --cert-file
KeyFile string // --key-file
InsecureSkipTLSVerify bool // --insecure-skip-verify
PlainHTTP bool // --plain-http
Keyring string // --keyring
Password string // --password
PassCredentialsAll bool // --pass-credentials
RepoURL string // --repo
Username string // --username
Verify bool // --verify
Version string // --version
// contains filtered or unexported fields
}
ChartPathOptions captures common options used for controlling chart paths
func (*ChartPathOptions) LocateChart ¶
func (c *ChartPathOptions) LocateChart(name string, settings *cli.EnvSettings) (string, error)
LocateChart looks for a chart directory in known places, and returns either the full path or an error.
This does not ensure that the chart is well-formed; only that the requested filename exists.
Order of resolution: - relative to current working directory when --repo flag is not presented - if path is absolute or begins with '.', error out here - URL
If 'verify' was set on ChartPathOptions, this will attempt to also verify the chart.
type Configuration ¶
type Configuration struct {
// RESTClientGetter is an interface that loads Kubernetes clients.
RESTClientGetter RESTClientGetter
// Releases stores records of releases.
Releases *storage.Storage
// KubeClient is a Kubernetes API client.
KubeClient kube.Interface
// RegistryClient is a client for working with registries
RegistryClient *registry.Client
// Capabilities describes the capabilities of the Kubernetes cluster.
Capabilities *common.Capabilities
// CustomTemplateFuncs is defined by users to provide custom template funcs
CustomTemplateFuncs template.FuncMap
// HookOutputFunc called with container name and returns and expects writer that will receive the log output.
HookOutputFunc func(namespace, pod, container string) io.Writer
// Embed a LogHolder to provide logger functionality
logging.LogHolder
// contains filtered or unexported fields
}
Configuration injects the dependencies that all actions share.
func NewConfiguration ¶
func NewConfiguration(options ...ConfigurationOption) *Configuration
func (*Configuration) Init ¶
func (cfg *Configuration) Init(getter genericclioptions.RESTClientGetter, namespace, helmDriver string) error
Init initializes the action configuration
func (*Configuration) KubernetesClientSet ¶
func (cfg *Configuration) KubernetesClientSet() (kubernetes.Interface, error)
KubernetesClientSet creates a new kubernetes ClientSet based on the configuration
func (*Configuration) Now ¶
func (cfg *Configuration) Now() time.Time
Now generates a timestamp
If the configuration has a Timestamper on it, that will be used. Otherwise, this will use time.Now().
func (*Configuration) SetHookOutputFunc ¶
func (cfg *Configuration) SetHookOutputFunc(hookOutputFunc func(_, _, _ string) io.Writer)
SetHookOutputFunc sets the HookOutputFunc on the Configuration.
type ConfigurationOption ¶
type ConfigurationOption func(c *Configuration)
func ConfigurationSetLogger ¶
func ConfigurationSetLogger(h slog.Handler) ConfigurationOption
Override the default logging handler If unspecified, the default logger will be used
type Dependency ¶
type Dependency struct {
Verify bool
Keyring string
SkipRefresh bool
ColumnWidth uint
Username string
Password string
CertFile string
KeyFile string
CaFile string
InsecureSkipTLSVerify bool
PlainHTTP bool
}
Dependency is the action for building a given chart's dependency tree.
It provides the implementation of 'helm dependency' and its respective subcommands.
func NewDependency ¶
func NewDependency() *Dependency
NewDependency creates a new Dependency object with the given configuration.
type DryRunStrategy ¶
type DryRunStrategy string
const ( // DryRunNone indicates the client will make all mutating calls DryRunNone DryRunStrategy = "none" // DryRunClient, or client-side dry-run, indicates the client will avoid // making calls to the server DryRunClient DryRunStrategy = "client" // DryRunServer, or server-side dry-run, indicates the client will send // calls to the APIServer with the dry-run parameter to prevent persisting changes DryRunServer DryRunStrategy = "server" )
type History ¶
History is the action for checking the release's ledger.
It provides the implementation of 'helm history'. It returns all the revisions for a specific release. To list up to one revision of every release in one specific, or in all, namespaces, see the List action.
func NewHistory ¶
func NewHistory(cfg *Configuration) *History
NewHistory creates a new History object with the given configuration.
type List ¶
type List struct {
// All ignores the limit/offset
All bool
// AllNamespaces searches across namespaces
AllNamespaces bool
// Sort indicates the sort to use
//
// see pkg/releaseutil for several useful sorters
Sort Sorter
// Overrides the default lexicographic sorting
ByDate bool
SortReverse bool
// StateMask accepts a bitmask of states for items to show.
// The default is ListDeployed
StateMask ListStates
// Limit is the number of items to return per Run()
Limit int
// Offset is the starting index for the Run() call
Offset int
// Filter is a filter that is applied to the results
Filter string
Short bool
NoHeaders bool
TimeFormat string
Uninstalled bool
Superseded bool
Uninstalling bool
Deployed bool
Failed bool
Pending bool
Selector string
// contains filtered or unexported fields
}
List is the action for listing releases.
It provides, for example, the implementation of 'helm list'. It returns no more than one revision of every release in one specific, or in all, namespaces. To list all the revisions of a specific release, see the History action.
func (*List) SetStateMask ¶
func (l *List) SetStateMask()
SetStateMask calculates the state mask based on parameters.
type ListStates ¶
type ListStates uint
ListStates represents zero or more status codes that a list item may have set
Because this is used as a bitmask filter, more than one bit can be flipped in the ListStates.
const ( // ListDeployed filters on status "deployed" ListDeployed ListStates = 1 << iota // ListUninstalled filters on status "uninstalled" ListUninstalled // ListUninstalling filters on status "uninstalling" (uninstall in progress) ListUninstalling // ListPendingInstall filters on status "pending" (deployment in progress) ListPendingInstall // ListPendingUpgrade filters on status "pending_upgrade" (upgrade in progress) ListPendingUpgrade // ListPendingRollback filters on status "pending_rollback" (rollback in progress) ListPendingRollback // ListSuperseded filters on status "superseded" (historical release version that is no longer deployed) ListSuperseded // ListFailed filters on status "failed" (release version not deployed because of error) ListFailed // ListUnknown filters on an unknown status ListUnknown )
func (ListStates) FromName ¶
func (s ListStates) FromName(str string) ListStates
FromName takes a state name and returns a ListStates representation.
Currently, there are only names for individual flipped bits, so the returned ListStates will only match one of the constants. However, it is possible that this behavior could change in the future.
type Package ¶
type Package struct {
Sign bool
Key string
Keyring string
PassphraseFile string
Version string
AppVersion string
Destination string
DependencyUpdate bool
RepositoryConfig string
RepositoryCache string
PlainHTTP bool
Username string
Password string
CertFile string
KeyFile string
CaFile string
InsecureSkipTLSVerify bool
TypeScriptOps common.TypeScriptOptions
// contains filtered or unexported fields
}
Package is the action for packaging a chart.
It provides the implementation of 'helm package'.
func NewPackage ¶
func NewPackage() *Package
NewPackage creates a new Package object with the given configuration.
type PostRenderStrategy ¶
type PostRenderStrategy string
PostRenderStrategy determines how hooks and regular templates are passed to the configured post-renderer.
const ( // PostRenderStrategyCombined sends hooks and regular templates together // as a single stream to the post-renderer. This is the default in Helm 4. PostRenderStrategyCombined PostRenderStrategy = "combined" // PostRenderStrategySeparate sends hooks and regular templates to the // post-renderer in independent invocations. This avoids duplicate-resource // errors from post-renderers that de-duplicate by resource identity // (for example Kustomize) when the same resource appears in both a hook // and a regular template. Passing hooks to post-renderers was introduced // in Helm 4; Helm 3 never did so, which is why the issue only surfaces // with the Helm 4 combined default. PostRenderStrategySeparate PostRenderStrategy = "separate" // PostRenderStrategyNoHooks sends only regular templates to the // post-renderer and leaves hooks untouched. This matches the Helm 3 // behavior and is useful for post-renderers that declare transforms // targeting template-only resources (for example Kustomize patches // against a Deployment that exists in templates but not in hooks), // which would otherwise fail against the hook stream. PostRenderStrategyNoHooks PostRenderStrategy = "nohooks" )
type Pull ¶
type Pull struct {
ChartPathOptions
Settings *cli.EnvSettings // TODO: refactor this out of pkg/action
Devel bool
Untar bool
VerifyLater bool
UntarDir string
DestDir string
// contains filtered or unexported fields
}
Pull is the action for checking a given release's information.
It provides the implementation of 'helm pull'.
func (*Pull) SetRegistryClient ¶
SetRegistryClient sets the registry client on the pull configuration object.
type PullOpt ¶
type PullOpt func(*Pull)
func WithConfig ¶
func WithConfig(cfg *Configuration) PullOpt
type Push ¶
type Push struct {
Settings *cli.EnvSettings
// contains filtered or unexported fields
}
Push is the action for uploading a chart.
It provides the implementation of 'helm push'.
func NewPushWithOpts ¶
NewPushWithOpts creates a new push, with configuration options.
type PushOpt ¶
type PushOpt func(*Push)
PushOpt is a type of function that sets options for a push action.
func WithInsecureSkipTLSVerify ¶
WithInsecureSkipTLSVerify determines if a TLS Certificate will be checked
func WithPlainHTTP ¶
WithPlainHTTP configures the use of plain HTTP connections.
func WithPushConfig ¶
func WithPushConfig(cfg *Configuration) PushOpt
WithPushConfig sets the cfg field on the push configuration object.
func WithPushOptWriter ¶
WithPushOptWriter sets the registryOut field on the push configuration object.
func WithTLSClientConfig ¶
WithTLSClientConfig sets the certFile, keyFile, and caFile fields on the push configuration object.
type RESTClientGetter ¶
type RESTClientGetter interface {
ToRESTConfig() (*rest.Config, error)
ToDiscoveryClient() (discovery.CachedDiscoveryInterface, error)
ToRESTMapper() (meta.RESTMapper, error)
}
RESTClientGetter gets the rest client
type RegistryLogin ¶
type RegistryLogin struct {
// contains filtered or unexported fields
}
RegistryLogin performs a registry login operation.
func NewRegistryLogin ¶
func NewRegistryLogin(cfg *Configuration) *RegistryLogin
NewRegistryLogin creates a new RegistryLogin object with the given configuration.
func (*RegistryLogin) Run ¶
func (a *RegistryLogin) Run(_ io.Writer, hostname string, username string, password string, opts ...RegistryLoginOpt) error
Run executes the registry login operation
type RegistryLoginOpt ¶
type RegistryLoginOpt func(*RegistryLogin) error
func WithCAFile ¶
func WithCAFile(caFile string) RegistryLoginOpt
WithCAFile specifies the path to the CA file to use for TLS.
func WithCertFile ¶
func WithCertFile(certFile string) RegistryLoginOpt
WithCertFile specifies the path to the certificate file to use for TLS.
func WithInsecure ¶
func WithInsecure(insecure bool) RegistryLoginOpt
WithInsecure specifies whether to verify certificates.
func WithKeyFile ¶
func WithKeyFile(keyFile string) RegistryLoginOpt
WithKeyFile specifies the path to the key file to use for TLS.
func WithPlainHTTPLogin ¶
func WithPlainHTTPLogin(isPlain bool) RegistryLoginOpt
WithPlainHTTPLogin use http rather than https for login.
type RegistryLogout ¶
type RegistryLogout struct {
// contains filtered or unexported fields
}
RegistryLogout performs a registry login operation.
func NewRegistryLogout ¶
func NewRegistryLogout(cfg *Configuration) *RegistryLogout
NewRegistryLogout creates a new RegistryLogout object with the given configuration.
type Show ¶
type Show struct {
ChartPathOptions
Devel bool
OutputFormat ShowOutputFormat
JSONPathTemplate string
// contains filtered or unexported fields
}
Show is the action for checking a given release's information.
It provides the implementation of 'helm show' and its respective subcommands.
func NewShow ¶
func NewShow(output ShowOutputFormat, cfg *Configuration) *Show
NewShow creates a new Show object with the given configuration.
func (*Show) SetRegistryClient ¶
SetRegistryClient sets the registry client to use when pulling a chart from a registry.
type ShowOutputFormat ¶
type ShowOutputFormat string
ShowOutputFormat is the format of the output of `helm show`
const ( // ShowAll is the format which shows all the information of a chart ShowAll ShowOutputFormat = "all" // ShowChart is the format which only shows the chart's definition ShowChart ShowOutputFormat = "chart" // ShowValues is the format which only shows the chart's values ShowValues ShowOutputFormat = "values" // ShowReadme is the format which only shows the chart's README ShowReadme ShowOutputFormat = "readme" // ShowCRDs is the format which only shows the chart's CRDs ShowCRDs ShowOutputFormat = "crds" )
func (ShowOutputFormat) String ¶
func (o ShowOutputFormat) String() string
type Status ¶
type Status struct {
Version int
// ShowResourcesTable is used with ShowResources. When true this will cause
// the resulting objects to be retrieved as a kind=table.
ShowResourcesTable bool
// contains filtered or unexported fields
}
Status is the action for checking the deployment status of releases.
It provides the implementation of 'helm status'.
func NewStatus ¶
func NewStatus(cfg *Configuration) *Status
NewStatus creates a new Status object with the given configuration.