feat: use PreBind instead of Prebind in the scheduling framework
This commit is contained in:
@@ -19,27 +19,27 @@ package prebind
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"k8s.io/api/core/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1"
|
||||
)
|
||||
|
||||
// StatelessPrebindExample is an example of a simple plugin that has no state
|
||||
// StatelessPreBindExample is an example of a simple plugin that has no state
|
||||
// and implements only one hook for prebind.
|
||||
type StatelessPrebindExample struct{}
|
||||
type StatelessPreBindExample struct{}
|
||||
|
||||
var _ = framework.PrebindPlugin(StatelessPrebindExample{})
|
||||
var _ = framework.PreBindPlugin(StatelessPreBindExample{})
|
||||
|
||||
// Name is the name of the plugin used in Registry and configurations.
|
||||
const Name = "stateless-prebind-plugin-example"
|
||||
|
||||
// Name returns name of the plugin. It is used in logs, etc.
|
||||
func (sr StatelessPrebindExample) Name() string {
|
||||
func (sr StatelessPreBindExample) Name() string {
|
||||
return Name
|
||||
}
|
||||
|
||||
// Prebind is the functions invoked by the framework at "prebind" extension point.
|
||||
func (sr StatelessPrebindExample) Prebind(pc *framework.PluginContext, pod *v1.Pod, nodeName string) *framework.Status {
|
||||
// PreBind is the functions invoked by the framework at "prebind" extension point.
|
||||
func (sr StatelessPreBindExample) PreBind(pc *framework.PluginContext, pod *v1.Pod, nodeName string) *framework.Status {
|
||||
if pod == nil {
|
||||
return framework.NewStatus(framework.Error, fmt.Sprintf("pod cannot be nil"))
|
||||
}
|
||||
@@ -51,5 +51,5 @@ func (sr StatelessPrebindExample) Prebind(pc *framework.PluginContext, pod *v1.P
|
||||
|
||||
// New initializes a new plugin and returns it.
|
||||
func New(_ *runtime.Unknown, _ framework.FrameworkHandle) (framework.Plugin, error) {
|
||||
return &StatelessPrebindExample{}, nil
|
||||
return &StatelessPreBindExample{}, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user