config

package
v1.6.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// TODO: Should we always do this max retry no matter why it fails
	// such deleted pods will also be retried 5 times, which could be an issue for large pods loads and high churning rate.
	WorkQueueDefaultMaxRetries = 5

	// Default Configuration for Pod ENI resource type
	PodENIDefaultWorker = 30

	// Default Windows Configuration for IPv4 resource type
	IPv4DefaultWinWorkerCount  = 2
	IPv4DefaultWinWarmIPTarget = 3
	IPv4DefaultWinMinIPTarget  = 3
	IPv4DefaultWinMaxDev       = 0
	IPv4DefaultWinResSize      = 0

	// Default Windows Configuration for IPv4 prefix resource type
	IPv4PDDefaultWorker               = 2
	IPv4PDDefaultWPSize               = 1
	IPv4PDDefaultMaxDev               = 0
	IPv4PDDefaultResSize              = 0
	IPv4PDDefaultWarmIPTargetSize     = 1
	IPv4PDDefaultMinIPTargetSize      = 3
	IPv4PDDefaultWarmPrefixTargetSize = 0

	// EC2 API QPS for user service client
	// Tested: 15 + 20 limits
	// Tested: 15 + 8 limits (not seeing significant degradation from 15+20)
	// Tested: 12 + 8 limits (not seeing significant degradation from 15+8)
	// Larger number seems not make latency better than 12+8
	UserServiceClientQPS      = 12
	UserServiceClientQPSBurst = 18

	// EC2 API QPS for instance service client
	InstanceServiceClientQPS   = 12
	InstanceServiceClientBurst = 18

	// API Server QPS
	// Use the same values as default client (https://github.com/kubernetes-sigs/controller-runtime/blob/main/pkg/client/config/config.go#L85)
	DefaultAPIServerQPS   = 20
	DefaultAPIServerBurst = 30
)
View Source
const (
	// VPCResourcePrefix is the common prefix for all VPC extended resources
	VPCResourcePrefix = "vpc.amazonaws.com/"
	// ResourceNamePodENI is the extended resource name for Branch ENIs
	ResourceNamePodENI = VPCResourcePrefix + "pod-eni"
	// ResourceNameIPAddress is the extended resource name for private IP addresses
	ResourceNameIPAddress = VPCResourcePrefix + "PrivateIPv4Address"
	// ResourceNameIPAddressFromPrefix is the resource name for prefix-deconstructed IP addresses, not a pod annotation
	ResourceNameIPAddressFromPrefix = VPCResourcePrefix + "PrivateIPv4AddressFromPrefix"
)

K8s Pod Annotations

View Source
const (
	// ControllerName is the name of the VPC Resource Controller
	ControllerName = "vpc-resource-controller"
	// HasTrunkAttachedLabel is the label denoting that the trunk ENI is attached to node or not
	HasTrunkAttachedLabel = "vpc.amazonaws.com/has-trunk-attached"
	// CustomNetworkingLabel is the label with the name of ENIConfig to be used by the node for custom networking
	CustomNetworkingLabel = "vpc.amazonaws.com/eniConfig"
	// Trunk attaching status value
	BooleanTrue         = "true"
	BooleanFalse        = "false"
	NotSupportedEc2Type = "not-supported"
	// NodeLabelOS is the Kubernetes Operating System label
	NodeLabelOS = "kubernetes.io/os"
	// NodeLabelOS is the Kubernetes Operating System label used before k8s version 1.16
	NodeLabelOSBeta = "beta.kubernetes.io/os"
	// OSWindows is the the windows Operating System
	OSWindows = "windows"
	// OSLinux is the the linux Operating System
	OSLinux = "linux"
)

K8s Labels

View Source
const (
	ControllerTagPrefix = "vpcresources.k8s.aws/"
	VLandIDTag          = ControllerTagPrefix + "vlan-id"
	TrunkENIIDTag       = ControllerTagPrefix + "trunk-eni-id"

	ClusterNameTagKeyFormat = "kubernetes.io/cluster/%s"
	ClusterNameTagValue     = "owned"

	NetworkInterfaceOwnerTagKey         = "eks:eni:owner"
	NetworkInterfaceOwnerTagValue       = "eks-vpc-resource-controller"
	NetworkInterfaceOwnerVPCCNITagValue = "amazon-vpc-cni"
)

EC2 Tags

View Source
const (
	LeaderElectionKey                = "cp-vpc-resource-controller"
	LeaderElectionNamespace          = "kube-system"
	VpcCniConfigMapName              = "amazon-vpc-cni"
	EnableWindowsIPAMKey             = "enable-windows-ipam"
	EnableWindowsPrefixDelegationKey = "enable-windows-prefix-delegation"
	// TODO: we will deprecate the confusing naming of Windows flags eventually
	WarmPrefixTarget = "warm-prefix-target"
	WarmIPTarget     = "warm-ip-target"
	MinimumIPTarget  = "minimum-ip-target"
	// these windows prefixed flags will be used for Windows support only eventully
	WinWarmPrefixTarget = "windows-warm-prefix-target"
	WinWarmIPTarget     = "windows-warm-ip-target"
	WinMinimumIPTarget  = "windows-minimum-ip-target"
	// Since LeaderElectionNamespace and VpcCniConfigMapName may be different in the future
	KubeSystemNamespace            = "kube-system"
	VpcCNIDaemonSetName            = "aws-node"
	OldVPCControllerDeploymentName = "vpc-resource-controller"
	BranchENICooldownPeriodKey     = "branch-eni-cooldown"
)
View Source
const (
	VpcCNINodeEventReason             = "AwsNodeNotificationToRc"
	VpcCNIReportingAgent              = "aws-node"
	VpcCNINodeEventActionForTrunk     = "NeedTrunk"
	VpcCNINodeEventActionForEniConfig = "NeedEniConfig"
	TrunkNotAttached                  = "vpc.amazonaws.com/has-trunk-attached=false"
	TrunkAttached                     = "vpc.amazonaws.com/has-trunk-attached=true"
)

Events metadata They are used to identify valid events emitted from authorized agents

View Source
const (
	InstancesCacheTTL     = 30 * time.Minute // scaling < 1k nodes should be under 20 minutes
	InstancesCacheShards  = 32               // must be power of 2
	InstancesCacheMaxSize = 2                // in MB
)

customized configurations for BigCache

Variables

View Source
var (
	// CoolDownPeriod is the time to let kube-proxy propagates IP tables rules before assigning the resource back to new pod
	CoolDownPeriod = time.Second * 30
	// ENICleanUpInterval is the time interval between each dangling ENI clean up task
	ENICleanUpInterval = time.Minute * 30
)

Functions

func LoadResourceConfig

func LoadResourceConfig() map[string]ResourceConfig

LoadResourceConfig returns the Resource Configuration for all resources managed by the VPC Resource Controller. Currently returns the default resource configuration and later can return the configuration from a ConfigMap.

func LoadResourceConfigFromConfigMap added in v1.1.8

func LoadResourceConfigFromConfigMap(log logr.Logger, vpcCniConfigMap *v1.ConfigMap) map[string]ResourceConfig

func ParseWinIPTargetConfigs added in v1.6.0

func ParseWinIPTargetConfigs(log logr.Logger, vpcCniConfigMap *v1.ConfigMap) (warmIPTarget int, minIPTarget int, warmPrefixTarget int, isPDEnabled bool)

ParseWinIPTargetConfigs parses Windows IP target configuration parameters in the amazon-vpc-cni ConfigMap If all three config parameter values (warm-ip-target, min-ip-target, warm-prefix-target) are 0 or unset, or config map does not exist, then default values for warm-ip-target and min-ip-target will be set.

Types

type IPResourceCount added in v1.1.8

type IPResourceCount struct {
	SecondaryIPv4Count int
	IPv4PrefixCount    int
}

IPResourceCount contains the arguments for number of IPv4 resources to request

type ResourceConfig

type ResourceConfig struct {
	// Name is the unique name of the resource
	Name string
	// WorkerCount is the number of routines that will process items for the buffer
	WorkerCount int
	// SupportedOS is the map of operating system that supports the resource
	SupportedOS map[string]bool
	// WarmPoolConfig represents the configuration of warm pool for resources that support warm resources. Optional
	WarmPoolConfig *WarmPoolConfig
}

ResourceConfig is the configuration for each resource type

type ResourceType added in v1.1.8

type ResourceType string
const (
	ResourceTypeIPv4Address ResourceType = "IPv4Address"
	ResourceTypeIPv4Prefix  ResourceType = "IPv4Prefix"
)

type WarmPoolConfig

type WarmPoolConfig struct {
	// TODO: Deprecate DesiredSize in favour of using WarmIPTarget since historically they served the same purpose
	// Number of resources to keep in warm pool per node; for prefix IP pool, this is used to check if pool is active
	DesiredSize int
	// Number of resources not to use in the warm pool
	ReservedSize int
	// The maximum number by which the warm pool can deviate from the desired size
	MaxDeviation int
	// The number of IPs to be available in prefix IP pool
	WarmIPTarget int
	// The floor of number of IPs to be stored in prefix IP pool
	MinIPTarget int
	// The number of prefixes to be available in prefix IP pool
	WarmPrefixTarget int
}

WarmPoolConfig is the configuration of Warm Pool of a resource

Jump to

Keyboard shortcuts

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