Documentation
¶
Index ¶
- Constants
- func NewChartDependencyManager(name string, logger *zap.SugaredLogger) *chartDependencyManager
- type AffectedReleases
- type ChartLockedRequirements
- type ChartMeta
- type ChartRequirements
- type Dependency
- type DiffOpt
- type DiffOpts
- type EnvironmentSpec
- type EnvironmentTemplateData
- type EnvironmentValuesLoader
- type HelmSpec
- type HelmState
- func (st *HelmState) BuildDeps(helm helmexec.Interface) []error
- func (st *HelmState) Clean() []error
- func (st *HelmState) DeleteReleases(affectedReleases *AffectedReleases, helm helmexec.Interface, concurrency int, ...) []error
- func (st *HelmState) DetectReleasesToBeDeleted(helm helmexec.Interface) ([]*ReleaseSpec, error)
- func (st *HelmState) DiffReleases(helm helmexec.Interface, additionalValues []string, workerLimit int, ...) ([]*ReleaseSpec, []error)
- func (st *HelmState) ExecuteTemplates() (*HelmState, error)
- func (st *HelmState) ExpandedHelmfiles() ([]SubHelmfileSpec, error)
- func (st *HelmState) FilterReleases() error
- func (st *HelmState) GenerateOutputDir(outputDir string, release ReleaseSpec) (string, error)
- func (st *HelmState) LintReleases(helm helmexec.Interface, additionalValues []string, args []string, ...) []error
- func (st *HelmState) PrepareReleases(helm helmexec.Interface, helmfileCommand string) []error
- func (st *HelmState) ReleaseStatuses(helm helmexec.Interface, workerLimit int) []error
- func (st *HelmState) RenderValuesFileToBytes(path string) ([]byte, error)
- func (st *HelmState) ResolveDeps() (*HelmState, error)
- func (st *HelmState) SyncReleases(affectedReleases *AffectedReleases, helm helmexec.Interface, ...) []error
- func (st *HelmState) SyncRepos(helm RepoUpdater) []error
- func (st *HelmState) TemplateReleases(helm helmexec.Interface, outputDir string, additionalValues []string, ...) []error
- func (st *HelmState) TestReleases(helm helmexec.Interface, cleanup bool, timeout int, concurrency int) []error
- func (st *HelmState) ToYaml() (string, error)
- func (st *HelmState) UpdateDeps(helm helmexec.Interface) []error
- func (st *HelmState) Values() (map[string]interface{}, error)
- type LabelFilter
- type LintOpt
- type LintOpts
- type ReleaseError
- type ReleaseFilter
- type ReleaseSpec
- type RepoUpdater
- type RepositorySpec
- type ResolvedChartDependency
- type ResolvedDependencies
- type SetValue
- type StateCreator
- func (c *StateCreator) LoadEnvValues(target *HelmState, env string, ctxEnv *environment.Environment) (*HelmState, error)
- func (c *StateCreator) Parse(content []byte, baseDir, file string) (*HelmState, error)
- func (c *StateCreator) ParseAndLoad(content []byte, baseDir, file string, envName string, evaluateBases bool, ...) (*HelmState, error)
- type StateLoadError
- type Storage
- type SubHelmfileSpec
- type SubhelmfileEnvironmentSpec
- type SyncOpt
- type SyncOpts
- type TemplateOpt
- type TemplateOpts
- type TemplateSpec
- type UndefinedEnvError
- type UnresolvedDependencies
Constants ¶
const DefaultEnv = "default"
const MissingFileHandlerDebug = "Debug"
const MissingFileHandlerError = "Error"
const MissingFileHandlerInfo = "Info"
const MissingFileHandlerWarn = "Warn"
const ReleaseErrorCodeFailure = 1
Variables ¶
This section is empty.
Functions ¶
func NewChartDependencyManager ¶
func NewChartDependencyManager(name string, logger *zap.SugaredLogger) *chartDependencyManager
Types ¶
type AffectedReleases ¶
type AffectedReleases struct {
Upgraded []*ReleaseSpec
Deleted []*ReleaseSpec
Failed []*ReleaseSpec
}
AffectedReleases hold the list of released that where updated, deleted, or in error
func (*AffectedReleases) DisplayAffectedReleases ¶
func (ar *AffectedReleases) DisplayAffectedReleases(logger *zap.SugaredLogger)
DisplayAffectedReleases logs the upgraded, deleted and in error releases
type ChartLockedRequirements ¶
type ChartLockedRequirements struct {
ResolvedDependencies []ResolvedChartDependency `yaml:"dependencies"`
Digest string `yaml:"digest"`
Generated string `yaml:"generated"`
}
type ChartRequirements ¶
type ChartRequirements struct {
UnresolvedDependencies []unresolvedChartDependency `yaml:"dependencies"`
}
type Dependency ¶ added in v0.76.0
type EnvironmentSpec ¶
type EnvironmentSpec struct {
Values []interface{} `yaml:"values,omitempty"`
Secrets []string `yaml:"secrets,omitempty"`
// MissingFileHandler instructs helmfile to fail when unable to find a environment values file listed
// under `environments.NAME.values`.
//
// Possible values are "Error", "Warn", "Info", "Debug". The default is "Error".
//
// Use "Warn", "Info", or "Debug" if you want helmfile to not fail when a values file is missing, while just leaving
// a message about the missing file at the log-level.
MissingFileHandler *string `yaml:"missingFileHandler,omitempty"`
}
type EnvironmentTemplateData ¶
type EnvironmentTemplateData struct {
// Environment is accessible as `.Environment` from any template executed by the renderer
Environment environment.Environment
// Namespace is accessible as `.Namespace` from any non-values template executed by the renderer
Namespace string
// Values is accessible as `.Values` and it contains default state values overrode by environment values and override values.
Values map[string]interface{}
}
EnvironmentTemplateData provides variables accessible while executing golang text/template expressions in helmfile and values YAML files
type EnvironmentValuesLoader ¶
type EnvironmentValuesLoader struct {
// contains filtered or unexported fields
}
func NewEnvironmentValuesLoader ¶
func NewEnvironmentValuesLoader(storage *Storage, readFile func(string) ([]byte, error), logger *zap.SugaredLogger) *EnvironmentValuesLoader
func (*EnvironmentValuesLoader) LoadEnvironmentValues ¶
func (ld *EnvironmentValuesLoader) LoadEnvironmentValues(missingFileHandler *string, valuesEntries []interface{}) (map[string]interface{}, error)
type HelmSpec ¶
type HelmSpec struct {
KubeContext string `yaml:"kubeContext,omitempty"`
TillerNamespace string `yaml:"tillerNamespace,omitempty"`
Tillerless bool `yaml:"tillerless"`
Args []string `yaml:"args,omitempty"`
Verify bool `yaml:"verify"`
// Devel, when set to true, use development versions, too. Equivalent to version '>0.0.0-0'
Devel bool `yaml:"devel"`
// Wait, if set to true, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful
Wait bool `yaml:"wait"`
// Timeout is the time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks, and waits on pod/pvc/svc/deployment readiness) (default 300)
Timeout int `yaml:"timeout"`
// RecreatePods, when set to true, instruct helmfile to perform pods restart for the resource if applicable
RecreatePods bool `yaml:"recreatePods"`
// Force, when set to true, forces resource update through delete/recreate if needed
Force bool `yaml:"force"`
// Atomic, when set to true, restore previous state in case of a failed install/upgrade attempt
Atomic bool `yaml:"atomic"`
TLS bool `yaml:"tls"`
TLSCACert string `yaml:"tlsCACert,omitempty"`
TLSKey string `yaml:"tlsKey,omitempty"`
TLSCert string `yaml:"tlsCert,omitempty"`
}
HelmSpec to defines helmDefault values
type HelmState ¶
type HelmState struct {
FilePath string
// DefaultValues is the default values to be overrode by environment values and command-line overrides
DefaultValues []interface{} `yaml:"values,omitempty"`
Environments map[string]EnvironmentSpec `yaml:"environments,omitempty"`
Bases []string `yaml:"bases,omitempty"`
HelmDefaults HelmSpec `yaml:"helmDefaults,omitempty"`
Helmfiles []SubHelmfileSpec `yaml:"helmfiles,omitempty"`
DeprecatedContext string `yaml:"context,omitempty"`
DeprecatedReleases []ReleaseSpec `yaml:"charts,omitempty"`
Namespace string `yaml:"namespace,omitempty"`
Repositories []RepositorySpec `yaml:"repositories,omitempty"`
Releases []ReleaseSpec `yaml:"releases,omitempty"`
Selectors []string `yaml:"-"`
Templates map[string]TemplateSpec `yaml:"templates"`
Env environment.Environment `yaml:"-"`
// contains filtered or unexported fields
}
HelmState structure for the helmfile
func (*HelmState) DeleteReleases ¶
func (st *HelmState) DeleteReleases(affectedReleases *AffectedReleases, helm helmexec.Interface, concurrency int, purge bool) []error
DeleteReleases wrapper for executing helm delete on the releases This function traverses the DAG of the releases in the reverse order, so that the releases that are NOT depended by any others are deleted first.
func (*HelmState) DetectReleasesToBeDeleted ¶
func (st *HelmState) DetectReleasesToBeDeleted(helm helmexec.Interface) ([]*ReleaseSpec, error)
func (*HelmState) DiffReleases ¶
func (st *HelmState) DiffReleases(helm helmexec.Interface, additionalValues []string, workerLimit int, detailedExitCode, suppressSecrets bool, triggerCleanupEvents bool, opt ...DiffOpt) ([]*ReleaseSpec, []error)
DiffReleases wrapper for executing helm diff on the releases It returns releases that had any changes
func (*HelmState) ExecuteTemplates ¶
func (*HelmState) ExpandedHelmfiles ¶
func (st *HelmState) ExpandedHelmfiles() ([]SubHelmfileSpec, error)
func (*HelmState) FilterReleases ¶
FilterReleases allows for the execution of helm commands against a subset of the releases in the helmfile.
func (*HelmState) GenerateOutputDir ¶ added in v0.80.0
func (st *HelmState) GenerateOutputDir(outputDir string, release ReleaseSpec) (string, error)
func (*HelmState) LintReleases ¶
func (st *HelmState) LintReleases(helm helmexec.Interface, additionalValues []string, args []string, workerLimit int, opt ...LintOpt) []error
LintReleases wrapper for executing helm lint on the releases
func (*HelmState) PrepareReleases ¶
func (*HelmState) ReleaseStatuses ¶
func (*HelmState) RenderValuesFileToBytes ¶
func (*HelmState) ResolveDeps ¶
ResolveDeps returns a copy of this helmfile state with the concrete chart version numbers filled in for remote chart dependencies
func (*HelmState) SyncReleases ¶
func (st *HelmState) SyncReleases(affectedReleases *AffectedReleases, helm helmexec.Interface, additionalValues []string, workerLimit int, opt ...SyncOpt) []error
SyncReleases wrapper for executing helm upgrade on the releases
func (*HelmState) SyncRepos ¶
func (st *HelmState) SyncRepos(helm RepoUpdater) []error
SyncRepos will update the given helm releases
func (*HelmState) TemplateReleases ¶
func (st *HelmState) TemplateReleases(helm helmexec.Interface, outputDir string, additionalValues []string, args []string, workerLimit int, opt ...TemplateOpt) []error
TemplateReleases wrapper for executing helm template on the releases
func (*HelmState) TestReleases ¶
func (st *HelmState) TestReleases(helm helmexec.Interface, cleanup bool, timeout int, concurrency int) []error
TestReleases wrapper for executing helm test on the releases
func (*HelmState) UpdateDeps ¶
UpdateDeps wrapper for updating dependencies on the releases
type LabelFilter ¶
type LabelFilter struct {
// contains filtered or unexported fields
}
LabelFilter matches a release with the given positive lables. Negative labels invert the match for cases such as tier!=backend
func ParseLabels ¶
func ParseLabels(l string) (LabelFilter, error)
ParseLabels takes a label in the form foo=bar,baz!=bat and returns a LabelFilter that will match the labels
func (LabelFilter) Match ¶
func (l LabelFilter) Match(r ReleaseSpec) bool
Match will match a release that has the same labels as the filter
type ReleaseError ¶
type ReleaseError struct {
*ReleaseSpec
Code int
// contains filtered or unexported fields
}
func (*ReleaseError) Error ¶
func (e *ReleaseError) Error() string
type ReleaseFilter ¶
type ReleaseFilter interface {
// Match returns true if the ReleaseSpec matches the Filter
Match(r ReleaseSpec) bool
}
ReleaseFilter is used to determine if a given release should be used during helmfile execution
type ReleaseSpec ¶
type ReleaseSpec struct {
// Chart is the name of the chart being installed to create this release
Chart string `yaml:"chart,omitempty"`
Version string `yaml:"version,omitempty"`
Verify *bool `yaml:"verify,omitempty"`
// Devel, when set to true, use development versions, too. Equivalent to version '>0.0.0-0'
Devel *bool `yaml:"devel,omitempty"`
// Wait, if set to true, will wait until all Pods, PVCs, Services, and minimum number of Pods of a Deployment are in a ready state before marking the release as successful
Wait *bool `yaml:"wait,omitempty"`
// Timeout is the time in seconds to wait for any individual Kubernetes operation (like Jobs for hooks, and waits on pod/pvc/svc/deployment readiness) (default 300)
Timeout *int `yaml:"timeout,omitempty"`
// RecreatePods, when set to true, instruct helmfile to perform pods restart for the resource if applicable
RecreatePods *bool `yaml:"recreatePods,omitempty"`
// Force, when set to true, forces resource update through delete/recreate if needed
Force *bool `yaml:"force,omitempty"`
// Installed, when set to true, `delete --purge` the release
Installed *bool `yaml:"installed,omitempty"`
// Atomic, when set to true, restore previous state in case of a failed install/upgrade attempt
Atomic *bool `yaml:"atomic,omitempty"`
// MissingFileHandler is set to either "Error" or "Warn". "Error" instructs helmfile to fail when unable to find a values or secrets file. When "Warn", it prints the file and continues.
// The default value for MissingFileHandler is "Error".
MissingFileHandler *string `yaml:"missingFileHandler,omitempty"`
// Needs is the [TILLER_NS/][NS/]NAME representations of releases that this release depends on.
Needs []string `yaml:"needs,omitempty"`
// Hooks is a list of extension points paired with operations, that are executed in specific points of the lifecycle of releases defined in helmfile
Hooks []event.Hook `yaml:"hooks,omitempty"`
// Name is the name of this release
Name string `yaml:"name,omitempty"`
Namespace string `yaml:"namespace,omitempty"`
Labels map[string]string `yaml:"labels,omitempty"`
Values []interface{} `yaml:"values,omitempty"`
Secrets []string `yaml:"secrets,omitempty"`
SetValues []SetValue `yaml:"set,omitempty"`
ValuesTemplate []interface{} `yaml:"valuesTemplate,omitempty"`
SetValuesTemplate []SetValue `yaml:"setTemplate,omitempty"`
// The 'env' section is not really necessary any longer, as 'set' would now provide the same functionality
EnvValues []SetValue `yaml:"env,omitempty"`
ValuesPathPrefix string `yaml:"valuesPathPrefix,omitempty"`
TillerNamespace string `yaml:"tillerNamespace,omitempty"`
Tillerless *bool `yaml:"tillerless,omitempty"`
KubeContext string `yaml:"kubeContext,omitempty"`
TLS *bool `yaml:"tls,omitempty"`
TLSCACert string `yaml:"tlsCACert,omitempty"`
TLSKey string `yaml:"tlsKey,omitempty"`
TLSCert string `yaml:"tlsCert,omitempty"`
// These values are used in templating
TillerlessTemplate *string `yaml:"tillerlessTemplate,omitempty"`
VerifyTemplate *string `yaml:"verifyTemplate,omitempty"`
WaitTemplate *string `yaml:"waitTemplate,omitempty"`
InstalledTemplate *string `yaml:"installedTemplate,omitempty"`
// These settings requires helm-x integration to work
Dependencies []Dependency `yaml:"dependencies,omitempty"`
JSONPatches []interface{} `yaml:"jsonPatches,omitempty"`
StrategicMergePatches []interface{} `yaml:"strategicMergePatches,omitempty"`
Adopt []string `yaml:"adopt,omitempty"`
// contains filtered or unexported fields
}
ReleaseSpec defines the structure of a helm release
func (ReleaseSpec) Clone ¶
func (r ReleaseSpec) Clone() (*ReleaseSpec, error)
func (ReleaseSpec) Desired ¶
func (r ReleaseSpec) Desired() bool
func (ReleaseSpec) ExecuteTemplateExpressions ¶
func (r ReleaseSpec) ExecuteTemplateExpressions(renderer *tmpl.FileRenderer) (*ReleaseSpec, error)
type RepoUpdater ¶
type RepositorySpec ¶
type RepositorySpec struct {
Name string `yaml:"name,omitempty"`
URL string `yaml:"url,omitempty"`
CaFile string `yaml:"caFile,omitempty"`
CertFile string `yaml:"certFile,omitempty"`
KeyFile string `yaml:"keyFile,omitempty"`
Username string `yaml:"username,omitempty"`
Password string `yaml:"password,omitempty"`
}
RepositorySpec that defines values for a helm repo
type ResolvedChartDependency ¶
type ResolvedChartDependency struct {
// ChartName identifies the dependant chart. In Helmfile, ChartName for `chart: stable/envoy` would be just `envoy`.
// It can't be collided with other charts referenced in the same helmfile spec.
// That is, collocating `chart: incubator/foo` and `chart: stable/foo` isn't allowed. Name them differently for a work-around.
ChartName string `yaml:"name"`
// Repository contains the URL for the helm chart repository that hosts the chart identified by ChartName
Repository string `yaml:"repository"`
// Version is the version number of the dependent chart.
// In the context of helmfile this can be omitted. When omitted, it is considered `*` which results helm/helmfile fetching the latest version.
Version string `yaml:"version"`
}
type ResolvedDependencies ¶
type ResolvedDependencies struct {
// contains filtered or unexported fields
}
type SetValue ¶
type SetValue struct {
Name string `yaml:"name,omitempty"`
Value string `yaml:"value,omitempty"`
File string `yaml:"file,omitempty"`
Values []string `yaml:"values,omitempty"`
}
SetValue are the key values to set on a helm release
type StateCreator ¶
type StateCreator struct {
Strict bool
LoadFile func(inheritedEnv *environment.Environment, baseDir, file string, evaluateBases bool) (*HelmState, error)
// contains filtered or unexported fields
}
func NewCreator ¶
func (*StateCreator) LoadEnvValues ¶
func (c *StateCreator) LoadEnvValues(target *HelmState, env string, ctxEnv *environment.Environment) (*HelmState, error)
LoadEnvValues loads environment values files relative to the `baseDir`
func (*StateCreator) Parse ¶
func (c *StateCreator) Parse(content []byte, baseDir, file string) (*HelmState, error)
Parse parses YAML into HelmState
func (*StateCreator) ParseAndLoad ¶
func (c *StateCreator) ParseAndLoad(content []byte, baseDir, file string, envName string, evaluateBases bool, envValues *environment.Environment) (*HelmState, error)
Parses YAML into HelmState, while loading environment values files relative to the `baseDir`
type StateLoadError ¶
type StateLoadError struct {
Cause error
// contains filtered or unexported fields
}
func (*StateLoadError) Error ¶
func (e *StateLoadError) Error() string
type Storage ¶
type Storage struct {
FilePath string
// contains filtered or unexported fields
}
func NewStorage ¶
type SubHelmfileSpec ¶
type SubHelmfileSpec struct {
//path or glob pattern for the sub helmfiles
Path string `yaml:"path,omitempty"`
//chosen selectors for the sub helmfiles
Selectors []string `yaml:"selectors,omitempty"`
//do the sub helmfiles inherits from parent selectors
SelectorsInherited bool `yaml:"selectorsInherited,omitempty"`
Environment SubhelmfileEnvironmentSpec
}
SubHelmfileSpec defines the subhelmfile path and options
func (*SubHelmfileSpec) UnmarshalYAML ¶
func (hf *SubHelmfileSpec) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML will unmarshal the helmfile yaml section and fill the SubHelmfileSpec structure this is required to keep allowing string scalar for defining helmfile
type SubhelmfileEnvironmentSpec ¶
type SubhelmfileEnvironmentSpec struct {
OverrideValues []interface{} `yaml:"values,omitempty"`
}
type TemplateOpt ¶ added in v0.84.0
type TemplateOpt interface{ Apply(*TemplateOpts) }
type TemplateOpts ¶ added in v0.84.0
type TemplateOpts struct {
Set []string
}
func (*TemplateOpts) Apply ¶ added in v0.84.0
func (o *TemplateOpts) Apply(opts *TemplateOpts)
type TemplateSpec ¶
type TemplateSpec struct {
ReleaseSpec `yaml:",inline"`
}
TemplateSpec defines the structure of a reusable and composable template for helm releases.
type UndefinedEnvError ¶
type UndefinedEnvError struct {
// contains filtered or unexported fields
}
func (*UndefinedEnvError) Error ¶
func (e *UndefinedEnvError) Error() string
type UnresolvedDependencies ¶
type UnresolvedDependencies struct {
// contains filtered or unexported fields
}
func (*UnresolvedDependencies) Add ¶
func (d *UnresolvedDependencies) Add(chart, url, versionConstraint string) error
func (*UnresolvedDependencies) ToChartRequirements ¶
func (d *UnresolvedDependencies) ToChartRequirements() *ChartRequirements