config

package
v1.11.0-cni-plu...-aa3fb74 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2024 License: Apache-2.0, Apache-2.0 Imports: 16 Imported by: 0

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

View Source
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

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

func (*Config) Parse

func (c *Config) Parse() error

Parse parses envconfig and stores in Config struct

type ControllersConfig

type ControllersConfig struct {
	Node             *NodeControllerConfig
	Policy           *GenericControllerConfig
	WorkloadEndpoint *GenericControllerConfig
	ServiceAccount   *GenericControllerConfig
	Namespace        *GenericControllerConfig
	LoadBalancer     *LoadBalancerControllerConfig
}

type GenericControllerConfig

type GenericControllerConfig struct {
	ReconcilerPeriod time.Duration
	NumberOfWorkers  int
}

type LoadBalancerControllerConfig

type LoadBalancerControllerConfig struct {
	// AssignIPs indicates if LoadBalancer controller will auto-assign all ip addresses or only if asked to do so via annotation
	AssignIPs v3.AssignIPs
}

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

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.

Jump to

Keyboard shortcuts

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