if field_name not in container_resources:
// No limit/resource field.
return float("inf")
resources = container_resources[field_name]
// Look for keys containing the resource_name. For example,
// the key "nvidia.com/gpu" contains the key "gpu".
matching_keys = [key for key in resources if resource_name in key.lower()]
if len(matching_keys) == 0:
return float("inf")
if len(matching_keys) > 1:
// Should have only one match -- mostly relevant for gpu.