This is an automated email from the ASF dual-hosted git repository. pbacsko pushed a commit to branch YUNIKORN-2834 in repository https://gitbox.apache.org/repos/asf/yunikorn-k8shim.git
commit ecd0889e6494ab5ae3426007d16d03139f020050 Author: Peter Bacsko <bacs...@gmail.com> AuthorDate: Tue Aug 27 08:21:15 2024 +0200 WIP --- Makefile | 2 +- go.mod | 2 ++ go.sum | 4 --- pkg/cache/context.go | 1 - pkg/cache/context_test.go | 62 ++++++++++++++++++++--------------------- pkg/common/si_helper.go | 1 - pkg/common/si_helper_test.go | 1 - pkg/shim/scheduler_mock_test.go | 1 - 8 files changed, 34 insertions(+), 40 deletions(-) diff --git a/Makefile b/Makefile index d92b1ab9..dc494f4c 100644 --- a/Makefile +++ b/Makefile @@ -649,7 +649,7 @@ $(RELEASE_BIN_DIR)/$(TEST_SERVER_BINARY): go.mod go.sum $(shell find pkg) # Run the tests after building .PHONY: test -test: export DEADLOCK_DETECTION_ENABLED = true +test: export DEADLOCK_DETECTION_ENABLED = false test: export DEADLOCK_TIMEOUT_SECONDS = 10 test: export DEADLOCK_EXIT = true test: diff --git a/go.mod b/go.mod index 685499e7..de4c044f 100644 --- a/go.mod +++ b/go.mod @@ -162,6 +162,8 @@ require ( ) replace ( + github.com/apache/yunikorn-core => ../yunikorn-core + github.com/apache/yunikorn-scheduler-interface => ../yunikorn-scheduler-interface github.com/opencontainers/runc => github.com/opencontainers/runc v1.1.12 github.com/petermattis/goid => github.com/petermattis/goid v0.0.0-20240327183114-c42a807a84ba golang.org/x/crypto => golang.org/x/crypto v0.21.0 diff --git a/go.sum b/go.sum index 0c702f23..6250d8d3 100644 --- a/go.sum +++ b/go.sum @@ -9,10 +9,6 @@ github.com/NYTimes/gziphandler v1.1.1 h1:ZUDjpQae29j0ryrS0u/B8HZfJBtBQHjqw2rQ2cq github.com/NYTimes/gziphandler v1.1.1/go.mod h1:n/CVRwUEOgIxrgPvAQhUUr9oeUtvrhMomdKFjzJNB0c= github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df h1:7RFfzj4SSt6nnvCPbCqijJi1nWCd+TqAT3bYCStRC18= github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df/go.mod h1:pSwJ0fSY5KhvocuWSx4fz3BA8OrA1bQn+K1Eli3BRwM= -github.com/apache/yunikorn-core v0.0.0-20240815214512-f51aaba68ff2 h1:m1kxL2ce3QfHOsYl5D+AfHn7xjFxP40b88na/7qzmS8= -github.com/apache/yunikorn-core v0.0.0-20240815214512-f51aaba68ff2/go.mod h1:QHKfJ2RyZuQnZg28SnypmnvFxN/zfoYf+hmfxiVdq5g= -github.com/apache/yunikorn-scheduler-interface v0.0.0-20240815142741-38a38685cd4e h1:ZOLst6ROwUrgoUQbEdYaz28iKuiU5YNYGtelKsTFhqw= -github.com/apache/yunikorn-scheduler-interface v0.0.0-20240815142741-38a38685cd4e/go.mod h1:WuHJpVk34t8N5+1ErYGj/5Qq33/cRzL4YtuoAsbMtWc= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a h1:idn718Q4B6AGu/h5Sxe66HYVdqdGu2l9Iebqhi/AEoA= diff --git a/pkg/cache/context.go b/pkg/cache/context.go index 61fe1ea0..67053ccf 100644 --- a/pkg/cache/context.go +++ b/pkg/cache/context.go @@ -1492,7 +1492,6 @@ func (ctx *Context) registerNodes(nodes []*v1.Node) ([]*v1.Node, error) { constants.DefaultNodeAttributeRackNameKey: constants.DefaultRackName, }, SchedulableResource: common.GetNodeResource(&nodeStatus), - OccupiedResource: common.NewResourceBuilder().Build(), }) pendingNodes[node.Name] = node } diff --git a/pkg/cache/context_test.go b/pkg/cache/context_test.go index 6d7bfafa..f573e9cf 100644 --- a/pkg/cache/context_test.go +++ b/pkg/cache/context_test.go @@ -530,8 +530,8 @@ func TestAddUpdatePodForeign(t *testing.T) { defer dispatcher.Stop() executed := false - expectAdd := false - expectRemove := false + //expectAdd := false + //expectRemove := false tc := "" validatorFunc := func(request *si.NodeRequest) error { @@ -551,14 +551,14 @@ func TestAddUpdatePodForeign(t *testing.T) { } assert.Equal(t, updatedNode.SchedulableResource.Resources[siCommon.Memory].Value, int64(10000*1000*1000), "%s: wrong schedulable memory", tc) assert.Equal(t, updatedNode.SchedulableResource.Resources[siCommon.CPU].Value, int64(10000), "%s: wrong schedulable cpu", tc) - if expectAdd { + /*if expectAdd { assert.Equal(t, updatedNode.OccupiedResource.Resources[siCommon.Memory].Value, int64(1000*1000*1000), "%s: wrong occupied memory (add)", tc) assert.Equal(t, updatedNode.OccupiedResource.Resources[siCommon.CPU].Value, int64(500), "%s: wrong occupied cpu (add)", tc) } if expectRemove { assert.Equal(t, updatedNode.OccupiedResource.Resources[siCommon.Memory].Value, int64(0), "%s: wrong occupied memory (remove)", tc) assert.Equal(t, updatedNode.OccupiedResource.Resources[siCommon.CPU].Value, int64(0), "%s: wrong occupied cpu (remove)", tc) - } + }*/ return nil } @@ -585,8 +585,8 @@ func TestAddUpdatePodForeign(t *testing.T) { // validate add tc = "add-pod1" executed = false - expectAdd = false - expectRemove = false + //expectAdd = false + //expectRemove = false context.AddPod(pod1) assert.Assert(t, !executed, "unexpected update") pod := context.schedulerCache.GetPod(string(pod1.UID)) @@ -595,7 +595,7 @@ func TestAddUpdatePodForeign(t *testing.T) { // validate update tc = "update-pod1" executed = false - expectRemove = false + //expectRemove = false context.UpdatePod(nil, pod1) assert.Assert(t, !executed, "unexpected update") assert.Assert(t, pod == nil, "unassigned pod found in cache") @@ -608,8 +608,8 @@ func TestAddUpdatePodForeign(t *testing.T) { // validate add tc = "add-pod2" executed = false - expectAdd = true - expectRemove = false + //expectAdd = true + //expectRemove = false context.AddPod(pod2) assert.Assert(t, executed, "updated expected") pod = context.schedulerCache.GetPod(string(pod2.UID)) @@ -618,8 +618,8 @@ func TestAddUpdatePodForeign(t *testing.T) { // validate update tc = "update-pod2" executed = false - expectAdd = false - expectRemove = false + //expectAdd = false + //expectRemove = false context.UpdatePod(nil, pod2) assert.Assert(t, !executed, "unexpected update") pod = context.schedulerCache.GetPod(string(pod2.UID)) @@ -628,14 +628,14 @@ func TestAddUpdatePodForeign(t *testing.T) { // validate update when not already in cache tc = "update-pod2-nocache-pre" executed = false - expectAdd = false - expectRemove = true + //expectAdd = false + //expectRemove = true context.DeletePod(pod2) assert.Assert(t, executed, "expected update") tc = "update-pod2-nocache" executed = false - expectAdd = true - expectRemove = false + //expectAdd = true + //expectRemove = false context.UpdatePod(nil, pod2) assert.Assert(t, executed, "expected update") pod = context.schedulerCache.GetPod(string(pod2.UID)) @@ -648,8 +648,8 @@ func TestAddUpdatePodForeign(t *testing.T) { // validate add tc = "add-pod3" executed = false - expectAdd = false - expectRemove = true + //expectAdd = false + //expectRemove = true context.AddPod(pod3) assert.Assert(t, executed, "expected update") pod = context.schedulerCache.GetPod(string(pod3.UID)) @@ -658,13 +658,13 @@ func TestAddUpdatePodForeign(t *testing.T) { // validate update when not already in cache tc = "update-pod3-pre" executed = false - expectAdd = true - expectRemove = false + //expectAdd = true + //expectRemove = false context.AddPod(pod2) tc = "update-pod3" executed = false - expectAdd = false - expectRemove = true + //expectAdd = false + //expectRemove = true context.UpdatePod(nil, pod3) assert.Assert(t, executed, "expected update") pod = context.schedulerCache.GetPod(string(pod3.UID)) @@ -678,8 +678,8 @@ func TestDeletePodForeign(t *testing.T) { defer dispatcher.Stop() executed := false - expectAdd := false - expectRemove := false + //expectAdd := false + //expectRemove := false tc := "" validatorFunc := func(request *si.NodeRequest) error { @@ -701,14 +701,14 @@ func TestDeletePodForeign(t *testing.T) { assert.Equal(t, updatedNode.Action, si.NodeInfo_UPDATE, "%s: wrong action", tc) assert.Equal(t, updatedNode.SchedulableResource.Resources[siCommon.Memory].Value, int64(10000*1000*1000), "%s: wrong schedulable memory", tc) assert.Equal(t, updatedNode.SchedulableResource.Resources[siCommon.CPU].Value, int64(10000), "%s: wrong schedulable cpu", tc) - if expectAdd { + /*if expectAdd { assert.Equal(t, updatedNode.OccupiedResource.Resources[siCommon.Memory].Value, int64(1000*1000*1000), "%s: wrong occupied memory (add)", tc) assert.Equal(t, updatedNode.OccupiedResource.Resources[siCommon.CPU].Value, int64(500), "%s: wrong occupied cpu (add)", tc) } if expectRemove { assert.Equal(t, updatedNode.OccupiedResource.Resources[siCommon.Memory].Value, int64(0), "%s: wrong occupied memory (remove)", tc) assert.Equal(t, updatedNode.OccupiedResource.Resources[siCommon.CPU].Value, int64(0), "%s: wrong occupied cpu (remove)", tc) - } + }*/ return nil } @@ -735,13 +735,13 @@ func TestDeletePodForeign(t *testing.T) { // validate deletion of existing assigned pod tc = "delete-pod1-pre" executed = false - expectAdd = true - expectRemove = false + //expectAdd = true + //expectRemove = false context.AddPod(pod1) tc = "delete-pod1" executed = false - expectAdd = false - expectRemove = true + //expectAdd = false + //expectRemove = true context.DeletePod(pod1) assert.Assert(t, executed, "update not executed") pod := context.schedulerCache.GetPod(string(pod1.UID)) @@ -750,8 +750,8 @@ func TestDeletePodForeign(t *testing.T) { // validate delete when not already found tc = "delete-pod1-again" executed = false - expectAdd = false - expectRemove = false + //expectAdd = false + //expectRemove = false context.DeletePod(pod1) assert.Assert(t, !executed, "unexpected update") pod = context.schedulerCache.GetPod(string(pod1.UID)) diff --git a/pkg/common/si_helper.go b/pkg/common/si_helper.go index 82a22530..940416e5 100644 --- a/pkg/common/si_helper.go +++ b/pkg/common/si_helper.go @@ -147,7 +147,6 @@ func CreateUpdateRequestForUpdatedNode(nodeID string, capacity *si.Resource, occ NodeID: nodeID, Attributes: map[string]string{}, SchedulableResource: capacity, - OccupiedResource: occupied, Action: si.NodeInfo_UPDATE, } diff --git a/pkg/common/si_helper_test.go b/pkg/common/si_helper_test.go index b9464bd8..4ed9b09f 100644 --- a/pkg/common/si_helper_test.go +++ b/pkg/common/si_helper_test.go @@ -214,7 +214,6 @@ func TestCreateUpdateRequestForUpdatedNode(t *testing.T) { assert.Equal(t, len(request.Nodes), 1) assert.Equal(t, request.Nodes[0].NodeID, nodeID) assert.Equal(t, request.Nodes[0].SchedulableResource, capacity) - assert.Equal(t, request.Nodes[0].OccupiedResource, occupied) assert.Equal(t, len(request.Nodes[0].Attributes), 0) } diff --git a/pkg/shim/scheduler_mock_test.go b/pkg/shim/scheduler_mock_test.go index b67746d7..66976619 100644 --- a/pkg/shim/scheduler_mock_test.go +++ b/pkg/shim/scheduler_mock_test.go @@ -342,7 +342,6 @@ func createUpdateRequestForNewNode(nodeID string, nodeLabels map[string]string, nodeInfo := &si.NodeInfo{ NodeID: nodeID, SchedulableResource: capacity, - OccupiedResource: occupied, Attributes: map[string]string{ constants.DefaultNodeAttributeHostNameKey: nodeID, constants.DefaultNodeAttributeRackNameKey: constants.DefaultRackName, --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@yunikorn.apache.org For additional commands, e-mail: issues-h...@yunikorn.apache.org