Documentation ¶
Overview ¶
Package fieldpath supplies methods for extracting fields from objects given a path to a field.
Index ¶
- func ExtractContainerResourceValue(fs *v1.ResourceFieldSelector, container *v1.Container) (string, error)
- func ExtractFieldPathAsString(obj interface{}, fieldPath string) (string, error)
- func ExtractResourceValueByContainerName(fs *v1.ResourceFieldSelector, pod *v1.Pod, containerName string) (string, error)
- func ExtractResourceValueByContainerNameAndNodeAllocatable(fs *v1.ResourceFieldSelector, pod *v1.Pod, containerName string, ...) (string, error)
- func FormatMap(m map[string]string) (fmtStr string)
- func InternalExtractContainerResourceValue(fs *api.ResourceFieldSelector, container *api.Container) (string, error)
- func MergeContainerResourceLimits(container *v1.Container, allocatable v1.ResourceList)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractContainerResourceValue ¶
func ExtractContainerResourceValue(fs *v1.ResourceFieldSelector, container *v1.Container) (string, error)
ExtractContainerResourceValue extracts the value of a resource in an already known container
func ExtractFieldPathAsString ¶
ExtractFieldPathAsString extracts the field from the given object and returns it as a string. The object must be a pointer to an API type.
Currently, this API is limited to supporting the fieldpaths:
1. metadata.name - The name of an API object 2. metadata.namespace - The namespace of an API object
func ExtractResourceValueByContainerName ¶
func ExtractResourceValueByContainerName(fs *v1.ResourceFieldSelector, pod *v1.Pod, containerName string) (string, error)
TODO: move the functions below to pkg/api/util/resources ExtractResourceValueByContainerName extracts the value of a resource by providing container name
func ExtractResourceValueByContainerNameAndNodeAllocatable ¶
func ExtractResourceValueByContainerNameAndNodeAllocatable(fs *v1.ResourceFieldSelector, pod *v1.Pod, containerName string, nodeAllocatable v1.ResourceList) (string, error)
ExtractResourceValueByContainerNameAndNodeAllocatable extracts the value of a resource by providing container name and node allocatable
func InternalExtractContainerResourceValue ¶
func InternalExtractContainerResourceValue(fs *api.ResourceFieldSelector, container *api.Container) (string, error)
TODO: remove this duplicate InternalExtractContainerResourceValue extracts the value of a resource in an already known container
func MergeContainerResourceLimits ¶
func MergeContainerResourceLimits(container *v1.Container, allocatable v1.ResourceList)
MergeContainerResourceLimits checks if a limit is applied for the container, and if not, it sets the limit to the passed resource list.
Types ¶
This section is empty.