mirror of https://github.com/kubernetes/kops.git
Use instance requirements to get a wider set of instance types by default
This commit is contained in:
parent
abcab2b327
commit
655d63cec1
|
|
@ -110,6 +110,12 @@ spec:
|
|||
manager: Karpenter
|
||||
maxSize: 2
|
||||
minSize: 2
|
||||
mixedInstancesPolicy:
|
||||
instanceRequirements:
|
||||
cpu:
|
||||
min: "2"
|
||||
memory:
|
||||
min: 2G
|
||||
nodeLabels:
|
||||
kops.k8s.io/instancegroup: nodes
|
||||
role: Node
|
||||
|
|
|
|||
|
|
@ -876,6 +876,24 @@ func setupKarpenterNodes(opt *NewClusterOptions, cluster *api.Cluster, zoneToSub
|
|||
HTTPTokens: fi.String("required"),
|
||||
}
|
||||
|
||||
// Karpenter thinks all clusters run VPC CNI and schedules thinking Node Capacity is constrainted by number of ENIs.
|
||||
|
||||
// cpuMin is the reasonable lower limit for a Kubernetes Node
|
||||
// Generally, it also avoids instances Karpenter thinks it can only schedule 4 Pods on.
|
||||
cpuMin := resource.MustParse("2")
|
||||
memoryMin := resource.MustParse(("2G"))
|
||||
|
||||
g.Spec.MixedInstancesPolicy = &api.MixedInstancesPolicySpec{
|
||||
InstanceRequirements: &api.InstanceRequirementsSpec{
|
||||
CPU: &api.MinMaxSpec{
|
||||
Min: &cpuMin,
|
||||
},
|
||||
Memory: &api.MinMaxSpec{
|
||||
Min: &memoryMin,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return []*api.InstanceGroup{g}, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -822,6 +822,13 @@ func karpenterInstanceTypes(cloud awsup.AWSCloud, ig kops.InstanceGroupSpec) ([]
|
|||
ir := &ec2.InstanceRequirementsRequest{
|
||||
VCpuCount: &ec2.VCpuCountRangeRequest{},
|
||||
MemoryMiB: &ec2.MemoryMiBRequest{},
|
||||
BurstablePerformance: fi.String("included"),
|
||||
}
|
||||
cpu := instanceRequirements.CPU
|
||||
if cpu != nil {
|
||||
if cpu.Max != nil {
|
||||
cpuMax, _ := instanceRequirements.CPU.Max.AsInt64()
|
||||
ir.VCpuCount.Max = &cpuMax
|
||||
}
|
||||
cpu := instanceRequirements.CPU
|
||||
if cpu != nil {
|
||||
|
|
@ -876,5 +883,6 @@ func karpenterInstanceTypes(cloud awsup.AWSCloud, ig kops.InstanceGroupSpec) ([]
|
|||
return types, nil
|
||||
}
|
||||
}
|
||||
}
|
||||
return []string{ig.MachineType}, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue