common

package
v1.18.1 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2025 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
	DefaultChartProvenanceStrategy = "never" // TODO(v2): switch to if-possible
	DefaultDeletePropagation       = metav1.DeletePropagationForeground
	DefaultDiffContextLines        = 3
	DefaultFieldManager            = "helm"
	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 (
	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$`)

	AnnotationKeyHumanLogRegexFor   = "werf.io/log-regex-for-<container>"
	AnnotationKeyPatternLogRegexFor = regexp.MustCompile(`^werf.io/log-regex-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
const (
	DeletePolicySucceeded                 DeletePolicy = "succeeded"
	DeletePolicyFailed                    DeletePolicy = "failed"
	DeletePolicyBeforeCreation            DeletePolicy = "before-creation"
	DeletePolicyBeforeCreationIfImmutable DeletePolicy = "before-creation-if-immutable"
)

type DeployType

type DeployType string
const (
	// Activated for the first revision of the release.
	DeployTypeInitial DeployType = "Initial"
	// Activated when no successful revision found. But for the very first revision
	// DeployTypeInitial is used instead.
	DeployTypeInstall DeployType = "Install"
	// Activated when a successful revision found.
	DeployTypeUpgrade   DeployType = "Upgrade"
	DeployTypeRollback  DeployType = "Rollback"
	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
const (
	InstallOnInstall  On = "install"
	InstallOnUpgrade  On = "upgrade"
	InstallOnRollback On = "rollback"
	InstallOnDelete   On = "delete"
	InstallOnTest     On = "test"
)

type Ownership added in v1.15.1

type Ownership string
const (
	OwnershipAnyone  Ownership = "anyone"
	OwnershipRelease Ownership = "release"
)

type ResourceState added in v1.15.1

type ResourceState string
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
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
const (
	StoreAsNone    StoreAs = "none"
	StoreAsHook    StoreAs = "hook"
	StoreAsRegular StoreAs = "regular"
)

type TrackingOptions added in v1.15.1

type TrackingOptions struct {
	// 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