HorizontalPodAutoscaler status

This commit is contained in:
Marcin Wielgus
2015-08-18 11:46:54 +02:00
parent 8e2cad79ea
commit cac7038b3b
7 changed files with 193 additions and 59 deletions

View File

@@ -31,6 +31,7 @@ package expapi
import (
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/resource"
"k8s.io/kubernetes/pkg/util"
)
// ScaleSpec describes the attributes a Scale subresource
@@ -74,8 +75,8 @@ type SubresourceReference struct {
Subresource string `json:"subresource,omitempty"`
}
// TargetConsumption is an object for specifying target average resource consumption of a particular resource.
type TargetConsumption struct {
// ResourceConsumption is an object for specifying average resource consumption of a particular resource.
type ResourceConsumption struct {
Resource api.ResourceName `json:"resource,omitempty"`
Quantity resource.Quantity `json:"quantity,omitempty"`
}
@@ -91,7 +92,27 @@ type HorizontalPodAutoscalerSpec struct {
MaxCount int `json:"maxCount"`
// Target is the target average consumption of the given resource that the autoscaler will try to maintain by adjusting the desired number of pods.
// Currently two types of resources are supported: "cpu" and "memory".
Target TargetConsumption `json:"target"`
Target ResourceConsumption `json:"target"`
}
// HorizontalPodAutoscalerStatus contains the current status of a horizontal pod autoscaler
type HorizontalPodAutoscalerStatus struct {
// CurrentReplicas is the number of replicas of pods managed by this autoscaler.
CurrentReplicas int `json:"replicas"`
// DesiredReplicas is the desired number of replicas of pods managed by this autoscaler.
// The number may be different because pod downscaling is someteimes delayed to keep the number
// of pods stable.
DesiredReplicas int `json:"replicas"`
// CurrentConsumption is the current average consumption of the given resource that the autoscaler will
// try to maintain by adjusting the desired number of pods.
// Two types of resources are supported: "cpu" and "memory".
CurrentConsumption ResourceConsumption `json:"currentConsumption"`
// LastScaleTimestamp is the last time the HorizontalPodAutoscaler scaled the number of pods.
// This is used by the autoscaler to controll how often the number of pods is changed.
LastScaleTimestamp *util.Time `json:"lastScaleTimestamp,omitempty"`
}
// HorizontalPodAutoscaler represents the configuration of a horizontal pod autoscaler.
@@ -101,6 +122,9 @@ type HorizontalPodAutoscaler struct {
// Spec defines the behaviour of autoscaler.
Spec HorizontalPodAutoscalerSpec `json:"spec,omitempty"`
// Status represents the current information about the autoscaler.
Status HorizontalPodAutoscalerStatus `json:"status,omitempty"`
}
// HorizontalPodAutoscaler is a collection of pod autoscalers.