cm

package
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 19, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

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

View Source
const AdvancedPolicyStatic policyName = "advanced-static"

AdvancedPolicyStatic is the name of the advanced static policy

View Source
const CPUSetAnnotation string = "qos.gocrane.io/cpu-manager"

Variables

View Source
var DefaultExclusiveCPUSet = func() cpuset.CPUSet {
	return cpuset.NewCPUSet()
}

Functions

func GetContainerIdFromPod

func GetContainerIdFromPod(pod *v1.Pod, name string) string

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 (m *AdvancedCpuManager) AddContainer(p *v1.Pod, c *v1.Container) error

func (*AdvancedCpuManager) Allocate

func (m *AdvancedCpuManager) Allocate(p *v1.Pod, c *v1.Container) error

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"
	CPUSetShare     CPUSetPolicy = "share"
)

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)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL