config

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2023 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 = 20

	// Default Configuration for IPv4 resource type
	IPv4DefaultWorker  = 2
	IPv4DefaultWPSize  = 3
	IPv4DefaultMaxDev  = 1
	IPv4DefaultResSize = 0

	// Default 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
)
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"
	WarmPrefixTarget                 = "warm-prefix-target"
	WarmIPTarget                     = "warm-ip-target"
	MinimumIPTarget                  = "minimum-ip-target"
	// Since LeaderElectionNamespace and VpcCniConfigMapName may be different in the future
	KubeSystemNamespace            = "kube-system"
	VpcCNIDaemonSetName            = "aws-node"
	OldVPCControllerDeploymentName = "vpc-resource-controller"
)
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 ParseWinPDTargets added in v1.1.8

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

ParseWinPDTargets parses config map for Windows prefix delegation configurations set by users

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 {
	// 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