state

package
v0.144.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: MIT Imports: 37 Imported by: 11

Documentation

Overview

Copyright 2015 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

See k8s.io/apimachinery/pkg/util/rand/rand.go

Index

Constants

View Source
const DefaultEnv = "default"
View Source
const (
	DefaultHelmBinary = "helm"
)
View Source
const (
	// EmptyTimeout represents the `--timeout` value passed to helm commands not being specified via helmfile flags.
	// This is used by an interim solution to make the urfave/cli command report to the helmfile internal about that the
	// --timeout flag is missingl
	EmptyTimeout = -1
)
View Source
const MissingFileHandlerDebug = "Debug"
View Source
const MissingFileHandlerError = "Error"
View Source
const MissingFileHandlerInfo = "Info"
View Source
const MissingFileHandlerWarn = "Warn"
View Source
const ReleaseErrorCodeFailure = 1

Variables

This section is empty.

Functions

func ConditionEnabled added in v0.143.0

func ConditionEnabled(r ReleaseSpec, values map[string]interface{}) (bool, error)

func GroupReleasesByDependency added in v0.90.3

func GroupReleasesByDependency(releases []Release, opts PlanOptions) ([][]Release, error)

func HashObject added in v0.136.0

func HashObject(obj interface{}) (string, error)

func Logs added in v0.134.0

func Logs(v bool) func(*TestOpts)

func NewChartDependencyManager

func NewChartDependencyManager(name string, logger *zap.SugaredLogger) *chartDependencyManager

func ReleaseToID added in v0.90.3

func ReleaseToID(r *ReleaseSpec) string

func SafeEncodeString added in v0.136.0

func SafeEncodeString(s string) string

SafeEncodeString encodes s using the same characters as rand.String. This reduces the chances of bad words and ensures that strings generated from hash functions appear consistent throughout the API.

func SortedReleaseGroups added in v0.90.3

func SortedReleaseGroups(releases []Release, opts PlanOptions) ([][]Release, error)

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 {
	Version              string                    `yaml:"version"`
	ResolvedDependencies []ResolvedChartDependency `yaml:"dependencies"`
	Digest               string                    `yaml:"digest"`
	Generated            string                    `yaml:"generated"`
}

type ChartMeta

type ChartMeta struct {
	Name string `yaml:"name"`
}

type ChartPrepareOptions added in v0.125.8

type ChartPrepareOptions struct {
	ForceDownload bool
	SkipRepos     bool
	SkipDeps      bool
	SkipResolve   bool
	SkipCleanup   bool
	// Validate is a helm-3-only option. When it is set to true, it configures chartify to pass --validate to helm-template run by it.
	// It's required when one of your chart relies on Capabilities.APIVersions in a template
	Validate               bool
	IncludeCRDs            *bool
	Wait                   bool
	WaitForJobs            bool
	OutputDir              string
	IncludeTransitiveNeeds bool
}

type ChartRequirements

type ChartRequirements struct {
	UnresolvedDependencies []unresolvedChartDependency `yaml:"dependencies"`
}

type Chartify added in v0.125.0

type Chartify struct {
	Opts  *chartify.ChartifyOpts
	Clean func()
}

type Dependency added in v0.76.0

type Dependency struct {
	Chart   string `yaml:"chart"`
	Version string `yaml:"version"`
	Alias   string `yaml:"alias"`
}

type DiffOpt added in v0.84.0

type DiffOpt interface{ Apply(*DiffOpts) }

type DiffOpts added in v0.84.0

type DiffOpts struct {
	Context           int
	Output            string
	NoColor           bool
	Set               []string
	SkipCleanup       bool
	SkipDiffOnInstall bool
}

func (*DiffOpts) Apply added in v0.84.0

func (o *DiffOpts) Apply(opts *DiffOpts)

type EnvironmentSpec

type EnvironmentSpec struct {
	Values      []interface{} `yaml:"values,omitempty"`
	Secrets     []string      `yaml:"secrets,omitempty"`
	KubeContext string        `yaml:"kubeContext,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{}
	StateValues *map[string]interface{}
}

EnvironmentTemplateData provides variables accessible while executing golang text/template expressions in helmfile and values YAML files

func NewEnvironmentTemplateData added in v0.144.0

func NewEnvironmentTemplateData(environment environment.Environment, namespace string, values map[string]interface{}) *EnvironmentTemplateData

type EnvironmentValuesLoader

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

func NewEnvironmentValuesLoader

func NewEnvironmentValuesLoader(storage *Storage, readFile func(string) ([]byte, error), logger *zap.SugaredLogger, remote *remote.Remote) *EnvironmentValuesLoader

func (*EnvironmentValuesLoader) LoadEnvironmentValues

func (ld *EnvironmentValuesLoader) LoadEnvironmentValues(missingFileHandler *string, valuesEntries []interface{}, ctxEnv *environment.Environment) (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"`
	// WaitForJobs, if set and --wait enabled, will wait until all Jobs have been completed before marking the release as successful. It will wait for as long as --timeout
	WaitForJobs bool `yaml:"waitForJobs"`
	// 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"`
	// CleanupOnFail, when set to true, the --cleanup-on-fail helm flag is passed to the upgrade command
	CleanupOnFail bool `yaml:"cleanupOnFail,omitempty"`
	// HistoryMax, limit the maximum number of revisions saved per release. Use 0 for no limit (default 10)
	HistoryMax *int `yaml:"historyMax,omitempty"`
	// CreateNamespace, when set to true (default), --create-namespace is passed to helm3 on install/upgrade (ignored for helm2)
	CreateNamespace *bool `yaml:"createNamespace,omitempty"`
	// SkipDeps disables running `helm dependency up` and `helm dependency build` on this release's chart.
	// This is relevant only when your release uses a local chart or a directory containing K8s manifests or a Kustomization
	// as a Helm chart.
	SkipDeps bool `yaml:"skipDeps"`

	TLS                      bool   `yaml:"tls"`
	TLSCACert                string `yaml:"tlsCACert,omitempty"`
	TLSKey                   string `yaml:"tlsKey,omitempty"`
	TLSCert                  string `yaml:"tlsCert,omitempty"`
	DisableValidation        *bool  `yaml:"disableValidation,omitempty"`
	DisableOpenAPIValidation *bool  `yaml:"disableOpenAPIValidation,omitempty"`
}

HelmSpec to defines helmDefault values

type HelmState

type HelmState struct {
	FilePath string

	ReleaseSetSpec `yaml:",inline"`

	// RenderedValues is the helmfile-wide values that is `.Values`
	// which is accessible from within the whole helmfile go template.
	// Note that this is usually computed by DesiredStateLoader from ReleaseSetSpec.Env
	RenderedValues map[string]interface{}
	// contains filtered or unexported fields
}

HelmState structure for the helmfile

func (*HelmState) ApplyOverrides added in v0.90.3

func (st *HelmState) ApplyOverrides(spec *ReleaseSpec)

func (*HelmState) Clean

func (st *HelmState) Clean() []error

Clean will remove any generated secrets

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

func (*HelmState) DeleteReleasesForSync added in v0.90.3

func (st *HelmState) DeleteReleasesForSync(affectedReleases *AffectedReleases, helm helmexec.Interface, workerLimit int) []error

DeleteReleasesForSync deletes releases that are marked for deletion

func (*HelmState) DetectReleasesToBeDeleted

func (st *HelmState) DetectReleasesToBeDeleted(helm helmexec.Interface, releases []ReleaseSpec) ([]ReleaseSpec, error)

func (*HelmState) DetectReleasesToBeDeletedForSync added in v0.90.8

func (st *HelmState) DetectReleasesToBeDeletedForSync(helm helmexec.Interface, releases []ReleaseSpec) ([]ReleaseSpec, error)

func (*HelmState) DiffReleases

func (st *HelmState) DiffReleases(helm helmexec.Interface, additionalValues []string, workerLimit int, detailedExitCode bool, includeTests bool, suppress []string, suppressSecrets, showSecrets, suppressDiff, triggerCleanupEvents bool, opt ...DiffOpt) ([]ReleaseSpec, []error)

DiffReleases wrapper for executing helm diff on the releases It returns releases that had any changes, and errors if any.

This function has responsibility to stabilize the order of writes to stdout from multiple concurrent helm-diff runs. It's required to use the stdout from helmfile-diff to detect if there was another change(s) between 2 points in time. For example, terraform-provider-helmfile runs a helmfile-diff on `terraform plan` and another on `terraform apply`. `terraform`, by design, fails when helmfile-diff outputs were not equivalent. Stabilized helmfile-diff output rescues that.

func (*HelmState) ExecuteTemplates

func (st *HelmState) ExecuteTemplates() (*HelmState, error)

func (*HelmState) ExpandedHelmfiles

func (st *HelmState) ExpandedHelmfiles() ([]SubHelmfileSpec, error)

func (*HelmState) FilterReleases

func (st *HelmState) FilterReleases(includeTransitiveNeeds bool) error

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, outputDirTemplate string) (string, error)

func (*HelmState) GenerateOutputFilePath added in v0.129.0

func (st *HelmState) GenerateOutputFilePath(release *ReleaseSpec, outputFileTemplate string) (string, error)

func (*HelmState) GetReleasesWithOverrides added in v0.90.8

func (st *HelmState) GetReleasesWithOverrides() []ReleaseSpec

func (*HelmState) GetRepositoryAndNameFromChartName added in v0.138.0

func (st *HelmState) GetRepositoryAndNameFromChartName(chartName string) (*RepositorySpec, string)

func (*HelmState) GetSelectedReleasesWithOverrides added in v0.90.8

func (st *HelmState) GetSelectedReleasesWithOverrides(includeTransitiveNeeds bool) ([]ReleaseSpec, 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) LoadYAMLForEmbedding added in v0.126.0

func (st *HelmState) LoadYAMLForEmbedding(release *ReleaseSpec, entries []interface{}, missingFileHandler *string, pathPrefix string) ([]interface{}, error)

func (*HelmState) PlanReleases added in v0.90.8

func (st *HelmState) PlanReleases(opts PlanOptions) ([][]Release, error)

func (*HelmState) PrepareChartify added in v0.118.0

func (st *HelmState) PrepareChartify(helm helmexec.Interface, release *ReleaseSpec, chart string, workerIndex int) (*Chartify, func(), error)

func (*HelmState) PrepareCharts added in v0.118.8

func (st *HelmState) PrepareCharts(helm helmexec.Interface, dir string, concurrency int, helmfileCommand string, opts ChartPrepareOptions) (map[PrepareChartKey]string, []error)

PrepareCharts creates temporary directories of charts.

Each resulting "chart" can be one of the followings:

(1) local chart (2) temporary local chart generated from kustomization or manifests (3) remote chart

When running `helmfile template` on helm v2, or `helmfile lint` on both helm v2 and v3, PrepareCharts will download and untar charts for linting and templating.

Otheriwse, if a chart is not a helm chart, it will call "chartify" to turn it into a chart.

If exists, it will also patch resources by json patches, strategic-merge patches, and injectors.

func (*HelmState) ReleaseStatuses

func (st *HelmState) ReleaseStatuses(helm helmexec.Interface, workerLimit int) []error

func (*HelmState) RenderReleaseValuesFileToBytes added in v0.126.0

func (st *HelmState) RenderReleaseValuesFileToBytes(release *ReleaseSpec, path string) ([]byte, error)

func (*HelmState) ResolveDeps

func (st *HelmState) ResolveDeps() (*HelmState, error)

ResolveDeps returns a copy of this helmfile state with the concrete chart version numbers filled in for remote chart dependencies

func (*HelmState) Reverse added in v0.126.2

func (st *HelmState) Reverse()

func (*HelmState) SelectReleasesWithOverrides added in v0.90.8

func (st *HelmState) SelectReleasesWithOverrides(includeTransitiveNeeds bool) ([]Release, error)

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, shouldSkip map[string]bool) ([]string, error)

func (*HelmState) TemplateReleases

func (st *HelmState) TemplateReleases(helm helmexec.Interface, outputDir string, additionalValues []string, args []string, workerLimit int,
	validate bool, 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, options ...TestOption) []error

TestReleases wrapper for executing helm test on the releases

func (*HelmState) ToYaml added in v0.82.0

func (st *HelmState) ToYaml() (string, error)

func (*HelmState) TriggerCleanupEvent added in v0.125.4

func (st *HelmState) TriggerCleanupEvent(r *ReleaseSpec, helmfileCommand string) (bool, error)

func (*HelmState) TriggerGlobalCleanupEvent added in v0.118.8

func (st *HelmState) TriggerGlobalCleanupEvent(helmfileCommand string) (bool, error)

func (*HelmState) TriggerGlobalPrepareEvent added in v0.118.8

func (st *HelmState) TriggerGlobalPrepareEvent(helmfileCommand string) (bool, error)

func (*HelmState) UpdateDeps

func (st *HelmState) UpdateDeps(helm helmexec.Interface, includeTransitiveNeeds bool) []error

UpdateDeps wrapper for updating dependencies on the releases

func (*HelmState) Values added in v0.71.0

func (st *HelmState) Values() map[string]interface{}

func (*HelmState) WriteReleasesValues added in v0.129.0

func (st *HelmState) WriteReleasesValues(helm helmexec.Interface, additionalValues []string, opt ...WriteValuesOpt) []error

WriteReleasesValues writes values files for 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 LintOpt added in v0.84.0

type LintOpt interface{ Apply(*LintOpts) }

type LintOpts added in v0.84.0

type LintOpts struct {
	Set         []string
	SkipCleanup bool
}

func (*LintOpts) Apply added in v0.84.0

func (o *LintOpts) Apply(opts *LintOpts)

type PlanOptions added in v0.139.0

type PlanOptions struct {
	Reverse                bool
	IncludeNeeds           bool
	IncludeTransitiveNeeds bool
	SkipNeeds              bool
	SelectedReleases       []ReleaseSpec
}

type PrepareChartKey added in v0.138.5

type PrepareChartKey struct {
	Namespace, Name, KubeContext string
}

type PullCommand added in v0.138.5

type PullCommand struct {
	ChartRef string
	// contains filtered or unexported fields
}

type Release added in v0.90.3

type Release struct {
	ReleaseSpec

	Filtered bool
}

type ReleaseError

type ReleaseError struct {
	*ReleaseSpec

	Code int
	// contains filtered or unexported fields
}

func NewReleaseError added in v0.107.0

func NewReleaseError(release *ReleaseSpec, err error, code int) *ReleaseError

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 ReleaseSetSpec added in v0.128.0

type ReleaseSetSpec struct {
	DefaultHelmBinary string `yaml:"helmBinary,omitempty"`

	// 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"`
	OverrideKubeContext string            `yaml:"kubeContext,omitempty"`
	OverrideNamespace   string            `yaml:"namespace,omitempty"`
	OverrideChart       string            `yaml:"chart,omitempty"`
	Repositories        []RepositorySpec  `yaml:"repositories,omitempty"`
	CommonLabels        map[string]string `yaml:"commonLabels,omitempty"`
	Releases            []ReleaseSpec     `yaml:"releases,omitempty"`
	Selectors           []string          `yaml:"-"`

	// Capabilities.APIVersions
	ApiVersions []string `yaml:"apiVersions,omitempty"`

	// Capabilities.KubeVersion
	KubeVersion string `yaml:"kubeVersion,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"`

	Templates map[string]TemplateSpec `yaml:"templates"`

	Env environment.Environment `yaml:"-"`

	// If set to "Error", return an error when a subhelmfile points to a
	// non-existent path. The default behavior is to print a warning. Note the
	// differing default compared to other MissingFileHandlers.
	MissingFileHandler string `yaml:"missingFileHandler,omitempty"`
}

type ReleaseSpec

type ReleaseSpec struct {
	// Chart is the name of the chart being installed to create this release
	Chart string `yaml:"chart,omitempty"`
	// Directory is an alias to Chart which may be of more fit when you want to use a local/remote directory containing
	// K8s manifests or Kustomization as a chart
	Directory string `yaml:"directory,omitempty"`
	// Version is the semver version or version constraint for the chart
	Version string `yaml:"version,omitempty"`
	// Verify enables signature verification on fetched chart.
	// Beware some (or many?) chart repositories and charts don't seem to support it.
	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"`
	// WaitForJobs, if set and --wait enabled, will wait until all Jobs have been completed before marking the release as successful. It will wait for as long as --timeout
	WaitForJobs *bool `yaml:"waitForJobs,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"`
	// CleanupOnFail, when set to true, the --cleanup-on-fail helm flag is passed to the upgrade command
	CleanupOnFail *bool `yaml:"cleanupOnFail,omitempty"`
	// HistoryMax, limit the maximum number of revisions saved per release. Use 0 for no limit (default 10)
	HistoryMax *int `yaml:"historyMax,omitempty"`
	// Condition, when set, evaluate the mapping specified in this string to a boolean which decides whether or not to process the release
	Condition string `yaml:"condition,omitempty"`
	// CreateNamespace, when set to true (default), --create-namespace is passed to helm3 on install (ignored for helm2)
	CreateNamespace *bool `yaml:"createNamespace,omitempty"`

	// DisableOpenAPIValidation is rarely used to bypass OpenAPI validations only that is used for e.g.
	// work-around against broken CRs
	// See also:
	// - https://github.com/helm/helm/pull/6819
	// - https://github.com/roboll/helmfile/issues/1167
	DisableOpenAPIValidation *bool `yaml:"disableOpenAPIValidation,omitempty"`

	// DisableValidation is rarely used to bypass the whole validation of manifests against the Kubernetes cluster
	// so that `helm diff` can be run containing a chart that installs both CRD and CRs on first install.
	// FYI, such diff without `--disable-validation` fails on first install because the K8s cluster doesn't have CRDs registered yet.
	DisableValidation *bool `yaml:"disableValidation,omitempty"`

	// DisableValidationOnInstall disables the K8s API validation while running helm-diff on the release being newly installed on helmfile-apply.
	// It is useful when any release contains custom resources for CRDs that is not yet installed onto the cluster.
	DisableValidationOnInstall *bool `yaml:"disableValidationOnInstall,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   []interface{}     `yaml:"secrets,omitempty"`
	SetValues []SetValue        `yaml:"set,omitempty"`

	ValuesTemplate    []interface{} `yaml:"valuesTemplate,omitempty"`
	SetValuesTemplate []SetValue    `yaml:"setTemplate,omitempty"`

	// Capabilities.APIVersions
	ApiVersions []string `yaml:"apiVersions,omitempty"`

	// Capabilities.KubeVersion
	KubeVersion string `yaml:"kubeVersion,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"`

	// Transformers is the list of Kustomize transformers
	//
	// Each item can be a path to a YAML or go template file, or an embedded transformer declaration as a YAML hash.
	// It's often used to add common labels and annotations to your resources.
	// See https://github.com/kubernetes-sigs/kustomize/blob/master/examples/configureBuiltinPlugin.md#configuring-the-builtin-plugins-instead for more information.
	Transformers []interface{} `yaml:"transformers,omitempty"`
	Adopt        []string      `yaml:"adopt,omitempty"`

	// ForceGoGetter forces the use of go-getter for fetching remote directory as maniefsts/chart/kustomization
	// by parsing the url from `chart` field of the release.
	// This is handy when getting the go-getter url parsing error when it doesn't work as expected.
	// Without this, any error in url parsing result in silently falling-back to normal process of treating `chart:` as the regular
	// helm chart name.
	ForceGoGetter bool `yaml:"forceGoGetter,omitempty"`

	// ForceNamespace is an experimental feature to set metadata.namespace in every K8s resource rendered by the chart,
	// regardless of the template, even when it doesn't have `namespace: {{ .Namespace | quote }}`.
	// This is only needed when you can't FIX your chart to have `namespace: {{ .Namespace }}` AND you're using `helmfile template`.
	// In standard use-cases, `Namespace` should be sufficient.
	// Use this only when you know what you want to do!
	ForceNamespace string `yaml:"forceNamespace,omitempty"`

	// SkipDeps disables running `helm dependency up` and `helm dependency build` on this release's chart.
	// This is relevant only when your release uses a local chart or a directory containing K8s manifests or a Kustomization
	// as a Helm chart.
	SkipDeps *bool `yaml:"skipDeps,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 RepoUpdater interface {
	IsHelm3() bool
	AddRepo(name, repository, cafile, certfile, keyfile, username, password string, managed string, passCredentials string, skipTLSVerify string) error
	UpdateRepo() error
	RegistryLogin(name string, username string, password string) error
}

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"`
	Managed         string `yaml:"managed,omitempty"`
	OCI             bool   `yaml:"oci,omitempty"`
	PassCredentials string `yaml:"passCredentials,omitempty"`
	SkipTLSVerify   string `yaml:"skipTLSVerify,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
}

func (*ResolvedDependencies) Get

func (d *ResolvedDependencies) Get(chart, versionConstraint string) (string, error)

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 {
	DeleteFile func(string) error

	Strict bool

	LoadFile func(inheritedEnv *environment.Environment, baseDir, file string, evaluateBases bool) (*HelmState, error)
	// contains filtered or unexported fields
}

func NewCreator

func NewCreator(logger *zap.SugaredLogger, readFile func(string) ([]byte, error), fileExists func(string) (bool, error), abs func(string) (string, error), glob func(string) ([]string, error), directoryExistsAt func(string) bool, valsRuntime vals.Evaluator, getHelm func(*HelmState) helmexec.Interface, overrideHelmBinary string, remote *remote.Remote) *StateCreator

func (*StateCreator) LoadEnvValues

func (c *StateCreator) LoadEnvValues(target *HelmState, env string, ctxEnv *environment.Environment, failOnMissingEnv bool) (*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` evaluateBases=true means that this is NOT a base helmfile

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

func NewStorage(forFile string, logger *zap.SugaredLogger, glob func(string) ([]string, error)) *Storage

func (*Storage) ExpandPaths

func (st *Storage) ExpandPaths(globPattern string) ([]string, error)

func (*Storage) JoinBase

func (st *Storage) JoinBase(relPath string) string

JoinBase returns an absolute path in the form basePath/relative

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) MarshalYAML added in v0.136.0

func (p SubHelmfileSpec) MarshalYAML() (interface{}, error)

MarshalYAML will ensure we correctly marshal SubHelmfileSpec structure correctly so it can be unmarshalled at some future time

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 SyncOpt added in v0.84.0

type SyncOpt interface{ Apply(*SyncOpts) }

type SyncOpts added in v0.84.0

type SyncOpts struct {
	Set         []string
	SkipCleanup bool
	SkipCRDs    bool
	Wait        bool
	WaitForJobs bool
}

func (*SyncOpts) Apply added in v0.84.0

func (o *SyncOpts) Apply(opts *SyncOpts)

type TemplateOpt added in v0.84.0

type TemplateOpt interface{ Apply(*TemplateOpts) }

type TemplateOpts added in v0.84.0

type TemplateOpts struct {
	Set               []string
	SkipCleanup       bool
	OutputDirTemplate string
	IncludeCRDs       bool
	SkipTests         bool
}

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 TestOption added in v0.134.0

type TestOption func(*TestOpts)

type TestOpts added in v0.134.0

type TestOpts struct {
	Logs bool
}

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

type WriteValuesOpt added in v0.129.0

type WriteValuesOpt interface{ Apply(*WriteValuesOpts) }

type WriteValuesOpts added in v0.129.0

type WriteValuesOpts struct {
	Set                []string
	OutputFileTemplate string
	SkipCleanup        bool
}

func (*WriteValuesOpts) Apply added in v0.129.0

func (o *WriteValuesOpts) Apply(opts *WriteValuesOpts)

Jump to

Keyboard shortcuts

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