traefik/vendor/k8s.io/client-go/pkg/apis/autoscaling/types.go

136 lines
5.3 KiB
Go
Raw Normal View History

2017-02-07 21:33:23 +00:00
/*
Copyright 2016 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package autoscaling
import (
2017-04-07 10:49:53 +00:00
"k8s.io/client-go/pkg/api"
"k8s.io/client-go/pkg/api/unversioned"
2017-02-07 21:33:23 +00:00
)
// Scale represents a scaling request for a resource.
type Scale struct {
unversioned.TypeMeta `json:",inline"`
// Standard object metadata; More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#metadata.
2017-04-07 10:49:53 +00:00
// +optional
2017-02-07 21:33:23 +00:00
api.ObjectMeta `json:"metadata,omitempty"`
// defines the behavior of the scale. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status.
2017-04-07 10:49:53 +00:00
// +optional
2017-02-07 21:33:23 +00:00
Spec ScaleSpec `json:"spec,omitempty"`
// current status of the scale. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status. Read-only.
2017-04-07 10:49:53 +00:00
// +optional
2017-02-07 21:33:23 +00:00
Status ScaleStatus `json:"status,omitempty"`
}
// ScaleSpec describes the attributes of a scale subresource.
type ScaleSpec struct {
// desired number of instances for the scaled object.
2017-04-07 10:49:53 +00:00
// +optional
2017-02-07 21:33:23 +00:00
Replicas int32 `json:"replicas,omitempty"`
}
// ScaleStatus represents the current status of a scale subresource.
type ScaleStatus struct {
// actual number of observed instances of the scaled object.
Replicas int32 `json:"replicas"`
// label query over pods that should match the replicas count. This is same
// as the label selector but in the string format to avoid introspection
// by clients. The string will be in the same format as the query-param syntax.
2017-04-07 10:49:53 +00:00
// More info: http://kubernetes.io/docs/user-guide/labels#label-selectors
// +optional
2017-02-07 21:33:23 +00:00
Selector string `json:"selector,omitempty"`
}
// CrossVersionObjectReference contains enough information to let you identify the referred resource.
type CrossVersionObjectReference struct {
// Kind of the referent; More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#types-kinds"
Kind string `json:"kind" protobuf:"bytes,1,opt,name=kind"`
2017-04-07 10:49:53 +00:00
// Name of the referent; More info: http://kubernetes.io/docs/user-guide/identifiers#names
2017-02-07 21:33:23 +00:00
Name string `json:"name" protobuf:"bytes,2,opt,name=name"`
// API version of the referent
2017-04-07 10:49:53 +00:00
// +optional
2017-02-07 21:33:23 +00:00
APIVersion string `json:"apiVersion,omitempty" protobuf:"bytes,3,opt,name=apiVersion"`
}
// specification of a horizontal pod autoscaler.
type HorizontalPodAutoscalerSpec struct {
// reference to scaled resource; horizontal pod autoscaler will learn the current resource consumption
// and will set the desired number of pods by using its Scale subresource.
ScaleTargetRef CrossVersionObjectReference `json:"scaleTargetRef"`
// lower limit for the number of pods that can be set by the autoscaler, default 1.
2017-04-07 10:49:53 +00:00
// +optional
2017-02-07 21:33:23 +00:00
MinReplicas *int32 `json:"minReplicas,omitempty"`
// upper limit for the number of pods that can be set by the autoscaler. It cannot be smaller than MinReplicas.
MaxReplicas int32 `json:"maxReplicas"`
// target average CPU utilization (represented as a percentage of requested CPU) over all the pods;
// if not specified the default autoscaling policy will be used.
2017-04-07 10:49:53 +00:00
// +optional
2017-02-07 21:33:23 +00:00
TargetCPUUtilizationPercentage *int32 `json:"targetCPUUtilizationPercentage,omitempty"`
}
// current status of a horizontal pod autoscaler
type HorizontalPodAutoscalerStatus struct {
// most recent generation observed by this autoscaler.
2017-04-07 10:49:53 +00:00
// +optional
2017-02-07 21:33:23 +00:00
ObservedGeneration *int64 `json:"observedGeneration,omitempty"`
// last time the HorizontalPodAutoscaler scaled the number of pods;
// used by the autoscaler to control how often the number of pods is changed.
2017-04-07 10:49:53 +00:00
// +optional
2017-02-07 21:33:23 +00:00
LastScaleTime *unversioned.Time `json:"lastScaleTime,omitempty"`
// current number of replicas of pods managed by this autoscaler.
CurrentReplicas int32 `json:"currentReplicas"`
// desired number of replicas of pods managed by this autoscaler.
DesiredReplicas int32 `json:"desiredReplicas"`
// current average CPU utilization over all pods, represented as a percentage of requested CPU,
// e.g. 70 means that an average pod is using now 70% of its requested CPU.
2017-04-07 10:49:53 +00:00
// +optional
2017-02-07 21:33:23 +00:00
CurrentCPUUtilizationPercentage *int32 `json:"currentCPUUtilizationPercentage,omitempty"`
}
// +genclient=true
// configuration of a horizontal pod autoscaler.
type HorizontalPodAutoscaler struct {
unversioned.TypeMeta `json:",inline"`
2017-04-07 10:49:53 +00:00
// +optional
api.ObjectMeta `json:"metadata,omitempty"`
2017-02-07 21:33:23 +00:00
// behaviour of autoscaler. More info: http://releases.k8s.io/HEAD/docs/devel/api-conventions.md#spec-and-status.
2017-04-07 10:49:53 +00:00
// +optional
2017-02-07 21:33:23 +00:00
Spec HorizontalPodAutoscalerSpec `json:"spec,omitempty"`
// current information about the autoscaler.
2017-04-07 10:49:53 +00:00
// +optional
2017-02-07 21:33:23 +00:00
Status HorizontalPodAutoscalerStatus `json:"status,omitempty"`
}
// list of horizontal pod autoscaler objects.
type HorizontalPodAutoscalerList struct {
unversioned.TypeMeta `json:",inline"`
2017-04-07 10:49:53 +00:00
// +optional
2017-02-07 21:33:23 +00:00
unversioned.ListMeta `json:"metadata,omitempty"`
// list of horizontal pod autoscaler objects.
Items []HorizontalPodAutoscaler `json:"items"`
}