From 92efc3b00be657cef1a6876a269d75a9ac1d845c Mon Sep 17 00:00:00 2001 From: "Da K. Ma" Date: Sat, 4 May 2019 11:11:43 +0800 Subject: [PATCH] Added Queue Capability. Signed-off-by: Da K. Ma --- pkg/apis/scheduling/v1alpha1/types.go | 3 ++- pkg/apis/scheduling/v1alpha1/zz_generated.deepcopy.go | 10 +++++++++- pkg/scheduler/util.go | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/pkg/apis/scheduling/v1alpha1/types.go b/pkg/apis/scheduling/v1alpha1/types.go index e4d0004c0..cc6275160 100644 --- a/pkg/apis/scheduling/v1alpha1/types.go +++ b/pkg/apis/scheduling/v1alpha1/types.go @@ -195,7 +195,8 @@ type QueueStatus struct { // QueueSpec represents the template of Queue. type QueueSpec struct { - Weight int32 `json:"weight,omitempty" protobuf:"bytes,1,opt,name=weight"` + Weight int32 `json:"weight,omitempty" protobuf:"bytes,1,opt,name=weight"` + Capability v1.ResourceList `json:"capability,omitempty" protobuf:"bytes,2,opt,name=capability"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/pkg/apis/scheduling/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/scheduling/v1alpha1/zz_generated.deepcopy.go index 3bc381173..73933dfcc 100644 --- a/pkg/apis/scheduling/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/scheduling/v1alpha1/zz_generated.deepcopy.go @@ -21,6 +21,7 @@ limitations under the License. package v1alpha1 import ( + v1 "k8s.io/api/core/v1" runtime "k8s.io/apimachinery/pkg/runtime" ) @@ -146,7 +147,7 @@ func (in *Queue) DeepCopyInto(out *Queue) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) - out.Spec = in.Spec + in.Spec.DeepCopyInto(&out.Spec) out.Status = in.Status return } @@ -205,6 +206,13 @@ func (in *QueueList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *QueueSpec) DeepCopyInto(out *QueueSpec) { *out = *in + if in.Capability != nil { + in, out := &in.Capability, &out.Capability + *out = make(v1.ResourceList, len(*in)) + for key, val := range *in { + (*out)[key] = val.DeepCopy() + } + } return } diff --git a/pkg/scheduler/util.go b/pkg/scheduler/util.go index bcfc84753..ed6d78cc0 100644 --- a/pkg/scheduler/util.go +++ b/pkg/scheduler/util.go @@ -21,7 +21,7 @@ import ( "io/ioutil" "strings" - "gopkg.in/yaml.v2" + yaml "gopkg.in/yaml.v2" "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/conf" "github.com/kubernetes-sigs/kube-batch/pkg/scheduler/framework"