|
| 1 | +/* |
| 2 | +Copyright 2019 The Kubernetes Authors. |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +package prebind |
| 18 | + |
| 19 | +import ( |
| 20 | + "k8s.io/api/core/v1" |
| 21 | + "k8s.io/apimachinery/pkg/runtime" |
| 22 | + |
| 23 | + framework "k8s.io/kubernetes/pkg/scheduler/framework/v1alpha1" |
| 24 | +) |
| 25 | + |
| 26 | +// NoOpFilter is a plugin that implements the filter plugin and always returns Success. |
| 27 | +// This is just to make sure that all code dependencies are properly addressed while |
| 28 | +// working on legitimate plugins. |
| 29 | +type NoOpFilter struct{} |
| 30 | + |
| 31 | +var _ = framework.FilterPlugin(NoOpFilter{}) |
| 32 | + |
| 33 | +// Name is the name of the plugin used in Registry and configurations. |
| 34 | +const Name = "noop-filter" |
| 35 | + |
| 36 | +// Name returns name of the plugin. It is used in logs, etc. |
| 37 | +func (n NoOpFilter) Name() string { |
| 38 | + return Name |
| 39 | +} |
| 40 | + |
| 41 | +// Filter invoked at the filter extension point. |
| 42 | +func (n NoOpFilter) Filter(pc *framework.PluginContext, pod *v1.Pod, nodeName string) *framework.Status { |
| 43 | + return nil |
| 44 | +} |
| 45 | + |
| 46 | +// New initializes a new plugin and returns it. |
| 47 | +func New(_ *runtime.Unknown, _ framework.FrameworkHandle) (framework.Plugin, error) { |
| 48 | + return &NoOpFilter{}, nil |
| 49 | +} |
0 commit comments