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
- func ApplyConfig(cfg *Config)
- func BindFlags(cfg *Config, rootCmd, cmd *cobra.Command)
- func ClusterDomain() string
- func DebugKeepTmpFiles() bool
- func DebugUnixSocket() string
- func DefineDebugCommands(rootCmd *cobra.Command)
- func DownloadedModulesDir() string
- func EnabledHA() bool
- func EnvBoolOr(name string, defaultValue bool) bool
- func EnvOr(name, defaultValue string) string
- func HelmMonitorKubeClientBurst() int
- func HelmMonitorKubeClientQPS() float32
- func KubeClientBurst() int
- func KubeClientQPS() float32
- func KubeConfig() string
- func KubeContext() string
- func ListenAddress() string
- func LogProxyHookJSON() bool
- func ModulePackagesEnabled() bool
- func NodeName() string
- func ObjectPatcherKubeClientBurst() int
- func ObjectPatcherKubeClientQPS() float32
- func ObjectPatcherKubeClientTimeout() time.Duration
- func PackageSystemEnabled() bool
- func PodIP() string
- func PodName() string
- func PodNamespace() string
- func SetAddonOperatorVersion(v string)
- func SetAppStartMessage(msg string)
- func SetDebugUnixSocket(path string)
- func SetKubeClientFieldManager(name string)
- func SetShellOperatorVersion(v string)
- func StrictModeEnabled() bool
- func TracingOTLPAuthToken() string
- func TracingOTLPEndpoint() string
- func TracingOTLPInsecure() bool
- func TracingOTLPTLSSkipVerify() bool
- type Config
Constants ¶
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.
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".
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.
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.
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.
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.
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.
const DefaultTempDir = adapp.DefaultTempDir
DefaultTempDir is the fallback temporary directory for hook data.
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 ¶
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 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 ¶
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 ¶
EnvBoolOr parses the env var as a bool (per strconv.ParseBool), or returns defaultValue when unset, empty, or unparseable.
func EnvOr ¶
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 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 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 ¶
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 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.