Documentation ¶
Index ¶
- Constants
- Variables
- func LoadResourceConfig() map[string]ResourceConfig
- func LoadResourceConfigFromConfigMap(log logr.Logger, vpcCniConfigMap *v1.ConfigMap) map[string]ResourceConfig
- func ParseWinIPTargetConfigs(log logr.Logger, vpcCniConfigMap *v1.ConfigMap) (warmIPTarget int, minIPTarget int, warmPrefixTarget int, isPDEnabled bool)
- type IPResourceCount
- type ResourceConfig
- type ResourceType
- type WarmPoolConfig
Constants ¶
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 = 8 // EC2 API QPS for instance service client InstanceServiceClientQPS = 5 InstanceServiceClientBurst = 7 // API Server QPS DefaultAPIServerQPS = 10 DefaultAPIServerBurst = 15 )
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
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
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
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" )
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
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 ¶
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 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
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