package cgroups

import "k8s.io/kubernetes/test/e2e/common/node/framework/cgroups"

Index

Functions

func ConfigureHostPathForPodCgroup

func ConfigureHostPathForPodCgroup(pod *v1.Pod)

func IsPodOnCgroupv2Node

func IsPodOnCgroupv2Node(f *framework.Framework, podName, containerName string) (result bool)

IsPodOnCgroupv2Node checks whether the pod is running on cgroupv2 node. TODO: Deduplicate this function with NPD cluster e2e test: https://github.com/kubernetes/kubernetes/blob/2049360379bcc5d6467769cef112e6e492d3d2f0/test/e2e/node/node_problem_detector.go#L369

func MakeContainerWithResources

func MakeContainerWithResources(name string, r *ContainerResources, command string) v1.Container

func VerifyCgroupValue

func VerifyCgroupValue(ctx context.Context, f *framework.Framework, pod *v1.Pod, cName, cgPath string, expectedCgValues ...string) error

VerifyCgroupValue verifies that the given cgroup path has the expected value in the specified container of the pod. It execs into the container to retrieve the cgroup value, and ensures that the retrieved cgroup value is equivalent to at least one of the values in expectedCgValues.

func VerifyContainerCPULimit

func VerifyContainerCPULimit(ctx context.Context, f *framework.Framework, pod *v1.Pod, containerName string, expectedResources *v1.ResourceRequirements, podOnCgroupv2 bool) error

func VerifyContainerCgroupValues

func VerifyContainerCgroupValues(ctx context.Context, f *framework.Framework, pod *v1.Pod, tc *v1.Container, podOnCgroupv2 bool) error

func VerifyContainerMemoryLimit

func VerifyContainerMemoryLimit(ctx context.Context, f *framework.Framework, pod *v1.Pod, containerName string, expectedResources *v1.ResourceRequirements, podOnCgroupv2 bool) error

func VerifyOomScoreAdjValue

func VerifyOomScoreAdjValue(f *framework.Framework, pod *v1.Pod, cName, expectedOomScoreAdj string) error

VerifyOomScoreAdjValue verifies that oom_score_adj for pid 1 (pidof init/systemd -> app) has the expected value in specified container of the pod. It execs into the container, reads the oom_score_adj value from procfs, and compares it against the expected value.

func VerifyPodCgroups

func VerifyPodCgroups(ctx context.Context, f *framework.Framework, pod *v1.Pod, info *ContainerResources) error

VerifyPodCgroups verifies pod cgroup is configured on a node as expected.

Types

type ContainerResources

type ContainerResources struct {
	CPUReq              string
	CPULim              string
	MemReq              string
	MemLim              string
	EphStorReq          string
	EphStorLim          string
	ExtendedResourceReq string
	ExtendedResourceLim string
}

func BuildPodResourceInfo

func BuildPodResourceInfo(podCPURequestMilliValue, podCPULimitMilliValue, podMemoryLimitInBytes int64) ContainerResources

func (*ContainerResources) ResourceRequirements

func (cr *ContainerResources) ResourceRequirements() *v1.ResourceRequirements

Source Files

cgroups.go cgroups_linux.go

Version
v1.36.0 (latest)
Published
Apr 22, 2026
Platform
linux/amd64
Imports
15 packages
Last checked
39 seconds ago

Tools for package owners.