util

package
v0.0.0-...-12e0a72 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ResourceCalculator

type ResourceCalculator struct {
	NvidiaGPUDeviceMemoryGB int64
}

func (ResourceCalculator) ComputePodRequest

func (r ResourceCalculator) ComputePodRequest(pod v1.Pod) v1.ResourceList

ComputePodRequest returns a v1.ResourceList that covers the largest width in each resource dimension. Because init-containers run sequentially, we collect the max in each dimension iteratively. In contrast, we sum the resource vectors for regular containers since they run simultaneously.

If Pod Overhead is specified and the feature gate is set, the resources defined for Overhead are added to the calculated Resource request sum

Example:

Pod:

InitContainers
  IC1:
    CPU: 2
    Memory: 1G
  IC2:
    CPU: 2
    Memory: 3G
Containers
  C1:
    CPU: 2
    Memory: 1G
  C2:
    CPU: 1
    Memory: 1G

Result: CPU: 3, Memory: 3G

func (ResourceCalculator) ComputeRequiredGPUMemoryGB

func (r ResourceCalculator) ComputeRequiredGPUMemoryGB(resourceList v1.ResourceList) int64

Jump to

Keyboard shortcuts

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