package cgroups
import "k8s.io/kubernetes/test/e2e/common/node/framework/cgroups"
Index ¶
- func ConfigureHostPathForPodCgroup(pod *v1.Pod)
- func IsPodOnCgroupv2Node(f *framework.Framework, pod *v1.Pod) (result bool)
- func MakeContainerWithResources(name string, r *ContainerResources, command string) v1.Container
- func VerifyCgroupValue(f *framework.Framework, pod *v1.Pod, cName, cgPath string, expectedCgValues ...string) error
- func VerifyContainerCPULimit(f *framework.Framework, pod *v1.Pod, containerName string, expectedResources *v1.ResourceRequirements, podOnCgroupv2 bool) error
- func VerifyContainerCgroupValues(f *framework.Framework, pod *v1.Pod, tc *v1.Container, podOnCgroupv2 bool) error
- func VerifyContainerMemoryLimit(f *framework.Framework, pod *v1.Pod, containerName string, expectedResources *v1.ResourceRequirements, podOnCgroupv2 bool) error
- func VerifyOomScoreAdjValue(f *framework.Framework, pod *v1.Pod, cName, expectedOomScoreAdj string) error
- func VerifyPodCgroups(ctx context.Context, f *framework.Framework, pod *v1.Pod, info *ContainerResources) error
- type ContainerResources
Functions ¶
func ConfigureHostPathForPodCgroup ¶
func IsPodOnCgroupv2Node ¶
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(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(f *framework.Framework, pod *v1.Pod, containerName string, expectedResources *v1.ResourceRequirements, podOnCgroupv2 bool) error
func VerifyContainerCgroupValues ¶
func VerifyContainerCgroupValues(f *framework.Framework, pod *v1.Pod, tc *v1.Container, podOnCgroupv2 bool) error
func VerifyContainerMemoryLimit ¶
func VerifyContainerMemoryLimit(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
- Version
- v1.34.0-alpha.2
- Published
- Jun 25, 2025
- Platform
- js/wasm
- Imports
- 14 packages
- Last checked
- 14 minutes ago –
Tools for package owners.