resource

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 10, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package resource provides utilities for computing resource sums across Pod containers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SumContainerResources

func SumContainerResources(template *corev1.PodTemplateSpec) (cpu *resource.Quantity, memory *resource.Quantity, err error)

SumContainerResources sums CPU and memory across all containers (not initContainers) in a PodTemplateSpec. For each container, requests takes priority, falling back to limits. If neither is set for any container, an error is returned.

Returns raw Quantity strings (e.g. "8000m", "8Gi") suitable for API responses. Callers can call .String() on the returned Quantities.

func SumContainers

func SumContainers(containers []corev1.Container) (cpu *resource.Quantity, memory *resource.Quantity, err error)

SumContainers sums CPU and memory across the given containers. For each container, requests take priority over limits. Returns an error if any container has neither requests nor limits set.

Types

This section is empty.

Jump to

Keyboard shortcuts

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