Skip to main content

CalculateStorageSize

Calculates the storage size from the provided resource requirements. It first checks for storage limits, then storage requests, and returns the quantity if found, otherwise nil.

def CalculateStorageSize(
requirements: *v1.ResourceRequirements
) - > *resource.Quantity

Calculates the storage size based on resource requirements. This function is used to determine the storage quantity requested or limited for a resource.

Parameters

NameTypeDescription
requirements*v1.ResourceRequirementsThe resource requirements object containing storage limits and requests. If nil, the function returns nil.

Returns

TypeDescription
*resource.QuantityThe storage quantity if specified in either limits or requests, otherwise nil.