api

package
v0.0.0-...-34f7b3f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 30, 2019 License: GPL-3.0, Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyVPAPolicy

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(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 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

GetUpdateMode returns the updatePolicy.updateMode for a given VPA. If the mode is not specified it returns the default (UpdateModeAuto).

func NewAllVpasLister

func NewAllVpasLister(vpaClient *vpa_clientset.Clientset, stopChannel <-chan struct{}) vpa_lister.VerticalPodAutoscalerLister

NewAllVpasLister returns VerticalPodAutoscalerLister configured to fetch all VPA objects. 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. It prevents race conditions by verifying that the lastUpdateTime of the API object and its model representation are equal.

Types

type ContainerResources

type ContainerResources struct {
	Limits   core.ResourceList
	Requests core.ResourceList
}

ContainerResources holds resources request for container

type ContainerToAnnotationsMap

type ContainerToAnnotationsMap = map[string][]string

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) *VpaWithSelector

GetControllingVPAForPod chooses the earliest created VPA from the input list that matches the given Pod.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL