Documentation ¶
Overview ¶
Package env provides access to environment variable defaults, definitions & utils
Index ¶
Constants ¶
const ( // ApateletListenAddressDefault is the default for ListenAddress ApateletListenAddressDefault = "0.0.0.0" // ApateletListenPortDefault is the default for ListenPort ApateletListenPortDefault = 8086 // ApateletKubernetesPortDefault is the default for MetricsPort ApateletKubernetesPortDefault = 10250 // ApateletMetricsPortDefault is the default for KubernetesPort ApateletMetricsPortDefault = 10255 // ApateletKubeConfigLocationDefault is the default value for KubeConfigLocation ApateletKubeConfigLocationDefault = "/tmp/apate/config" // ApateletControlPlaneAddressDefault is the default for ControlPlaneAddress ApateletControlPlaneAddressDefault = "localhost" // ApateletControlPlanePortDefault is the default for ControlPlanePort ApateletControlPlanePortDefault = CPListenPortDefault // ApateletDisableTaintsDefault is the default for DisableTaints ApateletDisableTaintsDefault = false // CIKubernetesAddress is the default for CIKubernetesAddress CIKubernetesAddressDefault = "" // ApateletDebugEnabledDefault default for DebugEnabled ApateletDebugEnabledDefault = false )
Apatelet environment variables
const ( // CPListenAddressDefault is the default value for ControlPlaneListenAddress CPListenAddressDefault = "0.0.0.0" // CPListenPortDefault is the default value for ControlPlaneListenPort CPListenPortDefault = 8085 // CPKubeConfigDefault is the default value for KubeConfig CPKubeConfigDefault = "" // CPManagedClusterConfigLocationDefault is the default value for ManagedClusterConfigLocation CPManagedClusterConfigLocationDefault = "config/kind.yml" // CPKubeConfigLocationDefault is the default value for ControlPlaneKubeConfigLocation CPKubeConfigLocationDefault = "/tmp/apate/config" // CPExternalIPDefault is the default for ControlPlaneExternalIP CPExternalIPDefault = "auto" // CPDockerPolicyDefault is the default for ControlPlaneDockerPolicy CPDockerPolicyDefault = DefaultPullPolicy // CPApateletRunTypeDefault is the default for ControlPlaneApateletRunType CPApateletRunTypeDefault = Routine // CPPrometheusEnabledDefault is the default for PrometheusEnabled CPPrometheusEnabledDefault = true // CPPrometheusNamespace is the default for PrometheusNamespace CPPrometheusNamespace = "apate-prometheus" // CPPrometheusConfigLocation is the default for PrometheusConfigLocation CPPrometheusConfigLocation = "config/prometheus.yml" // CPNodeCRDLocationDefault CRD default location CPNodeCRDLocationDefault = "config/crd/apate.opendc.org_nodeconfigurations.yaml" // CPPodCRDLocationDefault CRD default location CPPodCRDLocationDefault = "config/crd/apate.opendc.org_podconfigurations.yaml" // CPKinDClusterNameDefault default cluster name CPKinDClusterNameDefault = "apate" // CPUseKinDInternalConfig default for UseDockerHostname CPUseDockerHostnameDefault = false // CPDebugEnabledDefault default for DebugEnabled CPDebugEnabledDefault = false )
Control plane environment variables
const ( // General apate docker constant ApateDocker = "apatekubernetes" // Apatelet docker constants ApateletContainerPrefix = "apatelet-" ApateletImageName = "apatelet:latest" ApateletFullImage = ApateDocker + "/" + ApateletImageName // Docker docker constants ControlPlaneContainerName = "apate-cp" ControlPlaneImageName = "controlplane:latest" ControlPlaneFullImage = ApateDocker + "/" + ControlPlaneImageName )
Docker constants
Variables ¶
This section is empty.
Functions ¶
func DumpAsKeyValue ¶
DumpAsKeyValue makes a key=value string array from an environment
func SetEnv ¶
func SetEnv(environment ControlPlaneEnvironment)
SetEnv overrides the current environment for the control plane We preferred this over providing a pointer in the getter to avoid accidental overrides
Types ¶
type ApateletEnvironment ¶
type ApateletEnvironment struct { // ListenAddress is the address the apatelet will listen on for requests ListenAddress string `env:"APATELET_LISTEN_ADDRESS"` // ListenPort is the port the apatelet will listen on for gRPC requests ListenPort int `env:"APATELET_LISTEN_PORT"` // MetricsPort is the port the apatelet will serve metrics on MetricsPort int `env:"APATELET_METRICS_PORT"` // KubernetesPort is the port the apatelet will create Kubernetes endpoints on KubernetesPort int `env:"APATELET_KUBERNETES_PORT"` // KubeConfigLocation is the path to the kube config KubeConfigLocation string `env:"APATELET_KUBE_CONFIG"` // CIKubernetesAddress is to add an entry to the /etc/hosts file of an apatelet to ensure it can find the k8s cluster // this can be used to fix bugs when running apate in a DinD CIKubernetesAddress string `env:"CI_APATELET_K8S_ADDRESS"` // ControlPlaneAddress is the address of the control plane which will be used to connect to ControlPlaneAddress string `env:"APATELET_CP_ADDRESS"` // ControlPlanePort is the port of the control plane ControlPlanePort int `env:"APATELET_CP_PORT"` // DisableTaints determines whether to disable taints on this node or not DisableTaints bool `env:"APATELET_DISABLE_TAINTS"` // DebugEnabled determines if extra messages and profiling tools should be enabled DebugEnabled bool `env:"APATELET_ENABLE_DEBUG"` }
ApateletEnvironment represents the environment variables of the apatelet
func ApateletEnv ¶
func ApateletEnv() (ApateletEnvironment, error)
ApateletEnv builds an ApateletEnvironment based on the actual environment
func (*ApateletEnvironment) AddConnectionInfo ¶
func (env *ApateletEnvironment) AddConnectionInfo(address string, port int)
AddConnectionInfo adds the given connection information to the environment
type ControlPlaneEnvironment ¶
type ControlPlaneEnvironment struct { // ListenAddress is the address the control plane will listen on ListenAddress string `env:"CP_LISTEN_ADDRESS"` // ListenPort is the port the control plane will listen on ListenPort int `env:"CP_LISTEN_PORT"` // ExternalIP can be used to override the IP the control plane will give to apatelets to connect to ExternalIP string `env:"CP_EXTERNAL_IP"` // ManagerConfigLocation is the path to the config of the cluster manager, if applicable ManagerConfigLocation string `env:"CP_MANAGER_CONFIG_LOCATION"` // KubeConfig is the initial kubeconfig. // When this is set, the managed cluster is disabled KubeConfig string `env:"CP_KUBE_CONFIG"` // KubeConfigLocation is the path to the kube config KubeConfigLocation string `env:"CP_KUBE_CONFIG_LOCATION"` // DockerPolicy specifies the docker pull policy for apatelet images DockerPolicy PullPolicy `env:"CP_DOCKER_POLICY"` // ApateletRunType specifies how the control plane runs new apatelets ApateletRunType RunType `env:"CP_APATELET_RUN_TYPE"` // PrometheusEnabled specifies if the control plane should create a prometheus stack on startup PrometheusEnabled bool `env:"CP_PROMETHEUS"` // PrometheusNamespace specifies the namespace the prom PrometheusNamespace string `env:"CP_PROMETHEUS_NAMESPACE"` // PrometheusConfigLocation is the path to the config of the prometheus helm chart, if applicable PrometheusConfigLocation string `env:"CP_PROMETHEUS_CONFIG_LOCATION"` // CRD Locations PodCRDLocation string `env:"CP_POD_CRD_LOCATION"` NodeCRDLocation string `env:"CP_NODE_CRD_LOCATION"` // (KinD) Cluster Name KinDClusterName string `env:"CP_KIND_CLUSTER_NAME"` // UseDockerHostname specifies if we should rewrite the KinD address to 'docker' UseDockerHostname bool `env:"CP_DOCKER_HOSTNAME"` // DebugEnabled determines if extra messages and profiling tools should be enabled DebugEnabled bool `env:"CP_ENABLE_DEBUG"` }
ControlPlaneEnvironment represents the environment variables of the control plane
func ControlPlaneEnv ¶
func ControlPlaneEnv() ControlPlaneEnvironment
ControlPlaneEnv builds and ControlPlaneEnvironment based on the actual environment
func DefaultControlPlaneEnvironment ¶
func DefaultControlPlaneEnvironment() ControlPlaneEnvironment
DefaultControlPlaneEnvironment returns the default control plane environment
type PullPolicy ¶
type PullPolicy string
PullPolicy defines the pull policy used for
const ( // DefaultPullPolicy returns the default pull policy DefaultPullPolicy = PullIfNotLocal // AlwaysPull will always pull the image, even if it's already locally available AlwaysPull PullPolicy = "pull-always" // AlwaysLocal will always use the local image, and will not pull if it's not locally available AlwaysLocal PullPolicy = "local-always" // PullIfNotLocal will only pull if the image is not locally available, this will not check // if the local image is possibly outdated PullIfNotLocal PullPolicy = "pull-if-not-local" )
func (PullPolicy) Valid ¶
func (p PullPolicy) Valid() bool
Valid returns true if the pull policy is valid