kubernetes: k8s.io/kubernetes/pkg/kubelet/cm/cpumanager Index | Files | Directories

package cpumanager

import "k8s.io/kubernetes/pkg/kubelet/cm/cpumanager"


Package Files

cpu_assignment.go cpu_manager.go fake_cpu_manager.go policy.go policy_none.go policy_static.go


const PolicyNone policyName = "none"

PolicyNone name of none policy

const PolicyStatic policyName = "static"

PolicyStatic is the name of the static policy

type ActivePodsFunc Uses

type ActivePodsFunc func() []*v1.Pod

ActivePodsFunc is a function that returns a list of pods to reconcile.

type Manager Uses

type Manager interface {
    // Start is called during Kubelet initialization.
    Start(activePods ActivePodsFunc, sourcesReady config.SourcesReady, podStatusProvider status.PodStatusProvider, containerRuntime runtimeService, initialContainers containermap.ContainerMap) error

    // Called to trigger the allocation of CPUs to a container. This must be
    // called at some point prior to the AddContainer() call for a container,
    // e.g. at pod admission time.
    Allocate(pod *v1.Pod, container *v1.Container) error

    // AddContainer is called between container create and container start
    // so that initial CPU affinity settings can be written through to the
    // container runtime before the first process begins to execute.
    AddContainer(p *v1.Pod, c *v1.Container, containerID string) error

    // RemoveContainer is called after Kubelet decides to kill or delete a
    // container. After this call, the CPU manager stops trying to reconcile
    // that container and any CPUs dedicated to the container are freed.
    RemoveContainer(containerID string) error

    // State returns a read-only interface to the internal CPU manager state.
    State() state.Reader

    // GetTopologyHints implements the topologymanager.HintProvider Interface
    // and is consulted to achieve NUMA aware resource alignment among this
    // and other resource controllers.
    GetTopologyHints(*v1.Pod, *v1.Container) map[string][]topologymanager.TopologyHint

Manager interface provides methods for Kubelet to manage pod cpus.

func NewFakeManager Uses

func NewFakeManager() Manager

NewFakeManager creates empty/fake cpu manager

func NewManager Uses

func NewManager(cpuPolicyName string, reconcilePeriod time.Duration, machineInfo *cadvisorapi.MachineInfo, specificCPUs cpuset.CPUSet, nodeAllocatableReservation v1.ResourceList, stateFileDirectory string, affinity topologymanager.Store) (Manager, error)

NewManager creates new cpu manager based on provided policy

type Policy Uses

type Policy interface {
    Name() string
    Start(s state.State) error
    // Allocate call is idempotent
    Allocate(s state.State, pod *v1.Pod, container *v1.Container) error
    // RemoveContainer call is idempotent
    RemoveContainer(s state.State, podUID string, containerName string) error
    // GetTopologyHints implements the topologymanager.HintProvider Interface
    // and is consulted to achieve NUMA aware resource alignment among this
    // and other resource controllers.
    GetTopologyHints(s state.State, pod *v1.Pod, container *v1.Container) map[string][]topologymanager.TopologyHint

Policy implements logic for pod container to CPU assignment.

func NewNonePolicy Uses

func NewNonePolicy() Policy

NewNonePolicy returns a cupset manager policy that does nothing

func NewStaticPolicy Uses

func NewStaticPolicy(topology *topology.CPUTopology, numReservedCPUs int, reservedCPUs cpuset.CPUSet, affinity topologymanager.Store) (Policy, error)

NewStaticPolicy returns a CPU manager policy that does not change CPU assignments for exclusively pinned guaranteed containers after the main container process starts.


topologyPackage topology contains helpers for the CPU manager.

Package cpumanager imports 20 packages (graph) and is imported by 38 packages. Updated 2020-09-06. Refresh now. Tools for package owners.