Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions controllers/provisioners/eks/eks.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ import (
)

const (
ProvisionerName = "eks"
defaultLaunchConfigurationRetention = 2
OverrideDefaultLabelsAnnotation = "instancemgr.keikoproj.io/default-labels"
IRSAEnabledAnnotation = "instancemgr.keikoproj.io/irsa-enabled"
OsFamilyAnnotation = "instancemgr.keikoproj.io/os-family"
ClusterAutoscalerEnabledAnnotation = "instancemgr.keikoproj.io/cluster-autoscaler-enabled"
CustomNetworkingEnabledAnnotation = "instancemgr.keikoproj.io/custom-networking-enabled"
CustomNetworkingHostPodsAnnotation = "instancemgr.keikoproj.io/custom-networking-host-pods"
ProvisionerName = "eks"
defaultLaunchConfigurationRetention = 2
OverrideDefaultLabelsAnnotation = "instancemgr.keikoproj.io/default-labels"
IRSAEnabledAnnotation = "instancemgr.keikoproj.io/irsa-enabled"
OsFamilyAnnotation = "instancemgr.keikoproj.io/os-family"
ClusterAutoscalerEnabledAnnotation = "instancemgr.keikoproj.io/cluster-autoscaler-enabled"
CustomNetworkingEnabledAnnotation = "instancemgr.keikoproj.io/custom-networking-enabled"
CustomNetworkingHostPodsAnnotation = "instancemgr.keikoproj.io/custom-networking-host-pods"
CustomNetworkingPrefixAssignmentEnabledAnnotation = "instancemgr.keikoproj.io/custom-networking-prefix-assignment-enabled"

OsFamilyWindows = "windows"
OsFamilyBottleRocket = "bottlerocket"
Expand Down
11 changes: 9 additions & 2 deletions controllers/provisioners/eks/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -502,8 +502,15 @@ func (ctx *EksInstanceGroupContext) GetComputedBootstrapOptions() *v1alpha1.Boot
}

instanceTypeNetworkInfo := awsprovider.GetInstanceTypeNetworkInfo(state.GetInstanceTypeInfo(), configuration.InstanceType)
maxPods := (*instanceTypeNetworkInfo.MaximumNetworkInterfaces-1)*
(*instanceTypeNetworkInfo.Ipv4AddressesPerInterface-1) + hostNetworkPods
var prefixAssignmentEnabled = instanceGroup.GetAnnotations()[CustomNetworkingPrefixAssignmentEnabledAnnotation] == "true"
var maxPods int64 = 0
var enis = *instanceTypeNetworkInfo.MaximumNetworkInterfaces-1 //Primary interface is not used for pod networking when custom networking is enabled
if prefixAssignmentEnabled {
var ipsPerDelegatedPrefix int64 = 16 //Prefixes are /28 blocks, which contain 2^4 IPs
maxPods = (enis * ((*instanceTypeNetworkInfo.Ipv4AddressesPerInterface-1) * ipsPerDelegatedPrefix)) + hostNetworkPods
} else {
maxPods = enis * (*instanceTypeNetworkInfo.Ipv4AddressesPerInterface-1) + hostNetworkPods
}
if configuration.BootstrapOptions == nil {
return &v1alpha1.BootstrapOptions{
MaxPods: maxPods,
Expand Down
10 changes: 10 additions & 0 deletions controllers/provisioners/eks/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,16 @@ func TestCustomNetworkingMaxPods(t *testing.T) {
bootstrapOptions: nil,
expectedMaxPods: "--max-pods=20",
},
{
annotations: map[string]string{
ClusterAutoscalerEnabledAnnotation: "true",
CustomNetworkingPrefixAssignmentEnabledAnnotation: "true",
CustomNetworkingHostPodsAnnotation: "2",
CustomNetworkingEnabledAnnotation: "true",
},
bootstrapOptions: nil,
expectedMaxPods: "--max-pods=290",
},
{
annotations: map[string]string{
ClusterAutoscalerEnabledAnnotation: "true",
Expand Down
1 change: 1 addition & 0 deletions docs/EKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -655,4 +655,5 @@ The following operators are supported:
|instancemgr.keikoproj.io/os-family|InstanceGroup|either "windows", "bottlerocket", or "amazonlinux2" (default)|this is required if you are running a windows or bottlerocket based AMI, by default the controller will try to bootstrap an amazonlinux2 AMI|
|instancemgr.keikoproj.io/default-labels|InstanceGroup|comma-seprarated key-value string e.g. "label1=value1,label2=value2"|allows overriding the default node labels added by the controller, by default the role label is added depending on the cluster version|
|instancemgr.keikoproj.io/custom-networking-enabled|InstanceGroup|"true"|setting this annotation to true will automatically calculate the correct setting for max pods and pass it to the kubelet|
|instancemgr.keikoproj.io/custom-networking-prefix-assignment-enabled|InstanceGroup|"true"|setting this annotation to true will change the max pod calculations to reflect the pod density supported by vpc prefix assignment|
|instancemgr.keikoproj.io/custom-networking-host-pods|InstanceGroup|"2"|setting this annotation increases the number of max pods on nodes with custom networking, due to the fact that hostNetwork pods do not use an additional IP address |