common

package
v1.20.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: Apache-2.0 Imports: 10 Imported by: 4 modules, 6 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultBurstLimit = 100
	// TODO(v2): switch to if-possible
	DefaultChartProvenanceStrategy = "never"
	// TODO(v2): reconsider?
	DefaultDeletePropagation = metav1.DeletePropagationForeground
	DefaultDiffContextLines  = 3
	DefaultFieldManager      = "helm"
	// TODO(v2): update to a more recent version? Not sure about backwards compatibility.
	DefaultLocalKubeVersion      = "1.20.0"
	DefaultLogColorMode          = log.LogColorModeAuto
	DefaultNetworkParallelism    = 30
	DefaultProgressPrintInterval = 5 * time.Second
	DefaultQPSLimit              = 30
	DefaultReleaseHistoryLimit   = 10
	KubectlEditFieldManager      = "kubectl-edit"
	OldFieldManagerPrefix        = "werf"
	StageEndSuffix               = "end"
	StagePrefix                  = "stage"
	StageStartSuffix             = "start"
	StubReleaseName              = "stub-release"
	StubReleaseNamespace         = "stub-namespace"
)
View Source
const (
	OutputFormatJSON  = "json"
	OutputFormatTable = "table"
	OutputFormatYAML  = "yaml"
)
View Source
const (
	ReleaseStorageDriverConfigMap  = "configmap"
	ReleaseStorageDriverConfigMaps = "configmaps"
	ReleaseStorageDriverDefault    = ""
	ReleaseStorageDriverMemory     = "memory"
	ReleaseStorageDriverSQL        = "sql"
	ReleaseStorageDriverSecret     = "secret"
	ReleaseStorageDriverSecrets    = "secrets"
)

Variables

View Source
var (
	// Use it whenever possible (e.g. in --help output) to refer to the product name, so it can be
	// easily white-labeled in forks.
	Brand   = "Nelm"
	Version = "0.0.0"
)
View Source
var (
	LabelKeyHumanManagedBy   = "app.kubernetes.io/managed-by"
	LabelKeyPatternManagedBy = regexp.MustCompile(`^app.kubernetes.io/managed-by$`)

	AnnotationKeyHumanReleaseName   = "meta.helm.sh/release-name"
	AnnotationKeyPatternReleaseName = regexp.MustCompile(`^meta.helm.sh/release-name$`)

	AnnotationKeyHumanReleaseNamespace   = "meta.helm.sh/release-namespace"
	AnnotationKeyPatternReleaseNamespace = regexp.MustCompile(`^meta.helm.sh/release-namespace$`)

	AnnotationKeyHumanHook   = "helm.sh/hook"
	AnnotationKeyPatternHook = regexp.MustCompile(`^helm.sh/hook$`)

	AnnotationKeyHumanResourcePolicy   = "helm.sh/resource-policy"
	AnnotationKeyPatternResourcePolicy = regexp.MustCompile(`^helm.sh/resource-policy$`)

	AnnotationKeyHumanDeletePolicy   = "werf.io/delete-policy"
	AnnotationKeyPatternDeletePolicy = regexp.MustCompile(`^werf.io/delete-policy$`)

	AnnotationKeyHumanHookDeletePolicy   = "helm.sh/hook-delete-policy"
	AnnotationKeyPatternHookDeletePolicy = regexp.MustCompile(`^helm.sh/hook-delete-policy$`)

	AnnotationKeyHumanReplicasOnCreation   = "werf.io/replicas-on-creation"
	AnnotationKeyPatternReplicasOnCreation = regexp.MustCompile(`^werf.io/replicas-on-creation$`)

	AnnotationKeyHumanFailMode   = "werf.io/fail-mode"
	AnnotationKeyPatternFailMode = regexp.MustCompile(`^werf.io/fail-mode$`)

	AnnotationKeyHumanFailuresAllowedPerReplica   = "werf.io/failures-allowed-per-replica"
	AnnotationKeyPatternFailuresAllowedPerReplica = regexp.MustCompile(`^werf.io/failures-allowed-per-replica$`)

	AnnotationKeyHumanIgnoreReadinessProbeFailsFor   = "werf.io/ignore-readiness-probe-fails-for-<container>"
	AnnotationKeyPatternIgnoreReadinessProbeFailsFor = regexp.MustCompile(`^werf.io/ignore-readiness-probe-fails-for-(?P<container>.+)$`)

	AnnotationKeyHumanLogRegex   = "werf.io/log-regex"
	AnnotationKeyPatternLogRegex = regexp.MustCompile(`^werf.io/log-regex$`)

	AnnotationKeyHumanLogRegexSkip   = "werf.io/log-regex-skip"
	AnnotationKeyPatternLogRegexSkip = regexp.MustCompile(`^werf.io/log-regex-skip$`)

	AnnotationKeyHumanLogRegexFor   = "werf.io/log-regex-for-<container>"
	AnnotationKeyPatternLogRegexFor = regexp.MustCompile(`^werf.io/log-regex-for-(?P<container>.+)$`)

	AnnotationKeyHumanSkipLogRegexFor   = "werf.io/log-regex-skip-for-<container>"
	AnnotationKeyPatternSkipLogRegexFor = regexp.MustCompile(`^werf.io/log-regex-skip-for-(?P<container>.+)$`)

	AnnotationKeyHumanNoActivityTimeout   = "werf.io/no-activity-timeout"
	AnnotationKeyPatternNoActivityTimeout = regexp.MustCompile(`^werf.io/no-activity-timeout$`)

	AnnotationKeyHumanShowLogsOnlyForContainers   = "werf.io/show-logs-only-for-containers"
	AnnotationKeyPatternShowLogsOnlyForContainers = regexp.MustCompile(`^werf.io/show-logs-only-for-containers$`)

	AnnotationKeyHumanShowServiceMessages   = "werf.io/show-service-messages"
	AnnotationKeyPatternShowServiceMessages = regexp.MustCompile(`^werf.io/show-service-messages$`)

	AnnotationKeyHumanShowLogsOnlyForNumberOfReplicas   = "werf.io/show-logs-only-for-number-of-replicas"
	AnnotationKeyPatternShowLogsOnlyForNumberOfReplicas = regexp.MustCompile(`^werf.io/show-logs-only-for-number-of-replicas$`)

	AnnotationKeyHumanSkipLogs   = "werf.io/skip-logs"
	AnnotationKeyPatternSkipLogs = regexp.MustCompile(`^werf.io/skip-logs$`)

	AnnotationKeyHumanSkipLogsForContainers   = "werf.io/skip-logs-for-containers"
	AnnotationKeyPatternSkipLogsForContainers = regexp.MustCompile(`^werf.io/skip-logs-for-containers$`)

	AnnotationKeyHumanTrackTerminationMode   = "werf.io/track-termination-mode"
	AnnotationKeyPatternTrackTerminationMode = regexp.MustCompile(`^werf.io/track-termination-mode$`)

	AnnotationKeyHumanWeight   = "werf.io/weight"
	AnnotationKeyPatternWeight = regexp.MustCompile(`^werf.io/weight$`)

	AnnotationKeyHumanHookWeight   = "helm.sh/hook-weight"
	AnnotationKeyPatternHookWeight = regexp.MustCompile(`^helm.sh/hook-weight$`)

	AnnotationKeyHumanDeployDependency   = "werf.io/deploy-dependency-<name>"
	AnnotationKeyPatternDeployDependency = regexp.MustCompile(`^werf.io/deploy-dependency-(?P<id>.+)$`)

	// TODO(v2): get rid
	AnnotationKeyHumanDependency   = "<name>.dependency.werf.io"
	AnnotationKeyPatternDependency = regexp.MustCompile(`^(?P<id>.+).dependency.werf.io$`)

	AnnotationKeyHumanExternalDependency   = "<name>.external-dependency.werf.io"
	AnnotationKeyPatternExternalDependency = regexp.MustCompile(`^(?P<id>.+).external-dependency.werf.io$`)

	AnnotationKeyHumanLegacyExternalDependencyResource   = "<name>.external-dependency.werf.io/resource"
	AnnotationKeyPatternLegacyExternalDependencyResource = regexp.MustCompile(`^(?P<id>.+).external-dependency.werf.io/resource$`)

	AnnotationKeyHumanLegacyExternalDependencyNamespace   = "<name>.external-dependency.werf.io/namespace"
	AnnotationKeyPatternLegacyExternalDependencyNamespace = regexp.MustCompile(`^(?P<id>.+).external-dependency.werf.io/namespace$`)

	AnnotationKeyHumanSensitive   = "werf.io/sensitive"
	AnnotationKeyPatternSensitive = regexp.MustCompile(`^werf.io/sensitive$`)

	AnnotationKeyHumanSensitivePaths   = "werf.io/sensitive-paths"
	AnnotationKeyPatternSensitivePaths = regexp.MustCompile(`^werf.io/sensitive-paths$`)

	AnnotationKeyHumanDeployOn   = "werf.io/deploy-on"
	AnnotationKeyPatternDeployOn = regexp.MustCompile(`^werf.io/deploy-on$`)

	AnnotationKeyHumanOwnership   = "werf.io/ownership"
	AnnotationKeyPatternOwnership = regexp.MustCompile(`^werf.io/ownership$`)

	AnnotationKeyHumanDeletePropagation   = "werf.io/delete-propagation"
	AnnotationKeyPatternDeletePropagation = regexp.MustCompile(`^werf.io/delete-propagation$`)
)
View Source
var DefaultRegistryCredentialsPath = filepath.Join(homedir.Get(), ".docker", config.ConfigFileName)
View Source
var SprigFuncs = sprig.TxtFuncMap()

Functions

func StagesSortHandler added in v1.15.1

func StagesSortHandler(stage1, stage2 Stage) bool

Types

type ChartRepoConnectionOptions added in v1.15.1

type ChartRepoConnectionOptions struct {
	// ChartRepoBasicAuthPassword is the password for HTTP basic authentication to the chart repository.
	ChartRepoBasicAuthPassword string
	// ChartRepoBasicAuthUsername is the username for HTTP basic authentication to the chart repository.
	ChartRepoBasicAuthUsername string
	// ChartRepoCAPath is the path to the TLS CA certificate file for verifying the chart repository server.
	ChartRepoCAPath string
	// ChartRepoCertPath is the path to the TLS client certificate file for connecting to the chart repository.
	ChartRepoCertPath string
	// ChartRepoInsecure, when true, allows insecure HTTP connections to the chart repository.
	// WARNING: This disables HTTPS and should only be used for testing.
	ChartRepoInsecure bool
	// ChartRepoKeyPath is the path to the TLS client key file for connecting to the chart repository.
	ChartRepoKeyPath string
	// ChartRepoPassCreds, when true, passes repository credentials to all domains during chart operations.
	// By default, credentials are only passed to the original repository domain.
	ChartRepoPassCreds bool
	// ChartRepoRequestTimeout is the timeout duration for requests to the chart repository.
	// If 0, no timeout is applied.
	ChartRepoRequestTimeout time.Duration
	// ChartRepoSkipTLSVerify, when true, disables TLS certificate verification for the chart repository.
	// WARNING: This makes connections insecure and should only be used for testing.
	ChartRepoSkipTLSVerify bool
	// ChartRepoURL is the URL of the chart repository to use for chart lookups (e.g., "https://charts.example.com").
	ChartRepoURL string
}

func (*ChartRepoConnectionOptions) ApplyDefaults added in v1.15.1

func (opts *ChartRepoConnectionOptions) ApplyDefaults()

type DeletePolicy

type DeletePolicy string

Configures resource deletions during deployment of this resource.

const (
	// Delete the resource after it is successfully deployed.
	DeletePolicySucceeded DeletePolicy = "succeeded"
	// Delete the resource after it fails to be deployed.
	DeletePolicyFailed DeletePolicy = "failed"
	// Delete the resource before deploying it. Basically means "recreate the resource" instead of
	// updating it.
	DeletePolicyBeforeCreation DeletePolicy = "before-creation"
	// If during resource update we got an immutable error, then recreate the resource instead of
	// updating it.
	DeletePolicyBeforeCreationIfImmutable DeletePolicy = "before-creation-if-immutable"
)

type DeployType

type DeployType string

Type of the current operation.

const (
	// Installing revision number 1 of the release always considered "Initial".
	DeployTypeInitial DeployType = "Initial"
	// Revision number > 1 with no successful revisions between revision 1 and the last revision
	// results in install.
	DeployTypeInstall DeployType = "Install"
	// If any successful revision found in history, then the current operation is upgrade.
	DeployTypeUpgrade DeployType = "Upgrade"
	// If current operation is release rollback.
	DeployTypeRollback DeployType = "Rollback"
	// If current operation is release uninstall.
	DeployTypeUninstall DeployType = "Uninstall"
)

type KubeConnectionOptions added in v1.15.1

type KubeConnectionOptions struct {
	// KubeAPIServerAddress is the Kubernetes API server address (e.g., "https://kubernetes.example.com:6443").
	KubeAPIServerAddress string
	// KubeAuthProviderConfig is the configuration map for the authentication provider in Kubernetes API.
	KubeAuthProviderConfig map[string]string
	// KubeAuthProviderName is the name of the authentication provider for Kubernetes (e.g., "gcp", "azure", "oidc").
	KubeAuthProviderName string
	// KubeBasicAuthPassword is the password for HTTP basic authentication to the Kubernetes API.
	KubeBasicAuthPassword string
	// KubeBasicAuthUsername is the username for HTTP basic authentication to the Kubernetes API.
	KubeBasicAuthUsername string
	// KubeBearerTokenData is the bearer token data for authentication in Kubernetes.
	KubeBearerTokenData string
	// KubeBearerTokenPath is the path to a file containing the bearer token for Kubernetes authentication.
	KubeBearerTokenPath string
	// KubeBurstLimit is the maximum burst limit for throttling requests to Kubernetes API.
	// Defaults to DefaultBurstLimit (100) if not set or <= 0.
	KubeBurstLimit int
	// KubeConfigBase64 is the base64-encoded kubeconfig file content.
	// Takes precedence over reading from file paths.
	KubeConfigBase64 string
	// KubeConfigPaths is a list of paths to kubeconfig files. If multiple are specified, their contents are merged.
	// Defaults to ~/.kube/config if both this and KubeConfigBase64 are empty.
	KubeConfigPaths []string
	// KubeContextCluster overrides the cluster to use from the kubeconfig for the current context.
	KubeContextCluster string
	// KubeContextCurrent specifies which kubeconfig context to use (e.g., "production", "staging").
	KubeContextCurrent string
	// KubeContextUser overrides the user to use from the kubeconfig for the current context.
	KubeContextUser string
	// KubeImpersonateGroups sets the Impersonate-Group headers when authenticating in Kubernetes.
	// Used to impersonate specific groups for authorization purposes.
	KubeImpersonateGroups []string
	// KubeImpersonateUID sets the Impersonate-Uid header when authenticating in Kubernetes.
	KubeImpersonateUID string
	// KubeImpersonateUser sets the Impersonate-User header when authenticating in Kubernetes.
	// Used to perform actions as a different user.
	KubeImpersonateUser string
	// KubeProxyURL is the proxy URL to use for all requests to the Kubernetes API (e.g., "http://proxy.example.com:8080").
	KubeProxyURL string
	// KubeQPSLimit is the Queries Per Second limit for requests to Kubernetes API.
	// Controls the rate of API requests. Defaults to DefaultQPSLimit (30) if not set or <= 0.
	KubeQPSLimit int
	// KubeRequestTimeout is the timeout duration for all requests to the Kubernetes API.
	// If 0, no timeout is applied.
	KubeRequestTimeout time.Duration
	// KubeSkipTLSVerify, when true, disables TLS certificate verification for the Kubernetes API.
	// WARNING: This makes connections insecure and should only be used for testing.
	KubeSkipTLSVerify bool
	// KubeTLSCAData is the PEM-encoded TLS CA certificate data for the Kubernetes API server.
	KubeTLSCAData string
	// KubeTLSCAPath is the path to the PEM-encoded TLS CA certificate file for the Kubernetes API server.
	KubeTLSCAPath string
	// KubeTLSClientCertData is the PEM-encoded TLS client certificate data for connecting to Kubernetes API.
	KubeTLSClientCertData string
	// KubeTLSClientCertPath is the path to the PEM-encoded TLS client certificate file for connecting to Kubernetes API.
	KubeTLSClientCertPath string
	// KubeTLSClientKeyData is the PEM-encoded TLS client key data for connecting to Kubernetes API.
	KubeTLSClientKeyData string
	// KubeTLSClientKeyPath is the path to the PEM-encoded TLS client key file for connecting to Kubernetes API.
	KubeTLSClientKeyPath string
	// KubeTLSServerName is the server name to use for Kubernetes API TLS validation.
	// Useful when the API server hostname differs from the TLS certificate's subject.
	KubeTLSServerName string
}

func (*KubeConnectionOptions) ApplyDefaults added in v1.15.1

func (opts *KubeConnectionOptions) ApplyDefaults(homeDir string)

type On added in v1.15.1

type On string

On which action type the resource should be rendered for the deployment.

const (
	// Render resource on release installation.
	InstallOnInstall On = "install"
	// Render resource on release upgrade.
	InstallOnUpgrade On = "upgrade"
	// Render resource on release rollback.
	InstallOnRollback On = "rollback"
	// Render resource on release uninstall.
	InstallOnDelete On = "delete"
	// Render resource on release test.
	InstallOnTest On = "test"
)

type Ownership added in v1.15.1

type Ownership string

Resource ownership.

const (
	// The resource is owned by anyone (e.g. not tied to the release).
	OwnershipAnyone Ownership = "anyone"
	// The resource is owned by a single release.
	OwnershipRelease Ownership = "release"
)

type ResourceState added in v1.15.1

type ResourceState string

The state of the resource in the cluster.

const (
	ResourceStateAbsent  ResourceState = "absent"
	ResourceStatePresent ResourceState = "present"
	ResourceStateReady   ResourceState = "ready"
)

type SecretValuesOptions added in v1.15.1

type SecretValuesOptions struct {
	// DefaultSecretValuesDisable, when true, ignores the default secret-values.yaml file from the chart.
	// Useful when you don't want to use the chart's default encrypted values.
	DefaultSecretValuesDisable bool
	// SecretKey is the encryption/decryption key for secret values files.
	// Must be set (or available via $NELM_SECRET_KEY) to work with encrypted values.
	SecretKey string
	// SecretKeyIgnore, when true, ignores the secret key and skips decryption of secret values files.
	// Useful for operations that don't require access to secrets.
	SecretKeyIgnore bool
	// SecretValuesFiles is a list of paths to encrypted values files to decrypt and merge.
	// Files are decrypted in-memory during chart operations using the secret key.
	SecretValuesFiles []string
	// SecretWorkDir is the working directory for resolving relative paths in secret operations.
	// Defaults to the current directory if not specified.
	SecretWorkDir string
}

func (*SecretValuesOptions) ApplyDefaults added in v1.15.1

func (opts *SecretValuesOptions) ApplyDefaults(currentDir string)

type Stage added in v1.15.1

type Stage string

A sequential stage of the plan.

const (
	StageInit              Stage = "init"                // create pending release
	StagePrePreUninstall   Stage = "pre-pre-uninstall"   // uninstall previous release resources
	StagePrePreInstall     Stage = "pre-pre-install"     // install crd
	StagePreInstall        Stage = "pre-install"         // install pre-hooks
	StagePreUninstall      Stage = "pre-uninstall"       // cleanup pre-hooks
	StageInstall           Stage = "install"             // install resources
	StageUninstall         Stage = "uninstall"           // cleanup resources
	StagePostInstall       Stage = "post-install"        // install post-hooks
	StagePostUninstall     Stage = "post-uninstall"      // cleanup post-hooks
	StagePostPostInstall   Stage = "post-post-install"   // install webhook
	StagePostPostUninstall Stage = "post-post-uninstall" // uninstall crd, webhook
	StageFinal             Stage = "final"               // succeed pending release, supersede previous release
)

func SubStageWeighted added in v1.15.1

func SubStageWeighted(stage Stage, weight int) Stage

type StoreAs added in v1.15.1

type StoreAs string

How the resource should be stored in the Helm release.

const (
	StoreAsNone    StoreAs = "none"
	StoreAsHook    StoreAs = "hook"
	StoreAsRegular StoreAs = "regular"
)

type TrackingOptions added in v1.15.1

type TrackingOptions struct {
	// LegacyHelmCompatibleTracking enables Helm-compatible tracking behavior: only Jobs-hooks are tracked.
	LegacyHelmCompatibleTracking bool
	// NoFinalTracking, when true, disables final tracking of resources after the release operation.
	// Final tracking waits for all resources to reach their ready state.
	NoFinalTracking bool
	// NoPodLogs, when true, disables collection and printing of Pod logs during tracking.
	// By default, logs from failing or starting Pods are shown.
	NoPodLogs bool
	// NoProgressTablePrint, when true, disables real-time progress table display.
	// The progress table shows logs, events, and status information for release resources.
	NoProgressTablePrint bool
	// ProgressTablePrintInterval is the interval for updating the progress table display.
	// Defaults to DefaultProgressPrintInterval (5 seconds) if not set or <= 0.
	ProgressTablePrintInterval time.Duration
	// TrackCreationTimeout is the timeout duration for tracking resource creation.
	// If resource creation doesn't complete within this time, the operation fails.
	// If 0, no timeout is applied and resources are tracked indefinitely.
	TrackCreationTimeout time.Duration
	// TrackDeletionTimeout is the timeout duration for tracking resource deletion.
	// If resource deletion doesn't complete within this time, the operation fails.
	// If 0, no timeout is applied and resources are tracked indefinitely.
	TrackDeletionTimeout time.Duration
	// TrackReadinessTimeout is the timeout duration for tracking resource readiness.
	// If resources don't become ready within this time, the operation fails.
	// If 0, no timeout is applied and resources are tracked indefinitely.
	TrackReadinessTimeout time.Duration
}

func (*TrackingOptions) ApplyDefaults added in v1.15.1

func (opts *TrackingOptions) ApplyDefaults()

type ValuesOptions added in v1.15.1

type ValuesOptions struct {
	// DefaultValuesDisable, when true, ignores the values.yaml file from the top-level chart.
	// Useful when you want complete control over values without chart defaults.
	DefaultValuesDisable bool
	// RuntimeSetJSON is a list of key-value pairs in "key=json" format to set in $.Runtime.
	// This is meant to be generated programmatically. Users should prefer ValuesSetJSON.
	// Example: ["runtime.env=dev", "runtime.timestamp=1234567890"]
	RuntimeSetJSON []string
	// ValuesFiles is a list of paths to additional values files to merge with chart values.
	// Files are merged in order, with later files overriding earlier ones.
	ValuesFiles []string
	// ValuesSet is a list of key-value pairs in "key=value" format to set chart values.
	// Values are parsed and may become various types (string, int, bool, etc.).
	// Example: ["image.tag=v1.2.3", "replicas=3"]
	ValuesSet []string
	// ValuesSetFile is a list of key-file pairs in "key=filepath" format.
	// The value is set to the contents of the specified file.
	// Example: ["config.yaml=/path/to/config.yaml"]
	ValuesSetFile []string
	// ValuesSetJSON is a list of key-value pairs in "key=json" format.
	// Values must be valid JSON and are parsed as such.
	// Example: ["config={\"key\":\"value\"}", "list=[1,2,3]"]
	ValuesSetJSON []string
	// ValuesSetLiteral is a list of key-value pairs in "key=value" format.
	// Values always become literal strings, even if they look like numbers or booleans.
	// Example: ["version=1.0.0", "enabled=true"] results in strings "1.0.0" and "true"
	ValuesSetLiteral []string
	// ValuesSetString is a list of key-value pairs in "key=value" format.
	// Values always become strings (no type inference).
	// Example: ["image.tag=v1.2.3", "count=5"] results in strings "v1.2.3" and "5"
	ValuesSetString []string
}

func (*ValuesOptions) ApplyDefaults added in v1.15.1

func (opts *ValuesOptions) ApplyDefaults()

Jump to

Keyboard shortcuts

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