resources

package
v0.27.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddResourceRequirements

func AddResourceRequirements(resources, toAdd *corev1.ResourceRequirements) *corev1.ResourceRequirements

Adds the resource limits and requests that are set in the component "toAdd" to "resources". Returns an error if the "resources" defined in "toAdd" could not be parsed.

Note: only resources that are set in the argument "resources" will be summed with the resources set in "toAdd". For example, if "resources" does not set a CPU limit but "toAdd" does set a CPU limit, the CPU limit of "resources" will remain unset.

func ApplyDefaults

func ApplyDefaults(resources, defaults *corev1.ResourceRequirements) *corev1.ResourceRequirements

func ApplyResourceRequirementsToComponent

func ApplyResourceRequirementsToComponent(container *dw.ContainerComponent, resources *corev1.ResourceRequirements)

Applies the given resource limits and requirements that are non-zero to the container component. If a resource limit or request has a value of zero, then the corresponding limit or request is not set in the container component's resource requirements.

func FilterResources

func FilterResources(resources *corev1.ResourceRequirements) *corev1.ResourceRequirements

FilterResources removes zero values from a corev1.ResourceRequirements in order to allow explicitly defining "do not set a limit/request" for a resource. Any request/limit that has a zero value is removed from the returned corev1.ResourceRequirements.

func ParseResourcesFromComponent

func ParseResourcesFromComponent(component *dw.Component) (*corev1.ResourceRequirements, error)

Takes a component and returns the resource requests and limits that it defines. If a resource request or limit is not defined within the component, it will not be populated in the corresponding corev1.ResourceList map.

Returns an error if a non-container component is passed to the function, or if an error occurs while parsing a resource limit or request.

func ValidateResources

func ValidateResources(resources *corev1.ResourceRequirements) error

ValidateResources validates that a corev1.ResourceRequirements is valid, i.e. that (if specified), limits are greater than or equal to requests

Types

This section is empty.

Jump to

Keyboard shortcuts

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