configuration

package
v1.8.7 Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 11 Imported by: 1

Documentation

Overview

Copyright Microsoft. All rights reserved.

Index

Constants

View Source
const (
	// EnvNodeName is the NODENAME env var string key.
	EnvNodeName = "NODENAME"
	// EnvNodeIP is the IP of the node running this CNS binary
	EnvNodeIP = "NODE_IP"
	// LabelNodeSwiftV2 is the Node label for Swift V2
	LabelNodeSwiftV2 = "kubernetes.azure.com/podnetwork-multi-tenancy-enabled"
	// LabelPodSwiftV2 is the Pod label for Swift V2
	LabelPodSwiftV2                = "kubernetes.azure.com/pod-network"
	LabelPodNetworkInstanceSwiftV2 = "kubernetes.azure.com/pod-network-instance"
	EnvPodCIDRs                    = "POD_CIDRs"
	EnvServiceCIDRs                = "SERVICE_CIDRs"
	EnvInfraVNETCIDRs              = "INFRA_VNET_CIDRs"
)
View Source
const (
	// EnvCNSConfig is the CNS_CONFIGURATION_PATH env var key
	EnvCNSConfig = "CNS_CONFIGURATION_PATH"
)

Variables

View Source
var ErrInfraVNETCIDRsUnset = errors.Errorf("must declare %s environment variable", EnvInfraVNETCIDRs)

ErrInfraVNETCIDRsUnset indicates the the $EnvInfraVNETCIDRs variable is unset in the environment.

View Source
var ErrNodeNameUnset = errors.Errorf("must declare %s environment variable", EnvNodeName)

ErrNodeNameUnset indicates the the $EnvNodeName variable is unset in the environment.

View Source
var ErrPodCIDRsUnset = errors.Errorf("must declare %s environment variable", EnvPodCIDRs)

ErrPodCIDRsUnset indicates the the $EnvPodCIDRs variable is unset in the environment.

View Source
var ErrServiceCIDRsUnset = errors.Errorf("must declare %s environment variable", EnvServiceCIDRs)

ErrServiceCIDRsUnset indicates the the $EnvServiceCIDRs variable is unset in the environment.

Functions

func InfraVNETCIDRs

func InfraVNETCIDRs() (string, error)

func NodeIP

func NodeIP() string

NodeIP returns the value of the NODE_IP environment variable, or empty string if unset.

func NodeName

func NodeName() (string, error)

NodeName checks the environment variables for the NODENAME and returns it or an error if unset.

func PodCIDRs

func PodCIDRs() (string, error)

func ServiceCIDRs

func ServiceCIDRs() (string, error)

func SetCNSConfigDefaults

func SetCNSConfigDefaults(config *CNSConfig)

SetCNSConfigDefaults set default values of CNS config if not specified

Types

type AZRSettings

type AZRSettings struct {
	PopulateHomeAzCacheRetryIntervalSecs int
}

type CNSConfig

type CNSConfig struct {
	AZRSettings                     AZRSettings
	AsyncPodDeletePath              string
	CNIConflistFilepath             string
	CNIConflistScenario             string
	ChannelMode                     string
	EnableAPIServerHealthPing       bool
	EnableAsyncPodDelete            bool
	EnableCNIConflistGeneration     bool
	EnableIPAMv2                    bool
	EnableK8sDevicePlugin           bool
	EnableLoggerV2                  bool
	EnablePprof                     bool
	EnableStateMigration            bool
	EnableSubnetScarcity            bool
	EnableStaleHNSCleanupOnNCCreate bool
	EnableSwiftV1DualStack          bool
	EnableSwiftV2                   bool
	IPv6PrefixClamp                 int
	InitializeFromCNI               bool
	KeyVaultSettings                KeyVaultSettings
	Logger                          loggerv2.Config
	MSISettings                     MSISettings
	ManageEndpointState             bool
	ManagedSettings                 ManagedSettings
	MellanoxMonitorIntervalSecs     int
	MetricsBindAddress              string
	ProgramSNATIPTables             bool
	SyncHostNCTimeoutMs             int
	SyncHostNCVersionIntervalMs     int
	TLSCertificatePath              string
	TLSEndpoint                     string
	TLSPort                         string
	TLSSubjectName                  string
	TelemetrySettings               TelemetrySettings
	UseHTTPS                        bool
	UseMTLS                         bool
	WatchPods                       bool `json:"-"`
	WireserverIP                    string
	GRPCSettings                    GRPCSettings
	MinTLSVersion                   string
	MtlsClientCertSubjectName       string
}

func ReadConfig

func ReadConfig(cmdLineConfigPath string) (*CNSConfig, error)

ReadConfig returns a CNS config from file or an error.

func (*CNSConfig) IsStalessCNIWindows

func (cnsconfig *CNSConfig) IsStalessCNIWindows() bool

isStalessCNIMode verify if the CNI is running stateless mode

type GRPCSettings

type GRPCSettings struct {
	Enable    bool
	IPAddress string
	Port      uint16
}

type KeyVaultSettings

type KeyVaultSettings struct {
	URL                  string
	CertificateName      string
	RefreshIntervalInHrs int
}

type MSISettings

type MSISettings struct {
	ResourceID string
}

type ManagedSettings

type ManagedSettings struct {
	PrivateEndpoint           string
	InfrastructureNetworkID   string
	NodeID                    string
	NodeSyncIntervalInSeconds int
}

type TelemetrySettings

type TelemetrySettings struct {
	// Flag to disable the telemetry.
	DisableAll bool
	// Flag to Disable sending trace.
	DisableTrace bool
	// Flag to Disable sending metric.
	DisableMetric bool
	// Flag to Disable sending events.
	DisableEvent bool
	// Configure how many bytes can be sent in one call to the data collector
	TelemetryBatchSizeBytes int
	// Configure the maximum delay before sending queued telemetry in milliseconds
	TelemetryBatchIntervalInSecs int
	// Heartbeat interval for sending heartbeat metric
	HeartBeatIntervalInMins int
	// Enable thread for getting metadata from wireserver
	DisableMetadataRefreshThread bool
	// Refresh interval in milliseconds for metadata thread
	RefreshIntervalInSecs int
	// Disable debug logging for telemetry messages
	DebugMode bool
	// Interval for sending snapshot events.
	SnapshotIntervalInMins int
	// Interval for sending config snapshot events.
	ConfigSnapshotIntervalInMins int
	// AppInsightsInstrumentationKey allows the user to override the default appinsights ikey
	AppInsightsInstrumentationKey string
}

Jump to

Keyboard shortcuts

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