Skip to content

Commit

Permalink
Merge pull request volcano-sh#325 from k82cn/add_queue
Browse files Browse the repository at this point in the history
Add queue
  • Loading branch information
k82cn committed Aug 13, 2018
2 parents 56917ee + c7ae8bc commit fe71e5c
Show file tree
Hide file tree
Showing 44 changed files with 899 additions and 100 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ init:

generate-code:
go build -o ${BIN_DIR}/deepcopy-gen ./cmd/deepcopy-gen/
${BIN_DIR}/deepcopy-gen -i ./pkg/apis/core/v1alpha1/ -O zz_generated.deepcopy
${BIN_DIR}/deepcopy-gen -i ./pkg/apis/scheduling/v1alpha1/ -O zz_generated.deepcopy
${BIN_DIR}/deepcopy-gen -i ./pkg/apis/extensions/v1alpha1/ -O zz_generated.deepcopy

images: kube-arbitrator
Expand Down
3 changes: 3 additions & 0 deletions cmd/kar-controllers/app/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import (

"github.com/kubernetes-incubator/kube-arbitrator/cmd/kar-controllers/app/options"
"github.com/kubernetes-incubator/kube-arbitrator/pkg/controller/job"
"github.com/kubernetes-incubator/kube-arbitrator/pkg/controller/queue"
)

const (
Expand All @@ -62,9 +63,11 @@ func Run(opt *options.ServerOption) error {
neverStop := make(chan struct{})

queuejobctrl := job.NewController(config)
queueController := queue.NewController(config)

run := func(stopCh <-chan struct{}) {
queuejobctrl.Run(stopCh)
queueController.Run(stopCh)
<-stopCh
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: podgroups.core.arbitrator.incubator.k8s.io
name: podgroups.scheduling.arbitrator.incubator.k8s.io
spec:
group: core.arbitrator.incubator.k8s.io
group: scheduling.arbitrator.incubator.k8s.io
names:
kind: PodGroup
plural: podgroups
Expand Down
27 changes: 27 additions & 0 deletions config/crds/scheduling_v1alpha1_queue.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
name: queues.scheduling.arbitrator.incubator.k8s.io
spec:
group: scheduling.arbitrator.incubator.k8s.io
names:
kind: Queue
plural: Queues
scope: Cluster
validation:
openAPIV3Schema:
properties:
apiVersion:
type: string
kind:
type: string
metadata:
type: object
spec:
properties:
weight:
format: int32
type: integer
type: object
type: object
version: v1alpha1
3 changes: 2 additions & 1 deletion hack/.golint_failures
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ cmd/kar-controllers/app
cmd/kar-controllers/app/options
cmd/kar-scheduler/app
cmd/kar-scheduler/app/options
pkg/apis/core/v1alpha1
pkg/apis/extensions/v1alpha1
pkg/apis/scheduling/v1alpha1
pkg/apis/utils
pkg/controller/job
pkg/controller/queue
pkg/karcli/job
pkg/scheduler
pkg/scheduler/actions/allocate
Expand Down
2 changes: 1 addition & 1 deletion hack/boilerplate/boilerplate.go.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright YEAR The Kubernetes Authors.
Copyright 2018 The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion hack/run-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export PATH="${HOME}/.kubeadm-dind-cluster:${PATH}"
# start k8s dind cluster
APISERVER_enable_admission_plugins=Initializers,NamespaceLifecycle,LimitRanger,ServiceAccount,DefaultStorageClass,DefaultTolerationSeconds,NodeRestriction,MutatingAdmissionWebhook,ValidatingAdmissionWebhook,Priority,ResourceQuota ./hack/dind-cluster-v1.11.sh up

kubectl create -f config/crds/core_v1alpha1_podgroup.yaml
kubectl create -f config/crds/scheduling_v1alpha1_podgroup.yaml
kubectl create -f config/crds/extensions_v1alpha1_job.yaml

# start kube-arbitrator
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ var (
)

// GroupName is the group name used in this package.
const GroupName = "core.arbitrator.incubator.k8s.io"
const GroupName = "scheduling.arbitrator.incubator.k8s.io"

// SchemeGroupVersion is the group version used to register these objects.
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,40 @@ type PodGroupList struct {
// items is the list of PodGroup
Items []PodGroup `json:"items" protobuf:"bytes,2,rep,name=items"`
}

// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// Queue is a queue of PodGroup.
type Queue struct {
metav1.TypeMeta `json:",inline"`
// Standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
// +optional
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`

// Specification of the desired behavior of the pod group.
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status
// +optional
Spec QueueSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
}

// QueueSpec represents the template of Queue.
type QueueSpec struct {
Weight int32 `json:"weight,omitempty" protobuf:"bytes,1,opt,name=weight"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// QueueList is a collection of queues.
type QueueList struct {
metav1.TypeMeta `json:",inline"`
// Standard list metadata
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
// +optional
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`

// items is the list of PodGroup
Items []PodGroup `json:"items" protobuf:"bytes,2,rep,name=items"`
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 20 additions & 20 deletions pkg/client/clientset/versioned/clientset.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 12 additions & 12 deletions pkg/client/clientset/versioned/fake/clientset_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/client/clientset/versioned/fake/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fe71e5c

Please sign in to comment.