-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package v1 | ||
|
||
var ( | ||
defaultNodeResource = []string{"cpu"} | ||
) | ||
|
||
func SetDefaults_DynamicArgs(obj *DynamicArgs) { | ||
if obj.PolicyConfigPath == "" { | ||
obj.PolicyConfigPath = "/etc/kubernetes/dynamic-scheduler-policy.yaml" | ||
} | ||
return | ||
} | ||
|
||
func SetDefaults_NodeResourceTopologyMatchArgs(obj *NodeResourceTopologyMatchArgs) { | ||
if len(obj.TopologyAwareResources) == 0 { | ||
obj.TopologyAwareResources = defaultNodeResource | ||
} | ||
return | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// +k8s:deepcopy-gen=package,register | ||
// +k8s:conversion-gen=github.com/gocrane/crane-scheduler/apis/config | ||
// +k8s:defaulter-gen=TypeMeta | ||
// +k8s:defaulter-gen-input=github.com/gocrane/crane-scheduler/apis/config/v1 | ||
|
||
// +groupName=kubescheduler.config.k8s.io | ||
|
||
// Package v1 is the v1 version of the API. | ||
package v1 // import "crane.io/scheduler-plugins/apis/config/v1" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package v1 | ||
|
||
import ( | ||
"k8s.io/apimachinery/pkg/runtime" | ||
"k8s.io/apimachinery/pkg/runtime/schema" | ||
kubeschedulerschemev1 "k8s.io/kube-scheduler/config/v1" | ||
kubeschedulerconfig "k8s.io/kubernetes/pkg/scheduler/apis/config" | ||
) | ||
|
||
// SchemeGroupVersion is group version used to register these objects | ||
var SchemeGroupVersion = schema.GroupVersion{Group: kubeschedulerconfig.GroupName, Version: "v1"} | ||
|
||
var ( | ||
// localSchemeBuilder and AddToScheme will stay in k8s.io/kubernetes. | ||
localSchemeBuilder = &kubeschedulerschemev1.SchemeBuilder | ||
// AddToScheme is a global function that registers this API group & version to a scheme | ||
AddToScheme = localSchemeBuilder.AddToScheme | ||
) | ||
|
||
// addKnownTypes registers known types to the given scheme | ||
func addKnownTypes(scheme *runtime.Scheme) error { | ||
scheme.AddKnownTypes(SchemeGroupVersion, | ||
&DynamicArgs{}, | ||
&NodeResourceTopologyMatchArgs{}, | ||
) | ||
return nil | ||
} | ||
|
||
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) | ||
localSchemeBuilder.Register(RegisterDefaults) | ||
localSchemeBuilder.Register(RegisterConversions) | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package v1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// DynamicArgs is the args struction of Dynamic scheduler plugin. | ||
type DynamicArgs struct { | ||
metav1.TypeMeta `json:",inline"` | ||
// PolicyConfigPath specified the path of policy config. | ||
PolicyConfigPath string `json:"policyConfigPath"` | ||
} | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// NodeResourceTopologyMatchArgs holds arguments used to configure the NodeResourceTopologyMatch plugin. | ||
type NodeResourceTopologyMatchArgs struct { | ||
metav1.TypeMeta `json:",inline"` | ||
// TopologyAwareResources represents the resource names of topology. | ||
TopologyAwareResources []string `json:"topologyAwareResources,omitempty"` | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// +k8s:deepcopy-gen=package,register | ||
// +k8s:conversion-gen=github.com/gocrane/crane-scheduler/pkg/plugins/apis/policy | ||
// +k8s:conversion-gen=github.com/gocrane/crane-scheduler/apis/policy | ||
|
||
package v1alpha1 // import "crane.io/crane-scheduler/pkg/plugins/apis/policy/v1alpha1" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.