From ee98e0759fae436cd48e0f86ea5688846912b612 Mon Sep 17 00:00:00 2001 From: Avesh Agarwal Date: Sat, 29 Jul 2017 10:55:01 -0400 Subject: [PATCH] Implement rescheduler's component config's v1alpha1 version. --- pkg/apis/componentconfig/v1alpha1/register.go | 50 +++++++++++++++++++ pkg/apis/componentconfig/v1alpha1/types.go | 28 +++++++++++ 2 files changed, 78 insertions(+) create mode 100644 pkg/apis/componentconfig/v1alpha1/register.go create mode 100644 pkg/apis/componentconfig/v1alpha1/types.go diff --git a/pkg/apis/componentconfig/v1alpha1/register.go b/pkg/apis/componentconfig/v1alpha1/register.go new file mode 100644 index 000000000..b94d308f2 --- /dev/null +++ b/pkg/apis/componentconfig/v1alpha1/register.go @@ -0,0 +1,50 @@ +/* +Copyright 2017 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. +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 v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +var ( + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + localSchemeBuilder = &SchemeBuilder + AddToScheme = SchemeBuilder.AddToScheme +) + +// GroupName is the group name use in this package +const GroupName = "reschedulercomponentconfig" +const GroupVersion = "v1alpha1" + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: GroupVersion} + +func init() { + // We only register manually written functions here. The registration of the + // generated functions takes place in the generated files. The separation + // makes the code compile even when the generated files are missing. + localSchemeBuilder.Register(addKnownTypes, addDefaultingFuncs) +} + +func addKnownTypes(scheme *runtime.Scheme) error { + // TODO this will get cleaned up with the scheme types are fixed + scheme.AddKnownTypes(SchemeGroupVersion, + &ReschedulerConfiguration{}, + ) + return nil +} diff --git a/pkg/apis/componentconfig/v1alpha1/types.go b/pkg/apis/componentconfig/v1alpha1/types.go new file mode 100644 index 000000000..82a1ccc03 --- /dev/null +++ b/pkg/apis/componentconfig/v1alpha1/types.go @@ -0,0 +1,28 @@ +/* +Copyright 2017 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. +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 v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type ReschedulerConfiguration struct { + metav1.TypeMeta `json:",inline"` + + // PolicyConfigFile is the filepath to the rescheduler policy configuration. + PolicyConfigFile string `json:"policyConfigFile"` +}