Documentation ¶
Index ¶
- func ApplyVPAPolicy(podRecommendation *vpa_types.RecommendedPodResources, ...) (*vpa_types.RecommendedPodResources, error)
- func CreateOrUpdateVpaCheckpoint(vpaCheckpointClient vpa_api.VerticalPodAutoscalerCheckpointInterface, ...) error
- func GetBoundaryRequest(resourceName core.ResourceName, ...) *resource.Quantity
- func GetContainerControlledValues(name string, vpaResourcePolicy *vpa_types.PodResourcePolicy) vpa_types.ContainerControlledValues
- func GetContainerResourcePolicy(containerName string, policy *vpa_types.PodResourcePolicy) *vpa_types.ContainerResourcePolicy
- func GetProportionalLimit(originalLimit, originalRequest, recommendation, defaultLimit core.ResourceList) (core.ResourceList, []string)
- func GetRecommendationForContainer(containerName string, recommendation *vpa_types.RecommendedPodResources) *vpa_types.RecommendedContainerResources
- func GetUpdateMode(vpa *vpa_types.VerticalPodAutoscaler) vpa_types.UpdateMode
- func NewVpasLister(vpaClient *vpa_clientset.Clientset, stopChannel <-chan struct{}, ...) vpa_lister.VerticalPodAutoscalerLister
- func PodLabelsMatchVPA(podNamespace string, labels labels.Set, vpaNamespace string, ...) bool
- func PodMatchesVPA(pod *core.Pod, vpaWithSelector *VpaWithSelector) bool
- func UpdateVpaStatusIfNeeded(vpaClient vpa_api.VerticalPodAutoscalerInterface, vpaName string, ...) (result *vpa_types.VerticalPodAutoscaler, err error)
- type ContainerResources
- type ContainerToAnnotationsMap
- type RecommendationProcessor
- type VpaWithSelector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyVPAPolicy ¶
func ApplyVPAPolicy(podRecommendation *vpa_types.RecommendedPodResources, policy *vpa_types.PodResourcePolicy) (*vpa_types.RecommendedPodResources, error)
ApplyVPAPolicy returns a recommendation, adjusted to obey policy.
func CreateOrUpdateVpaCheckpoint ¶
func CreateOrUpdateVpaCheckpoint(vpaCheckpointClient vpa_api.VerticalPodAutoscalerCheckpointInterface, vpaCheckpoint *vpa_types.VerticalPodAutoscalerCheckpoint) error
CreateOrUpdateVpaCheckpoint updates the status field of the VPA Checkpoint API object. If object doesn't exits it is created.
func GetBoundaryRequest ¶
func GetBoundaryRequest(resourceName core.ResourceName, originalRequest, originalLimit, boundaryLimit, defaultLimit *resource.Quantity) *resource.Quantity
GetBoundaryRequest returns the boundary (min/max) request that can be specified with preserving the original limit to request ratio. Returns nil if no boundary exists
func GetContainerControlledValues ¶
func GetContainerControlledValues(name string, vpaResourcePolicy *vpa_types.PodResourcePolicy) vpa_types.ContainerControlledValues
GetContainerControlledValues returns controlled resource values
func GetContainerResourcePolicy ¶
func GetContainerResourcePolicy(containerName string, policy *vpa_types.PodResourcePolicy) *vpa_types.ContainerResourcePolicy
GetContainerResourcePolicy returns the ContainerResourcePolicy for a given policy and container name. It returns nil if there is no policy specified for the container.
func GetProportionalLimit ¶
func GetProportionalLimit(originalLimit, originalRequest, recommendation, defaultLimit core.ResourceList) (core.ResourceList, []string)
GetProportionalLimit returns limit that will be in the same proportion to recommended request as original limit had to original request.
func GetRecommendationForContainer ¶
func GetRecommendationForContainer(containerName string, recommendation *vpa_types.RecommendedPodResources) *vpa_types.RecommendedContainerResources
GetRecommendationForContainer returns recommendation for given container name
func GetUpdateMode ¶
func GetUpdateMode(vpa *vpa_types.VerticalPodAutoscaler) vpa_types.UpdateMode
GetUpdateMode returns the updatePolicy.updateMode for a given VPA. If the mode is not specified it returns the default (UpdateModeAuto).
func NewVpasLister ¶
func NewVpasLister(vpaClient *vpa_clientset.Clientset, stopChannel <-chan struct{}, namespace string) vpa_lister.VerticalPodAutoscalerLister
NewVpasLister returns VerticalPodAutoscalerLister configured to fetch all VPA objects from namespace, set namespace to k8sapiv1.NamespaceAll to select all namespaces. The method blocks until vpaLister is initially populated.
func PodLabelsMatchVPA ¶
func PodLabelsMatchVPA(podNamespace string, labels labels.Set, vpaNamespace string, vpaSelector labels.Selector) bool
PodLabelsMatchVPA returns true iff the vpaWithSelector matches the pod labels.
func PodMatchesVPA ¶
func PodMatchesVPA(pod *core.Pod, vpaWithSelector *VpaWithSelector) bool
PodMatchesVPA returns true iff the vpaWithSelector matches the Pod.
func UpdateVpaStatusIfNeeded ¶
func UpdateVpaStatusIfNeeded(vpaClient vpa_api.VerticalPodAutoscalerInterface, vpaName string, newStatus, oldStatus *vpa_types.VerticalPodAutoscalerStatus) (result *vpa_types.VerticalPodAutoscaler, err error)
UpdateVpaStatusIfNeeded updates the status field of the VPA API object.
Types ¶
type ContainerResources ¶
type ContainerResources struct { Limits core.ResourceList Requests core.ResourceList }
ContainerResources holds resources request for container
func (*ContainerResources) RemoveEmptyResourceKeyIfAny ¶ added in v1.0.0
func (cr *ContainerResources) RemoveEmptyResourceKeyIfAny() bool
RemoveEmptyResourceKeyIfAny ensure that we are not pushing a resource with an empty key. Return true if an empty key was eliminated
type ContainerToAnnotationsMap ¶
ContainerToAnnotationsMap contains annotations per container.
type RecommendationProcessor ¶
type RecommendationProcessor interface { // Apply processes and updates recommendation for given pod, based on container limits, // VPA policy and possibly other internal RecommendationProcessor context. // Must return a non-nil pointer to RecommendedPodResources or error. Apply(podRecommendation *vpa_types.RecommendedPodResources, policy *vpa_types.PodResourcePolicy, conditions []vpa_types.VerticalPodAutoscalerCondition, pod *v1.Pod) (*vpa_types.RecommendedPodResources, ContainerToAnnotationsMap, error) }
RecommendationProcessor post-processes recommendation adjusting it to limits and environment context
func NewCappingRecommendationProcessor ¶
func NewCappingRecommendationProcessor(limitsRangeCalculator limitrange.LimitRangeCalculator) RecommendationProcessor
NewCappingRecommendationProcessor constructs new RecommendationsProcessor that adjusts recommendation for given pod to obey VPA resources policy and container limits
func NewSequentialProcessor ¶
func NewSequentialProcessor(processors []RecommendationProcessor) RecommendationProcessor
NewSequentialProcessor constructs RecommendationProcessor that will use provided RecommendationProcessor objects
type VpaWithSelector ¶
type VpaWithSelector struct { Vpa *vpa_types.VerticalPodAutoscaler Selector labels.Selector }
VpaWithSelector is a pair of VPA and its selector.
func GetControllingVPAForPod ¶
func GetControllingVPAForPod(pod *core.Pod, vpas []*VpaWithSelector, ctrlFetcher controllerfetcher.ControllerFetcher) *VpaWithSelector
GetControllingVPAForPod chooses the earliest created VPA from the input list that matches the given Pod.