Documentation ¶
Overview ¶
Copyright (c) 2024 Tigera, Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
const ( EnvLogLevel = "LOG_LEVEL" EnvReconcilerPeriod = "RECONCILER_PERIOD" EnvEnabledControllers = "ENABLED_CONTROLLERS" EnvCompactionPeriod = "COMPACTION_PERIOD" EnvHealthEnabled = "HEALTH_ENABLED" EnvSyncNodeLabels = "SYNC_NODE_LABELS" EnvAutoHostEndpoints = "AUTO_HOST_ENDPOINTS" )
Variables ¶
var AllEnvs = []string{EnvLogLevel, EnvReconcilerPeriod, EnvEnabledControllers, EnvCompactionPeriod, EnvHealthEnabled, EnvSyncNodeLabels, EnvAutoHostEndpoints}
var DefaultKCC *v3.KubeControllersConfiguration
Export for testing purposes
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Minimum log level to emit. LogLevel string `default:"info" split_words:"true"` // Number of workers to run for each controller. WorkloadEndpointWorkers int `default:"1" split_words:"true"` ProfileWorkers int `default:"1" split_words:"true"` PolicyWorkers int `default:"1" split_words:"true"` NodeWorkers int `default:"1" split_words:"true"` // Path to a kubeconfig file to use for accessing the k8s API. Kubeconfig string `default:"" split_words:"false"` // etcdv3 or kubernetes DatastoreType string `default:"etcdv3" split_words:"true"` }
Config represents the configuration we load from the environment variables
type ControllersConfig ¶
type ControllersConfig struct { Node *NodeControllerConfig Policy *GenericControllerConfig WorkloadEndpoint *GenericControllerConfig ServiceAccount *GenericControllerConfig Namespace *GenericControllerConfig LoadBalancer *LoadBalancerControllerConfig }
type GenericControllerConfig ¶
type NodeControllerConfig ¶
type NodeControllerConfig struct { SyncLabels bool AutoHostEndpoints bool // Should the Node controller delete Calico nodes? Generally, this is // true for etcdv3 datastores. DeleteNodes bool // The grace period used by the controller to determine if an IP address is leaked. // Set to 0 to disable IP address garbage collection. LeakGracePeriod *v1.Duration }
type RunConfig ¶
type RunConfig struct { LogLevelScreen log.Level Controllers ControllersConfig EtcdV3CompactionPeriod time.Duration HealthEnabled bool PrometheusPort int DebugProfilePort int32 }
RunConfig represents the configuration for all controllers and includes merged information from environment variables (Config) and the Calico resource KubeControllersConfiguration
type RunConfigController ¶
type RunConfigController struct {
// contains filtered or unexported fields
}
func NewRunConfigController ¶
func NewRunConfigController(ctx context.Context, cfg Config, client clientv3.KubeControllersConfigurationInterface) *RunConfigController
NewRunConfigController creates the RunConfigController. The controller connects to the datastore to get the KubeControllersConfiguration resource, merges it with the config from environment variables, and emits RunConfig objects over a channel to push config out to the rest of the controllers. It also handles setting the KubeControllersConfiguration.Status with the current running configuration
func (*RunConfigController) ConfigChan ¶
func (r *RunConfigController) ConfigChan() <-chan RunConfig
ConfigChan returns a channel that sends an initial config snapshot at start of day, and updates whenever the config changes.