From 6293b8a25f99a08c2650d8c2eb780e3ad2aff0c4 Mon Sep 17 00:00:00 2001 From: TommyLike Date: Mon, 8 Apr 2019 18:55:57 +0800 Subject: [PATCH] Move apis&cache into pkg/controllers folder --- hack/.golint_failures | 4 ++-- hack/run-e2e-kind.sh | 6 +++--- .../{job/apis/types.go => apis/job_info.go} | 0 pkg/controllers/{job => }/cache/cache.go | 2 +- pkg/controllers/{job => }/cache/interface.go | 2 +- pkg/controllers/job/job_controller.go | 4 ++-- pkg/controllers/job/job_controller_actions.go | 2 +- pkg/controllers/job/job_controller_const.go | 21 ------------------- pkg/controllers/job/job_controller_handler.go | 4 ++-- pkg/controllers/job/job_controller_util.go | 2 +- pkg/controllers/job/state/aborted.go | 2 +- pkg/controllers/job/state/aborting.go | 2 +- pkg/controllers/job/state/completing.go | 2 +- pkg/controllers/job/state/factory.go | 2 +- pkg/controllers/job/state/finished.go | 2 +- pkg/controllers/job/state/pending.go | 2 +- pkg/controllers/job/state/restarting.go | 2 +- pkg/controllers/job/state/running.go | 2 +- pkg/controllers/job/state/terminating.go | 2 +- 19 files changed, 22 insertions(+), 43 deletions(-) rename pkg/controllers/{job/apis/types.go => apis/job_info.go} (100%) rename pkg/controllers/{job => }/cache/cache.go (99%) rename pkg/controllers/{job => }/cache/interface.go (95%) delete mode 100644 pkg/controllers/job/job_controller_const.go diff --git a/hack/.golint_failures b/hack/.golint_failures index 89b9265439..999d2e0272 100644 --- a/hack/.golint_failures +++ b/hack/.golint_failures @@ -7,9 +7,9 @@ volcano.sh/volcano/pkg/apis/batch/v1alpha1 volcano.sh/volcano/pkg/apis/bus/v1alpha1 volcano.sh/volcano/pkg/apis/helpers volcano.sh/volcano/pkg/cli/job +volcano.sh/volcano/pkg/controllers/apis +volcano.sh/volcano/pkg/controllers/cache volcano.sh/volcano/pkg/controllers/job -volcano.sh/volcano/pkg/controllers/job/apis -volcano.sh/volcano/pkg/controllers/job/cache volcano.sh/volcano/pkg/controllers/job/helpers volcano.sh/volcano/pkg/controllers/job/plugins volcano.sh/volcano/pkg/controllers/job/plugins/env diff --git a/hack/run-e2e-kind.sh b/hack/run-e2e-kind.sh index eaf721ba3e..c68467398c 100755 --- a/hack/run-e2e-kind.sh +++ b/hack/run-e2e-kind.sh @@ -57,9 +57,9 @@ function install-volcano { docker pull ${MPI_EXAMPLE_IMAGE} echo "Loading docker images into kind cluster" - kind load docker-image ${IMAGE}-controllers:${TAG} ${CLUSTER_CONTEXT} - kind load docker-image ${IMAGE}-scheduler:${TAG} ${CLUSTER_CONTEXT} - kind load docker-image ${IMAGE}-admission:${TAG} ${CLUSTER_CONTEXT} + kind load docker-image ${IMAGE_PREFIX}-controllers:${TAG} ${CLUSTER_CONTEXT} + kind load docker-image ${IMAGE_PREFIX}-scheduler:${TAG} ${CLUSTER_CONTEXT} + kind load docker-image ${IMAGE_PREFIX}-admission:${TAG} ${CLUSTER_CONTEXT} kind load docker-image ${MPI_EXAMPLE_IMAGE} ${CLUSTER_CONTEXT} echo "Install volcano plugin into cluster...." diff --git a/pkg/controllers/job/apis/types.go b/pkg/controllers/apis/job_info.go similarity index 100% rename from pkg/controllers/job/apis/types.go rename to pkg/controllers/apis/job_info.go diff --git a/pkg/controllers/job/cache/cache.go b/pkg/controllers/cache/cache.go similarity index 99% rename from pkg/controllers/job/cache/cache.go rename to pkg/controllers/cache/cache.go index 5114ce6d7d..4434e701b5 100644 --- a/pkg/controllers/job/cache/cache.go +++ b/pkg/controllers/cache/cache.go @@ -26,7 +26,7 @@ import ( "k8s.io/client-go/util/workqueue" "volcano.sh/volcano/pkg/apis/batch/v1alpha1" - "volcano.sh/volcano/pkg/controllers/job/apis" + "volcano.sh/volcano/pkg/controllers/apis" ) type jobCache struct { diff --git a/pkg/controllers/job/cache/interface.go b/pkg/controllers/cache/interface.go similarity index 95% rename from pkg/controllers/job/cache/interface.go rename to pkg/controllers/cache/interface.go index 7cda0e084d..a244565428 100644 --- a/pkg/controllers/job/cache/interface.go +++ b/pkg/controllers/cache/interface.go @@ -20,7 +20,7 @@ import ( "k8s.io/api/core/v1" "volcano.sh/volcano/pkg/apis/batch/v1alpha1" - "volcano.sh/volcano/pkg/controllers/job/apis" + "volcano.sh/volcano/pkg/controllers/apis" ) type Cache interface { diff --git a/pkg/controllers/job/job_controller.go b/pkg/controllers/job/job_controller.go index d80b27d551..c364ee28cd 100644 --- a/pkg/controllers/job/job_controller.go +++ b/pkg/controllers/job/job_controller.go @@ -47,8 +47,8 @@ import ( vkcoreinfo "volcano.sh/volcano/pkg/client/informers/externalversions/bus/v1alpha1" vkbatchlister "volcano.sh/volcano/pkg/client/listers/batch/v1alpha1" vkcorelister "volcano.sh/volcano/pkg/client/listers/bus/v1alpha1" - "volcano.sh/volcano/pkg/controllers/job/apis" - jobcache "volcano.sh/volcano/pkg/controllers/job/cache" + "volcano.sh/volcano/pkg/controllers/apis" + jobcache "volcano.sh/volcano/pkg/controllers/cache" "volcano.sh/volcano/pkg/controllers/job/state" ) diff --git a/pkg/controllers/job/job_controller_actions.go b/pkg/controllers/job/job_controller_actions.go index 7cff1b839c..92cc3f6055 100644 --- a/pkg/controllers/job/job_controller_actions.go +++ b/pkg/controllers/job/job_controller_actions.go @@ -32,7 +32,7 @@ import ( vkbatchv1 "volcano.sh/volcano/pkg/apis/batch/v1alpha1" vkv1 "volcano.sh/volcano/pkg/apis/batch/v1alpha1" "volcano.sh/volcano/pkg/apis/helpers" - "volcano.sh/volcano/pkg/controllers/job/apis" + "volcano.sh/volcano/pkg/controllers/apis" vkjobhelpers "volcano.sh/volcano/pkg/controllers/job/helpers" "volcano.sh/volcano/pkg/controllers/job/state" ) diff --git a/pkg/controllers/job/job_controller_const.go b/pkg/controllers/job/job_controller_const.go deleted file mode 100644 index 11c28ca295..0000000000 --- a/pkg/controllers/job/job_controller_const.go +++ /dev/null @@ -1,21 +0,0 @@ -/* -Copyright 2019 The Volcano Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package job - -const ( - TaskNameFmt = "%s-%s-%d" -) diff --git a/pkg/controllers/job/job_controller_handler.go b/pkg/controllers/job/job_controller_handler.go index 5ce85ff6c4..4b9197d506 100644 --- a/pkg/controllers/job/job_controller_handler.go +++ b/pkg/controllers/job/job_controller_handler.go @@ -29,8 +29,8 @@ import ( kbtype "github.com/kubernetes-sigs/kube-batch/pkg/apis/scheduling/v1alpha1" vkbatchv1 "volcano.sh/volcano/pkg/apis/batch/v1alpha1" vkbusv1 "volcano.sh/volcano/pkg/apis/bus/v1alpha1" - "volcano.sh/volcano/pkg/controllers/job/apis" - vkcache "volcano.sh/volcano/pkg/controllers/job/cache" + "volcano.sh/volcano/pkg/controllers/apis" + vkcache "volcano.sh/volcano/pkg/controllers/cache" ) func (cc *Controller) addCommand(obj interface{}) { diff --git a/pkg/controllers/job/job_controller_util.go b/pkg/controllers/job/job_controller_util.go index 70f917881b..401d856db7 100644 --- a/pkg/controllers/job/job_controller_util.go +++ b/pkg/controllers/job/job_controller_util.go @@ -29,7 +29,7 @@ import ( admissioncontroller "volcano.sh/volcano/pkg/admission" vkv1 "volcano.sh/volcano/pkg/apis/batch/v1alpha1" "volcano.sh/volcano/pkg/apis/helpers" - "volcano.sh/volcano/pkg/controllers/job/apis" + "volcano.sh/volcano/pkg/controllers/apis" ) func eventKey(obj interface{}) interface{} { diff --git a/pkg/controllers/job/state/aborted.go b/pkg/controllers/job/state/aborted.go index 8da034799f..4a3d797c7a 100644 --- a/pkg/controllers/job/state/aborted.go +++ b/pkg/controllers/job/state/aborted.go @@ -18,7 +18,7 @@ package state import ( vkv1 "volcano.sh/volcano/pkg/apis/batch/v1alpha1" - "volcano.sh/volcano/pkg/controllers/job/apis" + "volcano.sh/volcano/pkg/controllers/apis" ) type abortedState struct { diff --git a/pkg/controllers/job/state/aborting.go b/pkg/controllers/job/state/aborting.go index f0e6d38546..e15d1a1c03 100644 --- a/pkg/controllers/job/state/aborting.go +++ b/pkg/controllers/job/state/aborting.go @@ -18,7 +18,7 @@ package state import ( vkv1 "volcano.sh/volcano/pkg/apis/batch/v1alpha1" - "volcano.sh/volcano/pkg/controllers/job/apis" + "volcano.sh/volcano/pkg/controllers/apis" ) type abortingState struct { diff --git a/pkg/controllers/job/state/completing.go b/pkg/controllers/job/state/completing.go index c1317c2a78..50da0a355b 100644 --- a/pkg/controllers/job/state/completing.go +++ b/pkg/controllers/job/state/completing.go @@ -18,7 +18,7 @@ package state import ( vkv1 "volcano.sh/volcano/pkg/apis/batch/v1alpha1" - "volcano.sh/volcano/pkg/controllers/job/apis" + "volcano.sh/volcano/pkg/controllers/apis" ) type completingState struct { diff --git a/pkg/controllers/job/state/factory.go b/pkg/controllers/job/state/factory.go index 8394584cce..8a5e9d190e 100644 --- a/pkg/controllers/job/state/factory.go +++ b/pkg/controllers/job/state/factory.go @@ -18,7 +18,7 @@ package state import ( vkv1 "volcano.sh/volcano/pkg/apis/batch/v1alpha1" - "volcano.sh/volcano/pkg/controllers/job/apis" + "volcano.sh/volcano/pkg/controllers/apis" ) type NextStateFn func(status vkv1.JobStatus) vkv1.JobState diff --git a/pkg/controllers/job/state/finished.go b/pkg/controllers/job/state/finished.go index 61db953570..52480bd95d 100644 --- a/pkg/controllers/job/state/finished.go +++ b/pkg/controllers/job/state/finished.go @@ -18,7 +18,7 @@ package state import ( vkv1 "volcano.sh/volcano/pkg/apis/batch/v1alpha1" - "volcano.sh/volcano/pkg/controllers/job/apis" + "volcano.sh/volcano/pkg/controllers/apis" ) type finishedState struct { diff --git a/pkg/controllers/job/state/pending.go b/pkg/controllers/job/state/pending.go index 0aa471325f..669d493258 100644 --- a/pkg/controllers/job/state/pending.go +++ b/pkg/controllers/job/state/pending.go @@ -18,7 +18,7 @@ package state import ( vkv1 "volcano.sh/volcano/pkg/apis/batch/v1alpha1" - "volcano.sh/volcano/pkg/controllers/job/apis" + "volcano.sh/volcano/pkg/controllers/apis" ) type pendingState struct { diff --git a/pkg/controllers/job/state/restarting.go b/pkg/controllers/job/state/restarting.go index 353c009be0..f9b413eaa7 100644 --- a/pkg/controllers/job/state/restarting.go +++ b/pkg/controllers/job/state/restarting.go @@ -18,7 +18,7 @@ package state import ( vkv1 "volcano.sh/volcano/pkg/apis/batch/v1alpha1" - "volcano.sh/volcano/pkg/controllers/job/apis" + "volcano.sh/volcano/pkg/controllers/apis" ) type restartingState struct { diff --git a/pkg/controllers/job/state/running.go b/pkg/controllers/job/state/running.go index f25dbda394..c3e5719dd2 100644 --- a/pkg/controllers/job/state/running.go +++ b/pkg/controllers/job/state/running.go @@ -18,7 +18,7 @@ package state import ( vkv1 "volcano.sh/volcano/pkg/apis/batch/v1alpha1" - "volcano.sh/volcano/pkg/controllers/job/apis" + "volcano.sh/volcano/pkg/controllers/apis" ) type runningState struct { diff --git a/pkg/controllers/job/state/terminating.go b/pkg/controllers/job/state/terminating.go index b81ca4641c..f994e5af3b 100644 --- a/pkg/controllers/job/state/terminating.go +++ b/pkg/controllers/job/state/terminating.go @@ -18,7 +18,7 @@ package state import ( vkv1 "volcano.sh/volcano/pkg/apis/batch/v1alpha1" - "volcano.sh/volcano/pkg/controllers/job/apis" + "volcano.sh/volcano/pkg/controllers/apis" ) type terminatingState struct {