qos

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

package qos contains helper functions for quality of service. For each resource (memory, CPU) Kubelet supports three classes of containers. Memory guaranteed containers will receive the highest priority and will get all the resources they need. Burstable containers will be guaranteed their request and can “burst” and use more resources when available. Best-Effort containers, which don’t specify a request, can use resources only if not being used by other pods.

Index

Constants

View Source
const (
	// PodInfraOOMAdj is very docker specific. For arbitrary runtime, it may not make
	// sense to set sandbox level oom score, e.g. a sandbox could only be a namespace
	// without a process.
	// TODO: Handle infra container oom score adj in a runtime agnostic way.
	// TODO: Should handle critical pod oom score adj with a proper preemption priority.
	// This is the workaround for https://github.com/kubernetes/kubernetes/issues/38322.
	PodInfraOOMAdj       int = -998
	CriticalPodOOMAdj    int = -998
	KubeletOOMScoreAdj   int = -999
	DockerOOMScoreAdj    int = -999
	KubeProxyOOMScoreAdj int = -999
)

Variables

This section is empty.

Functions

func GetContainerOOMScoreAdjust

func GetContainerOOMScoreAdjust(pod *api.Pod, container *api.Container, memoryCapacity int64) int

GetContainerOOMAdjust returns the amount by which the OOM score of all processes in the container should be adjusted. The OOM score of a process is the percentage of memory it consumes multiplied by 10 (barring exceptional cases) + a configurable quantity which is between -1000 and 1000. Containers with higher OOM scores are killed if the system runs out of memory. See https://lwn.net/Articles/391222/ for more information.

Types

type QOSClass

type QOSClass string

QOSClass defines the supported qos classes of Pods/Containers.

const (
	// Guaranteed is the Guaranteed qos class.
	Guaranteed QOSClass = "Guaranteed"
	// Burstable is the Burstable qos class.
	Burstable QOSClass = "Burstable"
	// BestEffort is the BestEffort qos class.
	BestEffort QOSClass = "BestEffort"
)

func GetPodQOS

func GetPodQOS(pod *api.Pod) QOSClass

GetPodQOS returns the QoS class of a pod. A pod is besteffort if none of its containers have specified any requests or limits. A pod is guaranteed only when requests and limits are specified for all the containers and they are equal. A pod is burstable if limits and requests do not match across all containers.

type QOSList

type QOSList map[api.ResourceName]QOSClass

QOSList is a set of (resource name, QoS class) pairs.

func GetQOS

func GetQOS(container *api.Container) QOSList

GetQOS returns a mapping of resource name to QoS class of a container

Jump to

Keyboard shortcuts

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