Skip to content

Commit

Permalink
Added v1beta1 API.
Browse files Browse the repository at this point in the history
Signed-off-by: Klaus Ma <klaus1982.cn@gmail.com>
  • Loading branch information
k82cn committed Jan 5, 2020
1 parent 082af9d commit 6614ec9
Show file tree
Hide file tree
Showing 43 changed files with 2,676 additions and 141 deletions.
4 changes: 2 additions & 2 deletions hack/update-gencode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${SCRIPT_ROOT}; ls -d -1 ./vendor/k8s.io/code-ge
# instead of the $GOPATH directly. For normal projects this can be dropped.
${CODEGEN_PKG}/generate-groups.sh "deepcopy,client,informer,lister" \
volcano.sh/volcano/pkg/client volcano.sh/volcano/pkg/apis \
"batch:v1alpha1 bus:v1alpha1 scheduling:v1alpha1,v1alpha2" \
"batch:v1alpha1 bus:v1alpha1 scheduling:v1alpha1,v1alpha2,v1beta1" \
--go-header-file ${SCRIPT_ROOT}/hack/boilerplate/boilerplate.go.txt

"${CODEGEN_PKG}/generate-internal-groups.sh" "deepcopy,conversion" \
volcano.sh/volcano/pkg/apis/ volcano.sh/volcano/pkg/apis volcano.sh/volcano/pkg/apis\
"scheduling:v1alpha1,v1alpha2" \
"scheduling:v1alpha1,v1alpha2,v1beta1" \
--output-base "$(dirname "${BASH_SOURCE[0]}")/../../.." \
--go-header-file ${SCRIPT_ROOT}/hack/boilerplate/boilerplate.go.txt

Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/scheduling/register.go
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 = "scheduling.sigs.dev"
const GroupName = "scheduling.volcano.sh"

// SchemeGroupVersion is the group version used to register these objects.
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
Expand Down
21 changes: 6 additions & 15 deletions pkg/apis/scheduling/types.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2017 The Kubernetes Authors.
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.
Expand Down Expand Up @@ -243,6 +243,9 @@ type Queue struct {

// QueueStatus represents the status of Queue.
type QueueStatus struct {
// State is status of queue
State QueueState

// The number of 'Unknown' PodGroup in this queue.
Unknown int32
// The number of 'Pending' PodGroup in this queue.
Expand All @@ -251,15 +254,14 @@ type QueueStatus struct {
Running int32
// The number of `Inqueue` PodGroup in this queue.
Inqueue int32
// State is status of queue
State QueueState
}

// QueueSpec represents the template of Queue.
type QueueSpec struct {
Weight int32
Capability v1.ResourceList
// State controller the status of queue

// Depreicated: replaced by status.State
State QueueState
// Reclaimable indicate whether the queue can be reclaimed by other queue
Reclaimable *bool
Expand All @@ -278,14 +280,3 @@ type QueueList struct {
// items is the list of PodGroup
Items []Queue
}

// QueueRequest struct
type QueueRequest struct {
// Name is queue name
Name string

// Event is event of queue
Event QueueEvent
// Action is action to be performed
Action QueueAction
}
2 changes: 1 addition & 1 deletion pkg/apis/scheduling/v1alpha1/zz_generated.conversion.go

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

60 changes: 23 additions & 37 deletions pkg/apis/scheduling/v1alpha2/zz_generated.conversion.go

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

32 changes: 32 additions & 0 deletions pkg/apis/scheduling/v1beta1/conversion.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/*
Copyright 2020 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 v1beta1

import (
unsafe "unsafe"

v1 "k8s.io/api/core/v1"
conversion "k8s.io/apimachinery/pkg/conversion"
scheduling "volcano.sh/volcano/pkg/apis/scheduling"
)

func Convert_scheduling_QueueSpec_To_v1beta1_QueueSpec(in *scheduling.QueueSpec, out *QueueSpec, s conversion.Scope) error {
out.Weight = in.Weight
out.Capability = *(*v1.ResourceList)(unsafe.Pointer(&in.Capability))

return nil
}
20 changes: 20 additions & 0 deletions pkg/apis/scheduling/v1beta1/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
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.
*/

// +k8s:deepcopy-gen=package
// +k8s:conversion-gen=volcano.sh/volcano/pkg/apis/scheduling

package v1beta1
25 changes: 25 additions & 0 deletions pkg/apis/scheduling/v1beta1/labels.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
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 v1beta1

// KubeGroupNameAnnotationKey is the annotation key of Pod to identify
// which PodGroup it belongs to.
const KubeGroupNameAnnotationKey = "scheduling.k8s.io/group-name"

// VolcanoGroupNameAnnotationKey is the annotation key of Pod to identify
// which PodGroup it belongs to.
const VolcanoGroupNameAnnotationKey = "scheduling.volcano.sh/group-name"
58 changes: 58 additions & 0 deletions pkg/apis/scheduling/v1beta1/register.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
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 v1beta1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)

var (
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
localSchemeBuilder = &SchemeBuilder
AddToScheme = SchemeBuilder.AddToScheme
)

const (
// GroupName is the group name used in this package.
GroupName = "scheduling.volcano.sh"

// GroupVersion is the version of scheduling group
GroupVersion = "v1alpha2"
)

// SchemeGroupVersion is the group version used to register these objects.
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: GroupVersion}

// Resource takes an unqualified resource and returns a Group-qualified GroupResource.
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}

// addKnownTypes adds the set of types defined in this package to the supplied scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&PodGroup{},
&PodGroupList{},
&Queue{},
&QueueList{},
)

metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}
Loading

0 comments on commit 6614ec9

Please sign in to comment.