Merge pull request #101946 from chendave/balance_allocation

Support extended resource in NodeResourcesBalancedAllocation plugin
This commit is contained in:
Kubernetes Prow Robot
2021-07-06 10:42:19 -07:00
committed by GitHub
27 changed files with 814 additions and 74 deletions

View File

@@ -87,6 +87,19 @@ profiles:
resources:
- name: memory
weight: 1
- name: NodeResourcesBalancedAllocation
args:
resources:
- name: cpu # default weight(1) will be set.
- name: memory # weight 0 will be replaced by 1.
weight: 0
- name: scalar0
weight: 1
- name: scalar1 # default weight(1) will be set for scalar1
- name: scalar2 # weight 0 will be replaced by 1.
weight: 0
- name: scalar3
weight: 2
- name: VolumeBinding
args:
bindTimeoutSeconds: 300
@@ -164,6 +177,18 @@ profiles:
Resources: []config.ResourceSpec{{Name: "memory", Weight: 1}},
},
},
{
Name: "NodeResourcesBalancedAllocation",
Args: &config.NodeResourcesBalancedAllocationArgs{
Resources: []config.ResourceSpec{
{Name: "cpu", Weight: 1},
{Name: "memory", Weight: 1},
{Name: "scalar0", Weight: 1},
{Name: "scalar1", Weight: 1},
{Name: "scalar2", Weight: 1},
{Name: "scalar3", Weight: 2}},
},
},
{
Name: "VolumeBinding",
Args: &config.VolumeBindingArgs{
@@ -312,6 +337,8 @@ profiles:
args:
- name: NodeResourcesMostAllocated
args:
- name: NodeResourcesBalancedAllocation
args:
- name: VolumeBinding
args:
- name: PodTopologySpread
@@ -357,6 +384,12 @@ profiles:
Resources: []config.ResourceSpec{{Name: "cpu", Weight: 1}, {Name: "memory", Weight: 1}},
},
},
{
Name: "NodeResourcesBalancedAllocation",
Args: &config.NodeResourcesBalancedAllocationArgs{
Resources: []config.ResourceSpec{{Name: "cpu", Weight: 1}, {Name: "memory", Weight: 1}},
},
},
{
Name: "VolumeBinding",
Args: &config.VolumeBindingArgs{
@@ -413,6 +446,19 @@ profiles:
- key: foo
operator: In
values: ["bar"]
- name: NodeResourcesBalancedAllocation
args:
resources:
- name: cpu # default weight(1) will be set.
- name: memory # weight 0 will be replaced by 1.
weight: 0
- name: scalar0
weight: 1
- name: scalar1 # default weight(1) will be set for scalar1
- name: scalar2 # weight 0 will be replaced by 1.
weight: 0
- name: scalar3
weight: 2
`),
wantProfiles: []config.KubeSchedulerProfile{
{
@@ -475,6 +521,18 @@ profiles:
},
},
},
{
Name: "NodeResourcesBalancedAllocation",
Args: &config.NodeResourcesBalancedAllocationArgs{
Resources: []config.ResourceSpec{
{Name: "cpu", Weight: 1},
{Name: "memory", Weight: 1},
{Name: "scalar0", Weight: 1},
{Name: "scalar1", Weight: 1},
{Name: "scalar2", Weight: 1},
{Name: "scalar3", Weight: 2}},
},
},
},
},
},
@@ -511,6 +569,12 @@ profiles:
Name: "NodeAffinity",
Args: &config.NodeAffinityArgs{},
},
{
Name: "NodeResourcesBalancedAllocation",
Args: &config.NodeResourcesBalancedAllocationArgs{
Resources: []config.ResourceSpec{{Name: "cpu", Weight: 1}, {Name: "memory", Weight: 1}},
},
},
{
Name: "NodeResourcesFit",
Args: &config.NodeResourcesFitArgs{
@@ -631,6 +695,7 @@ profiles:
args:
- name: PodTopologySpread
- name: NodeAffinity
- name: NodeResourcesBalancedAllocation
`),
wantProfiles: []config.KubeSchedulerProfile{
{
@@ -676,6 +741,12 @@ profiles:
Name: "NodeAffinity",
Args: &config.NodeAffinityArgs{},
},
{
Name: "NodeResourcesBalancedAllocation",
Args: &config.NodeResourcesBalancedAllocationArgs{
Resources: []config.ResourceSpec{{Name: "cpu", Weight: 1}, {Name: "memory", Weight: 1}},
},
},
},
},
},
@@ -769,6 +840,16 @@ func TestCodecsEncodePluginConfig(t *testing.T) {
},
},
},
{
Name: "NodeResourcesBalancedAllocation",
Args: runtime.RawExtension{
Object: &v1beta1.NodeResourcesBalancedAllocationArgs{
Resources: []v1beta1.ResourceSpec{
{Name: "mem", Weight: 1},
},
},
},
},
{
Name: "PodTopologySpread",
Args: runtime.RawExtension{
@@ -837,6 +918,13 @@ profiles:
- name: mem
weight: 2
name: NodeResourcesLeastAllocated
- args:
apiVersion: kubescheduler.config.k8s.io/v1beta1
kind: NodeResourcesBalancedAllocationArgs
resources:
- name: mem
weight: 1
name: NodeResourcesBalancedAllocation
- args:
apiVersion: kubescheduler.config.k8s.io/v1beta1
kind: PodTopologySpreadArgs