mirror of https://github.com/kubernetes/kops.git
Calculate max pods based on Amazon VPC CNI plugin library
This commit is contained in:
parent
cd63aa5429
commit
c2d82abd88
|
@ -7,6 +7,7 @@ go_library(
|
||||||
visibility = ["//visibility:private"],
|
visibility = ["//visibility:private"],
|
||||||
deps = [
|
deps = [
|
||||||
"//upup/pkg/fi/cloudup/awsup:go_default_library",
|
"//upup/pkg/fi/cloudup/awsup:go_default_library",
|
||||||
|
"//vendor/github.com/aws/amazon-vpc-cni-k8s/pkg/awsutils:go_default_library",
|
||||||
"//vendor/github.com/aws/aws-sdk-go/aws:go_default_library",
|
"//vendor/github.com/aws/aws-sdk-go/aws:go_default_library",
|
||||||
"//vendor/github.com/aws/aws-sdk-go/aws/awserr:go_default_library",
|
"//vendor/github.com/aws/aws-sdk-go/aws/awserr:go_default_library",
|
||||||
"//vendor/github.com/aws/aws-sdk-go/aws/session:go_default_library",
|
"//vendor/github.com/aws/aws-sdk-go/aws/session:go_default_library",
|
||||||
|
|
|
@ -27,6 +27,7 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/aws/amazon-vpc-cni-k8s/pkg/awsutils"
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
"github.com/aws/aws-sdk-go/aws/awserr"
|
"github.com/aws/aws-sdk-go/aws/awserr"
|
||||||
"github.com/aws/aws-sdk-go/aws/session"
|
"github.com/aws/aws-sdk-go/aws/session"
|
||||||
|
@ -195,6 +196,14 @@ func run() error {
|
||||||
machine.ECU = stringToFloat32(attributes["ecu"])
|
machine.ECU = stringToFloat32(attributes["ecu"])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AWS VPC CNI plugin-specific maximum pod calculation based on:
|
||||||
|
// https://github.com/aws/amazon-vpc-cni-k8s/blob/f52ad45/README.md
|
||||||
|
enisPerInstance, enisOK := awsutils.InstanceENIsAvailable[attributes["instanceType"]]
|
||||||
|
ipsPerENI, ipsOK := awsutils.InstanceIPsAvailable[attributes["instanceType"]]
|
||||||
|
if enisOK && ipsOK {
|
||||||
|
machine.MaxPods = enisPerInstance*(int(ipsPerENI)-1) + 2
|
||||||
|
}
|
||||||
|
|
||||||
machines = append(machines, machine)
|
machines = append(machines, machine)
|
||||||
|
|
||||||
family := strings.Split(attributes["instanceType"], ".")[0]
|
family := strings.Split(attributes["instanceType"], ".")[0]
|
||||||
|
@ -254,7 +263,8 @@ func run() error {
|
||||||
MemoryGB: %v,
|
MemoryGB: %v,
|
||||||
ECU: %v,
|
ECU: %v,
|
||||||
Cores: %v,
|
Cores: %v,
|
||||||
`, m.Name, m.MemoryGB, ecu, m.Cores)
|
MaxPods: %v,
|
||||||
|
`, m.Name, m.MemoryGB, ecu, m.Cores, m.MaxPods)
|
||||||
output = output + body
|
output = output + body
|
||||||
|
|
||||||
// Avoid awkward []int(nil) syntax
|
// Avoid awkward []int(nil) syntax
|
||||||
|
|
|
@ -33,6 +33,7 @@ type AWSMachineTypeInfo struct {
|
||||||
EphemeralDisks []int
|
EphemeralDisks []int
|
||||||
Burstable bool
|
Burstable bool
|
||||||
GPU bool
|
GPU bool
|
||||||
|
MaxPods int
|
||||||
}
|
}
|
||||||
|
|
||||||
type EphemeralDevice struct {
|
type EphemeralDevice struct {
|
||||||
|
|
Loading…
Reference in New Issue