Skip to main content

ToK8sResourceList

Converts a list of generic resource entries into a Kubernetes-specific v1.ResourceList.

def ToK8sResourceList(
resources: []*core.Resources_ResourceEntry
) - > v1.ResourceList, error

Converts a slice of generic resource entries into a Kubernetes-specific resource list. This function is used to transform a list of resource requests or limits, such as CPU, memory, or GPU, into a format compatible with Kubernetes resource specifications.

Parameters​

NameTypeDescription
resources[]*core.Resources_ResourceEntryA slice of generic resource entries, where each entry specifies a resource name (e.g., CPU, MEMORY, GPU) and its string representation of quantity.

Returns​

TypeDescription
v1.ResourceList, errorA Kubernetes ResourceList containing the parsed resource quantities, or an error if any resource value cannot be parsed as a valid quantity.