Documentation ¶
Index ¶
- func ApplyVPAPolicy(podRecommendation *vpa_types.RecommendedPodResources, ...) (*vpa_types.RecommendedPodResources, error)
- func CreateOrUpdateVpaCheckpoint(vpaCheckpointClient vpa_api.VerticalPodAutoscalerCheckpointInterface, ...) error
- func GetContainerResourcePolicy(containerName string, policy *vpa_types.PodResourcePolicy) *vpa_types.ContainerResourcePolicy
- func GetControllingVPAForPod(pod *core.Pod, vpas []*vpa_types.VerticalPodAutoscaler) *vpa_types.VerticalPodAutoscaler
- func GetRecommendationForContainer(containerName string, recommendation *vpa_types.RecommendedPodResources) *vpa_types.RecommendedContainerResources
- func GetUpdateMode(vpa *vpa_types.VerticalPodAutoscaler) vpa_types.UpdateMode
- func NewAllVpasLister(vpaClient *vpa_clientset.Clientset, stopChannel <-chan struct{}) vpa_lister.VerticalPodAutoscalerLister
- func PodMatchesVPA(pod *core.Pod, vpa *vpa_types.VerticalPodAutoscaler) bool
- func UpdateVpaStatusIfNeeded(vpaClient vpa_api.VerticalPodAutoscalerInterface, vpa *model.Vpa, ...) (result *vpa_types.VerticalPodAutoscaler, err error)
- type ContainerToAnnotationsMap
- type RecommendationProcessor
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 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 ¶
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 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 ¶
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