Documentation ¶
Overview ¶
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.
copied from kubernetes/pkg/kubelet/cm/cpumanager/cpu_assignment.go
Index ¶
- Constants
- Variables
- func GetContainerIdFromPod(pod *v1.Pod, name string) string
- func IsPodNotRunning(statuses []v1.ContainerStatus) bool
- type AdvancedCpuManager
- func (m *AdvancedCpuManager) AddContainer(p *v1.Pod, c *v1.Container) error
- func (m *AdvancedCpuManager) Allocate(p *v1.Pod, c *v1.Container) error
- func (m *AdvancedCpuManager) GetExclusiveCpu() cpuset.CPUSet
- func (m *AdvancedCpuManager) Name() string
- func (m *AdvancedCpuManager) Run(stop <-chan struct{})
- type CPUSetPolicy
- type Policy
Constants ¶
const AdvancedPolicyStatic policyName = "advanced-static"
AdvancedPolicyStatic is the name of the advanced static policy
const CPUSetAnnotation string = "qos.gocrane.io/cpu-manager"
Variables ¶
var DefaultExclusiveCPUSet = func() cpuset.CPUSet { return cpuset.NewCPUSet() }
Functions ¶
func IsPodNotRunning ¶
func IsPodNotRunning(statuses []v1.ContainerStatus) bool
Types ¶
type AdvancedCpuManager ¶
type AdvancedCpuManager struct { sync.RWMutex cadvisor.Manager // contains filtered or unexported fields }
func NewAdvancedCpuManager ¶
func NewAdvancedCpuManager(podInformer coreinformers.PodInformer, runtimeEndpoint string, cadvisorManager cadvisor.Manager) *AdvancedCpuManager
func (*AdvancedCpuManager) AddContainer ¶
func (*AdvancedCpuManager) GetExclusiveCpu ¶ added in v0.5.0
func (m *AdvancedCpuManager) GetExclusiveCpu() cpuset.CPUSet
func (*AdvancedCpuManager) Name ¶
func (m *AdvancedCpuManager) Name() string
func (*AdvancedCpuManager) Run ¶
func (m *AdvancedCpuManager) Run(stop <-chan struct{})
type CPUSetPolicy ¶
type CPUSetPolicy string
CPUSetPolicy the type for cpuset
const ( CPUSetNone CPUSetPolicy = "none" CPUSetExclusive CPUSetPolicy = "exclusive" )
func GetPodCPUSetType ¶
func GetPodCPUSetType(pod *v1.Pod, _ *v1.Container) CPUSetPolicy
type Policy ¶
type Policy interface { Name() string // Start is only called once to start policy Start(s state.State) error // Allocate call is idempotent to allocate cpus for containers Allocate(s state.State, pod *v1.Pod, container *v1.Container) error // RemoveContainer call is idempotent to reclaim cpus RemoveContainer(s state.State, podUID string, containerName string) error // NeedAllocated is called to judge if container needs to allocate cpu NeedAllocated(pod *v1.Pod, container *v1.Container) bool }
Policy implements logic for pod container to CPU assignment.
func NewAdvancedStaticPolicy ¶
func NewAdvancedStaticPolicy(topology *topology.CPUTopology) (Policy, error)