api

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2022 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateOrUpdateMpaCheckpoint

func CreateOrUpdateMpaCheckpoint(mpaCheckpointClient vpa_api.VerticalPodAutoscalerCheckpointInterface,
	mpaCheckpoint *vpa_types.VerticalPodAutoscalerCheckpoint) error

CreateOrUpdateMpaCheckpoint updates the status field of the MPA Checkpoint API object. If object doesn't exits it is created.

func GetUpdateMode added in v0.3.0

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

func NewMpasLister

func NewMpasLister(mpaClient *mpa_clientset.Clientset, stopChannel <-chan struct{}, namespace string) mpa_lister.MultidimPodAutoscalerLister

NewMpasLister returns MultidimPodAutoscalerLister configured to fetch all MPA objects from namespace, set namespace to k8sapiv1.NamespaceAll to select all namespaces. The method blocks until mpaLister is initially populated.

func PodLabelsMatchMPA added in v0.3.0

func PodLabelsMatchMPA(podNamespace string, labels labels.Set, mpaNamespace string, mpaSelector labels.Selector) bool

PodLabelsMatchMPA returns true iff the mpaWithSelector matches the pod labels.

func PodMatchesMPA added in v0.3.0

func PodMatchesMPA(pod *core.Pod, mpaWithSelector *MpaWithSelector) bool

PodMatchesMPA returns true iff the mpaWithSelector matches the Pod.

func UpdateMpaStatusIfNeeded

func UpdateMpaStatusIfNeeded(mpaClient mpa_api.MultidimPodAutoscalerInterface, mpaName string, newStatus,
	oldStatus *mpa_types.MultidimPodAutoscalerStatus) (result *mpa_types.MultidimPodAutoscaler, err error)

UpdateMpaStatusIfNeeded updates the status field of the MPA API object.

Types

type ContainerToAnnotationsMap added in v0.3.0

type ContainerToAnnotationsMap = map[string][]string

ContainerToAnnotationsMap contains annotations per container.

type MpaWithSelector added in v0.3.0

type MpaWithSelector struct {
	Mpa      *mpa_types.MultidimPodAutoscaler
	Selector labels.Selector
}

MpaWithSelector is a pair of MPA and its selector.

func GetControllingMPAForPod added in v0.3.0

func GetControllingMPAForPod(pod *core.Pod, mpas []*MpaWithSelector) *MpaWithSelector

GetControllingMPAForPod chooses the earliest created MPA from the input list that matches the given Pod.

type RecommendationProcessor added in v0.3.0

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 []mpa_types.MultidimPodAutoscalerCondition,
		pod *v1.Pod) (*vpa_types.RecommendedPodResources, ContainerToAnnotationsMap, error)
}

RecommendationProcessor post-processes recommendation adjusting it to limits and environment context

func NewCappingRecommendationProcessor added in v0.3.0

func NewCappingRecommendationProcessor(limitsRangeCalculator limitrange.LimitRangeCalculator) RecommendationProcessor

NewCappingRecommendationProcessor constructs new RecommendationsProcessor that adjusts recommendation for given pod to obey MPA resources policy and container limits

Jump to

Keyboard shortcuts

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