diff --git a/go.mod b/go.mod index 24afc3071..0400f636b 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ go 1.12 require ( github.com/GoogleCloudPlatform/spark-on-k8s-operator v0.0.0-20200817155620-c19d2b8660d8 github.com/apache/incubator-yunikorn-core v0.0.0-20210106054125-dcf631d5c6b5 - github.com/apache/incubator-yunikorn-scheduler-interface v0.9.1-0.20201215141356-df4d86d2197b + github.com/apache/incubator-yunikorn-scheduler-interface v0.9.1-0.20210106054514-49c4f33ed27b github.com/google/uuid v1.1.1 github.com/gorilla/mux v1.7.3 github.com/looplab/fsm v0.1.0 diff --git a/go.sum b/go.sum index dabdda435..b836a5951 100644 --- a/go.sum +++ b/go.sum @@ -50,10 +50,13 @@ github.com/apache/incubator-yunikorn-core v0.0.0-20201218082332-5471d84cd619 h1: github.com/apache/incubator-yunikorn-core v0.0.0-20201218082332-5471d84cd619/go.mod h1:d/fn47kdGd094NHiysHAY+0d4evpYRFQ6q5b9eaBONo= github.com/apache/incubator-yunikorn-core v0.0.0-20210106054125-dcf631d5c6b5 h1:1cDvDjyqKce4U+Zvj7bmPSxU2ok1e+ynJsarFcp+JwQ= github.com/apache/incubator-yunikorn-core v0.0.0-20210106054125-dcf631d5c6b5/go.mod h1:d/fn47kdGd094NHiysHAY+0d4evpYRFQ6q5b9eaBONo= +github.com/apache/incubator-yunikorn-scheduler-interface v0.0.0-20210106054514-49c4f33ed27b/go.mod h1:ObMs03XFbnmpGD81jYvdUDEVZbHvz8W6dWH5nGDCjc0= github.com/apache/incubator-yunikorn-scheduler-interface v0.9.1-0.20200901200728-b9033558f319 h1:I12nCcXdHe6W4oysVejFHfQDy0Ix0r+ZHdfooyEoldo= github.com/apache/incubator-yunikorn-scheduler-interface v0.9.1-0.20200901200728-b9033558f319/go.mod h1:ObMs03XFbnmpGD81jYvdUDEVZbHvz8W6dWH5nGDCjc0= github.com/apache/incubator-yunikorn-scheduler-interface v0.9.1-0.20201215141356-df4d86d2197b h1:dxncLtkTwtqUB6pgsVVw52+Ni3ZXG2BPnLrSrubcRZA= github.com/apache/incubator-yunikorn-scheduler-interface v0.9.1-0.20201215141356-df4d86d2197b/go.mod h1:ObMs03XFbnmpGD81jYvdUDEVZbHvz8W6dWH5nGDCjc0= +github.com/apache/incubator-yunikorn-scheduler-interface v0.9.1-0.20210106054514-49c4f33ed27b h1:er61fRzIZuWejT9vUsHvb3ZyilJt6QCY7ZFdlAmVm7w= +github.com/apache/incubator-yunikorn-scheduler-interface v0.9.1-0.20210106054514-49c4f33ed27b/go.mod h1:ObMs03XFbnmpGD81jYvdUDEVZbHvz8W6dWH5nGDCjc0= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= diff --git a/pkg/cache/application_test.go b/pkg/cache/application_test.go index 4bb88a485..ecbeb541d 100644 --- a/pkg/cache/application_test.go +++ b/pkg/cache/application_test.go @@ -362,7 +362,9 @@ func TestTryReserve(t *testing.T) { createdPods.add(pod) return pod, nil }) - GetPlaceholderManager().setMockedClients(mockedAPIProvider.GetAPIs()) + mgr := NewPlaceholderManager(mockedAPIProvider.GetAPIs()) + mgr.Start() + defer mgr.Stop() // create a new app app := NewApplication("app00001", "root.abc", "test-user", diff --git a/pkg/cache/placeholder_test.go b/pkg/cache/placeholder_test.go index c4908a3d1..42bf58c80 100644 --- a/pkg/cache/placeholder_test.go +++ b/pkg/cache/placeholder_test.go @@ -59,7 +59,7 @@ func TestNewPlaceholder(t *testing.T) { assert.Equal(t, len(holder.pod.Labels), 2) assert.Equal(t, holder.pod.Labels[constants.LabelApplicationID], appID) assert.Equal(t, holder.pod.Labels[constants.LabelQueueName], queue) - assert.Equal(t, len(holder.pod.Annotations), 1) + assert.Equal(t, len(holder.pod.Annotations), 2) assert.Equal(t, holder.pod.Annotations[constants.AnnotationTaskGroupName], app.taskGroups[0].Name) assert.Equal(t, common.GetPodResource(holder.pod).Resources[constants.CPU].Value, int64(500)) assert.Equal(t, common.GetPodResource(holder.pod).Resources[constants.Memory].Value, int64(1024)) diff --git a/pkg/common/si_helper_test.go b/pkg/common/si_helper_test.go index 225328a55..5f01a2556 100644 --- a/pkg/common/si_helper_test.go +++ b/pkg/common/si_helper_test.go @@ -27,7 +27,7 @@ import ( ) func TestCreateReleaseAllocationRequest(t *testing.T) { - request := CreateReleaseAllocationRequestForTask("app01", "alloc01", "default") + request := CreateReleaseAllocationRequestForTask("app01", "alloc01", "default", "STOPPED_BY_RM") assert.Assert(t, request.Releases != nil) assert.Assert(t, request.Releases.AllocationsToRelease != nil) assert.Assert(t, request.Releases.AllocationAsksToRelease == nil) diff --git a/pkg/shim/scheduler.go b/pkg/shim/scheduler.go index 63f8565ba..e21340de6 100644 --- a/pkg/shim/scheduler.go +++ b/pkg/shim/scheduler.go @@ -267,6 +267,10 @@ func (ss *KubernetesShim) run() { } ss.apiFactory.Start() + + // run the placeholder manager + placeholderMgr := cache.NewPlaceholderManager(ss.apiFactory.GetAPIs()) + placeholderMgr.Start() } func (ss *KubernetesShim) enterState(event *fsm.Event) {