manager_stub.go 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. Copyright 2017 The Kubernetes Authors.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package devicemanager
  14. import (
  15. v1 "k8s.io/api/core/v1"
  16. podresourcesapi "k8s.io/kubernetes/pkg/kubelet/apis/podresources/v1alpha1"
  17. "k8s.io/kubernetes/pkg/kubelet/config"
  18. "k8s.io/kubernetes/pkg/kubelet/lifecycle"
  19. "k8s.io/kubernetes/pkg/kubelet/pluginmanager/cache"
  20. schedulernodeinfo "k8s.io/kubernetes/pkg/scheduler/nodeinfo"
  21. )
  22. // ManagerStub provides a simple stub implementation for the Device Manager.
  23. type ManagerStub struct{}
  24. // NewManagerStub creates a ManagerStub.
  25. func NewManagerStub() (*ManagerStub, error) {
  26. return &ManagerStub{}, nil
  27. }
  28. // Start simply returns nil.
  29. func (h *ManagerStub) Start(activePods ActivePodsFunc, sourcesReady config.SourcesReady) error {
  30. return nil
  31. }
  32. // Stop simply returns nil.
  33. func (h *ManagerStub) Stop() error {
  34. return nil
  35. }
  36. // Allocate simply returns nil.
  37. func (h *ManagerStub) Allocate(node *schedulernodeinfo.NodeInfo, attrs *lifecycle.PodAdmitAttributes) error {
  38. return nil
  39. }
  40. // GetDeviceRunContainerOptions simply returns nil.
  41. func (h *ManagerStub) GetDeviceRunContainerOptions(pod *v1.Pod, container *v1.Container) (*DeviceRunContainerOptions, error) {
  42. return nil, nil
  43. }
  44. // GetCapacity simply returns nil capacity and empty removed resource list.
  45. func (h *ManagerStub) GetCapacity() (v1.ResourceList, v1.ResourceList, []string) {
  46. return nil, nil, []string{}
  47. }
  48. // GetWatcherHandler returns plugin watcher interface
  49. func (h *ManagerStub) GetWatcherHandler() cache.PluginHandler {
  50. return nil
  51. }
  52. // GetDevices returns nil
  53. func (h *ManagerStub) GetDevices(_, _ string) []*podresourcesapi.ContainerDevices {
  54. return nil
  55. }
  56. // ShouldResetExtendedResourceCapacity returns false
  57. func (h *ManagerStub) ShouldResetExtendedResourceCapacity() bool {
  58. return false
  59. }