2017-08-22 22:03:47 +00:00
|
|
|
/*
|
|
|
|
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.
|
|
|
|
*/
|
|
|
|
|
2017-12-05 18:28:23 +00:00
|
|
|
package devicemanager
|
2017-08-22 22:03:47 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
"k8s.io/api/core/v1"
|
2017-10-23 23:18:49 +00:00
|
|
|
"k8s.io/kubernetes/pkg/kubelet/config"
|
2017-11-02 01:17:48 +00:00
|
|
|
"k8s.io/kubernetes/pkg/kubelet/lifecycle"
|
2018-01-24 17:06:07 +00:00
|
|
|
"k8s.io/kubernetes/pkg/kubelet/util/pluginwatcher"
|
2018-05-15 02:49:54 +00:00
|
|
|
schedulercache "k8s.io/kubernetes/pkg/scheduler/cache"
|
2017-08-22 22:03:47 +00:00
|
|
|
)
|
|
|
|
|
2017-11-14 21:06:07 +00:00
|
|
|
// ManagerStub provides a simple stub implementation for the Device Manager.
|
|
|
|
type ManagerStub struct{}
|
2017-08-22 22:03:47 +00:00
|
|
|
|
2017-11-14 21:06:07 +00:00
|
|
|
// NewManagerStub creates a ManagerStub.
|
|
|
|
func NewManagerStub() (*ManagerStub, error) {
|
|
|
|
return &ManagerStub{}, nil
|
2017-08-22 22:03:47 +00:00
|
|
|
}
|
|
|
|
|
2017-10-24 21:18:37 +00:00
|
|
|
// Start simply returns nil.
|
2017-10-23 23:18:49 +00:00
|
|
|
func (h *ManagerStub) Start(activePods ActivePodsFunc, sourcesReady config.SourcesReady) error {
|
2017-11-14 21:06:07 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Stop simply returns nil.
|
|
|
|
func (h *ManagerStub) Stop() error {
|
2017-08-22 22:03:47 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2017-10-24 21:18:37 +00:00
|
|
|
// Allocate simply returns nil.
|
2017-11-14 21:06:07 +00:00
|
|
|
func (h *ManagerStub) Allocate(node *schedulercache.NodeInfo, attrs *lifecycle.PodAdmitAttributes) error {
|
2017-10-24 21:18:37 +00:00
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetDeviceRunContainerOptions simply returns nil.
|
2018-01-15 10:40:52 +00:00
|
|
|
func (h *ManagerStub) GetDeviceRunContainerOptions(pod *v1.Pod, container *v1.Container) (*DeviceRunContainerOptions, error) {
|
|
|
|
return nil, nil
|
2017-08-22 22:03:47 +00:00
|
|
|
}
|
2017-10-23 23:18:49 +00:00
|
|
|
|
|
|
|
// GetCapacity simply returns nil capacity and empty removed resource list.
|
2017-12-16 06:38:46 +00:00
|
|
|
func (h *ManagerStub) GetCapacity() (v1.ResourceList, v1.ResourceList, []string) {
|
|
|
|
return nil, nil, []string{}
|
2017-10-23 23:18:49 +00:00
|
|
|
}
|
2018-01-24 17:06:07 +00:00
|
|
|
|
2018-08-11 23:59:39 +00:00
|
|
|
// GetWatcherHandler returns plugin watcher interface
|
|
|
|
func (h *ManagerStub) GetWatcherHandler() pluginwatcher.PluginHandler {
|
|
|
|
return nil
|
2018-01-24 17:06:07 +00:00
|
|
|
}
|