common

package
v1.16.0 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2025 License: Apache-2.0 Imports: 9 Imported by: 6

Documentation

Index

Constants

View Source
const (
	DefaultBurstLimit              = 100
	DefaultChartProvenanceStrategy = "never" // TODO(v2): switch to if-possible
	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$`)
)
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 string
	ChartRepoBasicAuthUsername string
	ChartRepoCAPath            string
	ChartRepoCertPath          string
	ChartRepoInsecure          bool
	ChartRepoKeyPath           string
	ChartRepoPassCreds         bool
	ChartRepoRequestTimeout    time.Duration
	ChartRepoSkipTLSVerify     bool
	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   string
	KubeAuthProviderConfig map[string]string
	KubeAuthProviderName   string
	KubeBasicAuthPassword  string
	KubeBasicAuthUsername  string
	KubeBearerTokenData    string
	KubeBearerTokenPath    string
	KubeBurstLimit         int
	KubeConfigBase64       string
	KubeConfigPaths        []string
	KubeContextCluster     string
	KubeContextCurrent     string
	KubeContextUser        string
	KubeImpersonateGroups  []string
	KubeImpersonateUID     string
	KubeImpersonateUser    string
	KubeProxyURL           string
	KubeQPSLimit           int
	KubeRequestTimeout     time.Duration
	KubeSkipTLSVerify      bool
	KubeTLSCAData          string
	KubeTLSCAPath          string
	KubeTLSClientCertData  string
	KubeTLSClientCertPath  string
	KubeTLSClientKeyData   string
	KubeTLSClientKeyPath   string
	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 bool
	SecretKey                  string
	SecretKeyIgnore            bool
	SecretValuesFiles          []string
	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"
	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            bool
	NoPodLogs                  bool
	NoProgressTablePrint       bool
	ProgressTablePrintInterval time.Duration
	TrackCreationTimeout       time.Duration
	TrackDeletionTimeout       time.Duration
	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 bool
	RuntimeSetJSON       []string
	ValuesFiles          []string
	ValuesSet            []string
	ValuesSetFile        []string
	ValuesSetJSON        []string
	ValuesSetLiteral     []string
	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