app

package
v1.77.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package app is deckhouse's single entry point for application configuration: constants, settings, CLI flags and environment variables.

The package plays two roles:

  • It owns deckhouse's own well-known values: product identity, the d8-system and kube-system namespaces, image-layout paths, the embedded and downloaded module directories, resource names, the runtime environment-variable contract and feature-gate flags. These are centralized here instead of being scattered across the controller.
  • It is a thin facade over the upstream addon-operator and shell-operator app packages. Deckhouse code imports this package instead of reaching into flant/* directly; the facade delegates to addon-operator, which in turn projects its config onto shell-operator.

Index

Constants

View Source
const (
	// EnvBundle selects the always-on module set: Default, Minimal or Managed.
	EnvBundle = "DECKHOUSE_BUNDLE"

	// EnvHA holds "true"/"false". HA is the default; "false" forces single-replica
	// mode and is honored only in dev builds.
	EnvHA = "DECKHOUSE_HA"

	// Pod identity from the downward API (EnvPod=metadata.name,
	// EnvNamespace=metadata.namespace, EnvListenAddress=status.podIP), combined
	// into the leader-election lease identity. EnvListenAddress is the operator
	// listen address, which the manifest wires to the pod IP, so it doubles as one.
	EnvPod           = "DECKHOUSE_POD"
	EnvNamespace     = "ADDON_OPERATOR_NAMESPACE"
	EnvListenAddress = "ADDON_OPERATOR_LISTEN_ADDRESS"
	EnvClusterDomain = "KUBERNETES_CLUSTER_DOMAIN"

	// EnvNodeName is the node the pod runs on (downward API spec.nodeName).
	EnvNodeName = "DECKHOUSE_NODE_NAME"

	// EnvSkipEntrypoint is set when the controller re-execs itself on a restart
	// signal, so the one-time entrypoint setup (chroot, symlinks) runs only once.
	EnvSkipEntrypoint = "SKIP_ENTRYPOINT_EXECUTION"

	// EnvShellChrootDir and EnvModulesDir belong to the addon-operator config
	// contract (also parsed by envconfig). They are read directly in the entrypoint
	// to prepare the shell chroot and locate modules before the operator starts.
	EnvShellChrootDir = "ADDON_OPERATOR_SHELL_CHROOT_DIR"
	EnvModulesDir     = "MODULES_DIR"

	// OTLP tracing exporter settings.
	EnvTracingOTLPEndpoint      = "TRACING_OTLP_ENDPOINT"
	EnvTracingOTLPAuthToken     = "TRACING_OTLP_AUTH_TOKEN"
	EnvTracingOTLPInsecure      = "TRACING_OTLP_INSECURE"
	EnvTracingOTLPTLSSkipVerify = "TRACING_OTLP_TLS_SKIP_VERIFY"

	// Options forwarded to the embedded dhctl CLI.
	EnvLoggerType          = "DECKHOUSE_LOGGER_TYPE"
	EnvEditor              = "DECKHOUSE_EDITOR"
	EnvKubeConfigInCluster = "DECKHOUSE_KUBE_CONFIG_IN_CLUSTER"
	EnvTmpDir              = "DECKHOUSE_TMP_DIR"
)

Environment variable names the deckhouse controller reads at runtime. They are the contract with the controller Deployment manifest (modules/002-deckhouse/templates/deployment.yaml). A few overlap the addon-operator config and are also parsed into *Config by the envconfig package; they are read directly here only for early-startup and pod-identity needs, before that config is built.

View Source
const (
	EnvEnablePackageSystem  = "DECKHOUSE_ENABLE_PACKAGE_SYSTEM"
	EnvEnableModulePackages = "DECKHOUSE_ENABLE_MODULE_PACKAGES"
)

Feature-gate environment variables. Each turns on a block of controllers in pkg/controller when set to the literal "true".

View Source
const (
	// AppName is the application name.
	AppName = "deckhouse"
	// AppDescription is the short product description shown in CLI help.
	AppDescription = "controller for Kubernetes platform from Flant"

	// DefaultReleaseChannel is the release channel used when none is injected at build time.
	DefaultReleaseChannel = "Stable"
)

Product identity of the deckhouse controller.

View Source
const (
	// NamespaceDeckhouse is the namespace deckhouse and its components run in.
	NamespaceDeckhouse = "d8-system"
	// NamespaceKubeSystem is the Kubernetes system namespace.
	NamespaceKubeSystem = "kube-system"
)

Kubernetes namespaces deckhouse operates in.

View Source
const (
	// VersionFilePath is the file holding the deckhouse version.
	VersionFilePath = "/deckhouse/version"
	// PathDeckhouseCRDs is the glob for deckhouse-controller CRD manifests.
	PathDeckhouseCRDs = "/deckhouse/deckhouse-controller/crds/*.yaml"
	// PathEdition is the file holding the deckhouse edition.
	PathEdition = "/deckhouse/edition"
)

Filesystem paths baked into the deckhouse image layout.

View Source
const (
	PathPythonLib      = "/deckhouse/python_lib"
	PathCandi          = "/deckhouse/candi"
	PathHelmLib        = "/deckhouse/helm_lib"
	PathShellLib       = "/deckhouse/shell_lib"
	PathShellOperator  = "/deckhouse/shell-operator"
	PathShellLibScript = "/deckhouse/shell_lib.sh"
)

Chroot mount sources for shell hooks and enabled scripts.

View Source
const (
	// DeploymentName is the name of the deckhouse Deployment.
	DeploymentName = "deckhouse"
	// SecretRegistry holds the container registry credentials.
	SecretRegistry = "deckhouse-registry"
	// SecretDiscovery holds cluster discovery data.
	SecretDiscovery = "deckhouse-discovery"
)

Well-known names of deckhouse-owned Kubernetes resources in NamespaceDeckhouse.

View Source
const DefaultTempDir = adapp.DefaultTempDir

DefaultTempDir is the fallback temporary directory for hook data.

View Source
const EmbeddedModulesDir = "/deckhouse/modules"

EmbeddedModulesDir is the directory with modules shipped in the deckhouse image.

Variables

This section is empty.

Functions

func ApplyConfig

func ApplyConfig(cfg *Config)

ApplyConfig mirrors cfg into addon-operator's package-level globals so code that reads them directly, and the debug sub-commands, see the resolved values. Nil-safe and idempotent.

func BindFlags

func BindFlags(cfg *Config, rootCmd, cmd *cobra.Command)

BindFlags registers operator CLI flags on cmd, using the current cfg values as defaults so an explicit flag always wins. rootCmd receives the hidden debug-options helper command.

func ClusterDomain

func ClusterDomain() string

ClusterDomain is the Kubernetes cluster domain.

func DebugKeepTmpFiles

func DebugKeepTmpFiles() bool

DebugKeepTmpFiles reports whether temporary hook files are kept for debugging.

func DebugUnixSocket

func DebugUnixSocket() string

DebugUnixSocket is the path to the debug endpoint unix socket.

func DefineDebugCommands

func DefineDebugCommands(rootCmd *cobra.Command)

DefineDebugCommands attaches addon-operator's global and module debug sub-commands to rootCmd.

func DownloadedModulesDir

func DownloadedModulesDir() string

DownloadedModulesDir is the directory holding externally downloaded modules. The location is environment-configured and read through the d8env package.

func EnabledHA

func EnabledHA() bool

EnabledHA reports whether HA is enabled. HA is the default; it is off only when DECKHOUSE_HA is explicitly "false". The caller honors "off" only in dev builds.

func EnvBoolOr

func EnvBoolOr(name string, defaultValue bool) bool

EnvBoolOr parses the env var as a bool (per strconv.ParseBool), or returns defaultValue when unset, empty, or unparseable.

func EnvOr

func EnvOr(name, defaultValue string) string

EnvOr returns the value of the env var name, or defaultValue when it is unset or empty.

func HelmMonitorKubeClientBurst

func HelmMonitorKubeClientBurst() int

HelmMonitorKubeClientBurst is the burst limit for the Helm resources monitor client.

func HelmMonitorKubeClientQPS

func HelmMonitorKubeClientQPS() float32

HelmMonitorKubeClientQPS is the QPS limit for the Helm resources monitor client.

func KubeClientBurst

func KubeClientBurst() int

KubeClientBurst is the burst limit for the main Kubernetes client.

func KubeClientQPS

func KubeClientQPS() float32

KubeClientQPS is the QPS limit for the main Kubernetes client.

func KubeConfig

func KubeConfig() string

KubeConfig is the path to the kubeconfig file.

func KubeContext

func KubeContext() string

KubeContext is the kubeconfig context name to use.

func ListenAddress

func ListenAddress() string

ListenAddress is the address the operator serves Prometheus metrics on.

func LogProxyHookJSON

func LogProxyHookJSON() bool

LogProxyHookJSON reports whether hook stdout/stderr JSON logging is proxied.

func ModulePackagesEnabled

func ModulePackagesEnabled() bool

ModulePackagesEnabled reports whether the module-package controllers (ModulePackage, ModulePackageVersion, Module v2) are enabled.

func NodeName

func NodeName() string

NodeName is the name of the node the controller pod runs on.

func ObjectPatcherKubeClientBurst

func ObjectPatcherKubeClientBurst() int

ObjectPatcherKubeClientBurst is the burst limit for the object patcher client.

func ObjectPatcherKubeClientQPS

func ObjectPatcherKubeClientQPS() float32

ObjectPatcherKubeClientQPS is the QPS limit for the object patcher client.

func ObjectPatcherKubeClientTimeout

func ObjectPatcherKubeClientTimeout() time.Duration

ObjectPatcherKubeClientTimeout is the request timeout for the object patcher client.

func PackageSystemEnabled

func PackageSystemEnabled() bool

PackageSystemEnabled reports whether the package-system controllers (PackageRepository, Application, ApplicationPackageVersion) are enabled.

func PodIP

func PodIP() string

PodIP is the controller pod IP. It reads the operator listen-address env, which the Deployment wires to status.podIP.

func PodName

func PodName() string

PodName is the controller pod name, used as the leader-election identity.

func PodNamespace

func PodNamespace() string

PodNamespace is the controller pod namespace.

func SetAddonOperatorVersion

func SetAddonOperatorVersion(v string)

SetAddonOperatorVersion sets the version string reported by addon-operator.

func SetAppStartMessage

func SetAppStartMessage(msg string)

SetAppStartMessage overrides the line logged when the operator starts.

func SetDebugUnixSocket

func SetDebugUnixSocket(path string)

SetDebugUnixSocket overrides the unix socket path for the debug endpoint.

func SetKubeClientFieldManager

func SetKubeClientFieldManager(name string)

SetKubeClientFieldManager sets the field manager name for server-side apply. Must be set before the Kubernetes client is initialized.

func SetShellOperatorVersion

func SetShellOperatorVersion(v string)

SetShellOperatorVersion sets the version string reported by shell-operator.

func StrictModeEnabled

func StrictModeEnabled() bool

StrictModeEnabled reports whether a missing values.yaml is a fatal error.

func TracingOTLPAuthToken

func TracingOTLPAuthToken() string

TracingOTLPAuthToken is the OTLP trace exporter auth token.

func TracingOTLPEndpoint

func TracingOTLPEndpoint() string

TracingOTLPEndpoint is the OTLP trace exporter endpoint.

func TracingOTLPInsecure

func TracingOTLPInsecure() bool

TracingOTLPInsecure reports whether the OTLP exporter uses an insecure transport.

func TracingOTLPTLSSkipVerify

func TracingOTLPTLSSkipVerify() bool

TracingOTLPTLSSkipVerify reports whether OTLP exporter TLS verification is skipped.

Types

type Config

type Config = adapp.Config

Config is the operator configuration. It is an alias of addon-operator's Config, so *app.Config is the exact same type addon-operator expects in WithConfig: there is no conversion at the boundary.

func NewConfig

func NewConfig() *Config

NewConfig returns a Config preset with addon-operator's hardcoded defaults. Layer environment variables on top with envconfig.Load before binding flags.

Jump to

Keyboard shortcuts

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