policy.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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 cpumanager
  14. import (
  15. "k8s.io/api/core/v1"
  16. "k8s.io/kubernetes/pkg/kubelet/cm/cpumanager/state"
  17. "k8s.io/kubernetes/pkg/kubelet/cm/topologymanager"
  18. )
  19. // Policy implements logic for pod container to CPU assignment.
  20. type Policy interface {
  21. Name() string
  22. Start(s state.State) error
  23. // AddContainer call is idempotent
  24. AddContainer(s state.State, pod *v1.Pod, container *v1.Container) error
  25. // RemoveContainer call is idempotent
  26. RemoveContainer(s state.State, podUID string, containerName string) error
  27. // GetTopologyHints implements the topologymanager.HintProvider Interface
  28. // and is consulted to achieve NUMA aware resource alignment among this
  29. // and other resource controllers.
  30. GetTopologyHints(s state.State, pod *v1.Pod, container *v1.Container) map[string][]topologymanager.TopologyHint
  31. }