mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-26 21:17:23 +00:00
scheduler: max attachable volume predicate should also check stable instance-type label
Signed-off-by: Andrew Sy Kim <kiman@vmware.com>
This commit is contained in:
parent
55e40b8dc1
commit
094b614934
@ -1067,6 +1067,41 @@ func TestMaxVolumeFuncM4(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestMaxVolumeFuncM4WithOnlyStableLabels(t *testing.T) {
|
||||||
|
node := &v1.Node{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: "node-for-m4-instance",
|
||||||
|
Labels: map[string]string{
|
||||||
|
v1.LabelInstanceTypeStable: "m4.2xlarge",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
os.Unsetenv(KubeMaxPDVols)
|
||||||
|
maxVolumeFunc := getMaxVolumeFunc(EBSVolumeFilterType)
|
||||||
|
maxVolume := maxVolumeFunc(node)
|
||||||
|
if maxVolume != volumeutil.DefaultMaxEBSVolumes {
|
||||||
|
t.Errorf("Expected max volume to be %d got %d", volumeutil.DefaultMaxEBSVolumes, maxVolume)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestMaxVolumeFuncM4WithBothBetaAndStableLabels(t *testing.T) {
|
||||||
|
node := &v1.Node{
|
||||||
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
|
Name: "node-for-m4-instance",
|
||||||
|
Labels: map[string]string{
|
||||||
|
v1.LabelInstanceType: "m4.2xlarge",
|
||||||
|
v1.LabelInstanceTypeStable: "m4.2xlarge",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
os.Unsetenv(KubeMaxPDVols)
|
||||||
|
maxVolumeFunc := getMaxVolumeFunc(EBSVolumeFilterType)
|
||||||
|
maxVolume := maxVolumeFunc(node)
|
||||||
|
if maxVolume != volumeutil.DefaultMaxEBSVolumes {
|
||||||
|
t.Errorf("Expected max volume to be %d got %d", volumeutil.DefaultMaxEBSVolumes, maxVolume)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func getNodeWithPodAndVolumeLimits(limitSource string, pods []*v1.Pod, limit int64, driverNames ...string) (*schedulernodeinfo.NodeInfo, *v1beta1.CSINode) {
|
func getNodeWithPodAndVolumeLimits(limitSource string, pods []*v1.Pod, limit int64, driverNames ...string) (*schedulernodeinfo.NodeInfo, *v1beta1.CSINode) {
|
||||||
nodeInfo := schedulernodeinfo.NewNodeInfo(pods...)
|
nodeInfo := schedulernodeinfo.NewNodeInfo(pods...)
|
||||||
node := &v1.Node{
|
node := &v1.Node{
|
||||||
|
@ -305,8 +305,9 @@ func getMaxVolumeFunc(filterName string) func(node *v1.Node) int {
|
|||||||
|
|
||||||
var nodeInstanceType string
|
var nodeInstanceType string
|
||||||
for k, v := range node.ObjectMeta.Labels {
|
for k, v := range node.ObjectMeta.Labels {
|
||||||
if k == v1.LabelInstanceType {
|
if k == v1.LabelInstanceType || k == v1.LabelInstanceTypeStable {
|
||||||
nodeInstanceType = v
|
nodeInstanceType = v
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch filterName {
|
switch filterName {
|
||||||
|
Loading…
Reference in New Issue
Block a user