api

package
v0.0.0-...-0a82f0e Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2019 License: Apache-2.0 Imports: 18 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 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 GetControllingVPAForPod

func GetControllingVPAForPod(pod *core.Pod, vpas []*vpa_types.VerticalPodAutoscaler) *vpa_types.VerticalPodAutoscaler

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

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 PodMatchesVPA

func PodMatchesVPA(pod *core.Pod, vpa *vpa_types.VerticalPodAutoscaler) bool

PodMatchesVPA returns true iff the VPA's selector matches the Pod and they are in the same namespace.

func UpdateVpaStatusIfNeeded

func UpdateVpaStatusIfNeeded(vpaClient vpa_api.VerticalPodAutoscalerInterface, vpa *model.Vpa,
	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 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() 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

Jump to

Keyboard shortcuts

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