Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
8a002d85
Commit
8a002d85
authored
Feb 20, 2018
by
Maciej Pytel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add external metric type to HPA API
parent
c7414323
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
172 additions
and
0 deletions
+172
-0
types.go
pkg/apis/autoscaling/types.go
+57
-0
types.go
staging/src/k8s.io/api/autoscaling/v1/types.go
+57
-0
types.go
staging/src/k8s.io/api/autoscaling/v2beta1/types.go
+58
-0
No files found.
pkg/apis/autoscaling/types.go
View file @
8a002d85
...
@@ -111,6 +111,12 @@ var (
...
@@ -111,6 +111,12 @@ var (
// Kubernetes, and have special scaling options on top of those available
// Kubernetes, and have special scaling options on top of those available
// to normal per-pod metrics (the "pods" source).
// to normal per-pod metrics (the "pods" source).
ResourceMetricSourceType
MetricSourceType
=
"Resource"
ResourceMetricSourceType
MetricSourceType
=
"Resource"
// ExternalMetricSourceType is a global metric that is not associated
// with any Kubernetes object. It allows autoscaling based on information
// coming from components running outside of cluster
// (for example length of queue in cloud messaging service, or
// QPS from loadbalancer running outside of cluster).
ExternalMetricSourceType
MetricSourceType
=
"External"
)
)
// MetricSpec specifies how to scale based on a single metric
// MetricSpec specifies how to scale based on a single metric
...
@@ -136,6 +142,13 @@ type MetricSpec struct {
...
@@ -136,6 +142,13 @@ type MetricSpec struct {
// to normal per-pod metrics using the "pods" source.
// to normal per-pod metrics using the "pods" source.
// +optional
// +optional
Resource
*
ResourceMetricSource
Resource
*
ResourceMetricSource
// External refers to a global metric that is not associated
// with any Kubernetes object. It allows autoscaling based on information
// coming from components running outside of cluster
// (for example length of queue in cloud messaging service, or
// QPS from loadbalancer running outside of cluster).
// +optional
External
*
ExternalMetricSource
}
}
// ObjectMetricSource indicates how to scale on a metric describing a
// ObjectMetricSource indicates how to scale on a metric describing a
...
@@ -184,6 +197,26 @@ type ResourceMetricSource struct {
...
@@ -184,6 +197,26 @@ type ResourceMetricSource struct {
TargetAverageValue
*
resource
.
Quantity
TargetAverageValue
*
resource
.
Quantity
}
}
// ExternalMetricSource indicates how to scale on a metric not associated with
// any Kubernetes object (for example length of queue in cloud
// messaging service, or QPS from loadbalancer running outside of cluster).
type
ExternalMetricSource
struct
{
// metricName is the name of the metric in question.
MetricName
string
// MetricSelector is used to identify a specific time series
// within a given metric.
// +optional
MetricSelector
*
metav1
.
LabelSelector
// TargetValue is the target value of the metric (as a quantity).
// Mutually exclusive with TargetAverageValue.
// +optional
TargetValue
*
resource
.
Quantity
// TargetAverageValue is the target per-pod value of global metric (as a quantity).
// Mutually exclusive with TargetValue.
// +optional
TargetAverageValue
*
resource
.
Quantity
}
// HorizontalPodAutoscalerStatus describes the current status of a horizontal pod autoscaler.
// HorizontalPodAutoscalerStatus describes the current status of a horizontal pod autoscaler.
type
HorizontalPodAutoscalerStatus
struct
{
type
HorizontalPodAutoscalerStatus
struct
{
// ObservedGeneration is the most recent generation observed by this autoscaler.
// ObservedGeneration is the most recent generation observed by this autoscaler.
...
@@ -282,6 +315,13 @@ type MetricStatus struct {
...
@@ -282,6 +315,13 @@ type MetricStatus struct {
// to normal per-pod metrics using the "pods" source.
// to normal per-pod metrics using the "pods" source.
// +optional
// +optional
Resource
*
ResourceMetricStatus
Resource
*
ResourceMetricStatus
// External refers to a global metric that is not associated
// with any Kubernetes object. It allows autoscaling based on information
// coming from components running outside of cluster
// (for example length of queue in cloud messaging service, or
// QPS from loadbalancer running outside of cluster).
// +optional
External
*
ExternalMetricStatus
}
}
// ObjectMetricStatus indicates the current value of a metric describing a
// ObjectMetricStatus indicates the current value of a metric describing a
...
@@ -328,6 +368,23 @@ type ResourceMetricStatus struct {
...
@@ -328,6 +368,23 @@ type ResourceMetricStatus struct {
CurrentAverageValue
resource
.
Quantity
CurrentAverageValue
resource
.
Quantity
}
}
// ExternalMetricStatus indicates the current value of a global metric
// not associated with any Kubernetes object.
type
ExternalMetricStatus
struct
{
// MetricName is the name of a metric used for autoscaling in
// metric system.
MetricName
string
// MetricSelector is used to identify a specific time series
// within a given metric.
// +optional
MetricSelector
*
metav1
.
LabelSelector
// CurrentValue is the current value of the metric (as a quantity)
CurrentValue
resource
.
Quantity
// CurrentAverageValue is the current value of metric averaged over autoscaled pods.
// +optional
CurrentAverageValue
*
resource
.
Quantity
}
// +genclient
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
...
...
staging/src/k8s.io/api/autoscaling/v1/types.go
View file @
8a002d85
...
@@ -161,6 +161,12 @@ var (
...
@@ -161,6 +161,12 @@ var (
// Kubernetes, and have special scaling options on top of those available
// Kubernetes, and have special scaling options on top of those available
// to normal per-pod metrics (the "pods" source).
// to normal per-pod metrics (the "pods" source).
ResourceMetricSourceType
MetricSourceType
=
"Resource"
ResourceMetricSourceType
MetricSourceType
=
"Resource"
// ExternalMetricSourceType is a global metric that is not associated
// with any Kubernetes object. It allows autoscaling based on information
// coming from components running outside of cluster
// (for example length of queue in cloud messaging service, or
// QPS from loadbalancer running outside of cluster).
ExternalMetricSourceType
MetricSourceType
=
"External"
)
)
// MetricSpec specifies how to scale based on a single metric
// MetricSpec specifies how to scale based on a single metric
...
@@ -186,6 +192,13 @@ type MetricSpec struct {
...
@@ -186,6 +192,13 @@ type MetricSpec struct {
// to normal per-pod metrics using the "pods" source.
// to normal per-pod metrics using the "pods" source.
// +optional
// +optional
Resource
*
ResourceMetricSource
`json:"resource,omitempty" protobuf:"bytes,4,opt,name=resource"`
Resource
*
ResourceMetricSource
`json:"resource,omitempty" protobuf:"bytes,4,opt,name=resource"`
// external refers to a global metric that is not associated
// with any Kubernetes object. It allows autoscaling based on information
// coming from components running outside of cluster
// (for example length of queue in cloud messaging service, or
// QPS from loadbalancer running outside of cluster).
// +optional
External
*
ExternalMetricSource
`json:"external,omitempty" protobuf:"bytes,5,opt,name=external"`
}
}
// ObjectMetricSource indicates how to scale on a metric describing a
// ObjectMetricSource indicates how to scale on a metric describing a
...
@@ -234,6 +247,26 @@ type ResourceMetricSource struct {
...
@@ -234,6 +247,26 @@ type ResourceMetricSource struct {
TargetAverageValue
*
resource
.
Quantity
`json:"targetAverageValue,omitempty" protobuf:"bytes,3,opt,name=targetAverageValue"`
TargetAverageValue
*
resource
.
Quantity
`json:"targetAverageValue,omitempty" protobuf:"bytes,3,opt,name=targetAverageValue"`
}
}
// ExternalMetricSource indicates how to scale on a metric not associated with
// any Kubernetes object (for example length of queue in cloud
// messaging service, or QPS from loadbalancer running outside of cluster).
type
ExternalMetricSource
struct
{
// metricName is the name of the metric in question.
MetricName
string
`json:"metricName" protobuf:"bytes,1,name=metricName"`
// metricSelector is used to identify a specific time series
// within a given metric.
// +optional
MetricSelector
*
metav1
.
LabelSelector
`json:"metricSelector,omitempty" protobuf:"bytes,2,opt,name=metricSelector"`
// targetValue is the target value of the metric (as a quantity).
// Mutually exclusive with TargetAverageValue.
// +optional
TargetValue
*
resource
.
Quantity
`json:"targetValue,omitempty" protobuf:"bytes,3,opt,name=targetValue"`
// targetAverageValue is the target per-pod value of global metric (as a quantity).
// Mutually exclusive with TargetValue.
// +optional
TargetAverageValue
*
resource
.
Quantity
`json:"targetAverageValue,omitempty" protobuf:"bytes,4,opt,name=targetAverageValue"`
}
// MetricStatus describes the last-read state of a single metric.
// MetricStatus describes the last-read state of a single metric.
type
MetricStatus
struct
{
type
MetricStatus
struct
{
// type is the type of metric source. It will be one of "Object",
// type is the type of metric source. It will be one of "Object",
...
@@ -256,6 +289,13 @@ type MetricStatus struct {
...
@@ -256,6 +289,13 @@ type MetricStatus struct {
// to normal per-pod metrics using the "pods" source.
// to normal per-pod metrics using the "pods" source.
// +optional
// +optional
Resource
*
ResourceMetricStatus
`json:"resource,omitempty" protobuf:"bytes,4,opt,name=resource"`
Resource
*
ResourceMetricStatus
`json:"resource,omitempty" protobuf:"bytes,4,opt,name=resource"`
// external refers to a global metric that is not associated
// with any Kubernetes object. It allows autoscaling based on information
// coming from components running outside of cluster
// (for example length of queue in cloud messaging service, or
// QPS from loadbalancer running outside of cluster).
// +optional
External
*
ExternalMetricStatus
`json:"external,omitempty" protobuf:"bytes,5,opt,name=external"`
}
}
// HorizontalPodAutoscalerConditionType are the valid conditions of
// HorizontalPodAutoscalerConditionType are the valid conditions of
...
@@ -337,3 +377,20 @@ type ResourceMetricStatus struct {
...
@@ -337,3 +377,20 @@ type ResourceMetricStatus struct {
// It will always be set, regardless of the corresponding metric specification.
// It will always be set, regardless of the corresponding metric specification.
CurrentAverageValue
resource
.
Quantity
`json:"currentAverageValue" protobuf:"bytes,3,name=currentAverageValue"`
CurrentAverageValue
resource
.
Quantity
`json:"currentAverageValue" protobuf:"bytes,3,name=currentAverageValue"`
}
}
// ExternalMetricStatus indicates the current value of a global metric
// not associated with any Kubernetes object.
type
ExternalMetricStatus
struct
{
// metricName is the name of a metric used for autoscaling in
// metric system.
MetricName
string
`json:"metricName" protobuf:"bytes,1,name=metricName"`
// metricSelector is used to identify a specific time series
// within a given metric.
// +optional
MetricSelector
*
metav1
.
LabelSelector
`json:"metricSelector,omitempty" protobuf:"bytes,2,opt,name=metricSelector"`
// currentValue is the current value of the metric (as a quantity)
CurrentValue
resource
.
Quantity
`json:"currentValue" protobuf:"bytes,3,name=currentValue"`
// currentAverageValue is the current value of metric averaged over autoscaled pods.
// +optional
CurrentAverageValue
*
resource
.
Quantity
`json:"currentAverageValue,omitempty" protobuf:"bytes,4,opt,name=currentAverageValue"`
}
staging/src/k8s.io/api/autoscaling/v2beta1/types.go
View file @
8a002d85
...
@@ -73,6 +73,12 @@ var (
...
@@ -73,6 +73,12 @@ var (
// Kubernetes, and have special scaling options on top of those available
// Kubernetes, and have special scaling options on top of those available
// to normal per-pod metrics (the "pods" source).
// to normal per-pod metrics (the "pods" source).
ResourceMetricSourceType
MetricSourceType
=
"Resource"
ResourceMetricSourceType
MetricSourceType
=
"Resource"
// ExternalMetricSourceType is a global metric that is not associated
// with any Kubernetes object. It allows autoscaling based on information
// coming from components running outside of cluster
// (for example length of queue in cloud messaging service, or
// QPS from loadbalancer running outside of cluster).
ExternalMetricSourceType
MetricSourceType
=
"External"
)
)
// MetricSpec specifies how to scale based on a single metric
// MetricSpec specifies how to scale based on a single metric
...
@@ -98,6 +104,13 @@ type MetricSpec struct {
...
@@ -98,6 +104,13 @@ type MetricSpec struct {
// to normal per-pod metrics using the "pods" source.
// to normal per-pod metrics using the "pods" source.
// +optional
// +optional
Resource
*
ResourceMetricSource
`json:"resource,omitempty" protobuf:"bytes,4,opt,name=resource"`
Resource
*
ResourceMetricSource
`json:"resource,omitempty" protobuf:"bytes,4,opt,name=resource"`
// external refers to a global metric that is not associated
// with any Kubernetes object. It allows autoscaling based on information
// coming from components running outside of cluster
// (for example length of queue in cloud messaging service, or
// QPS from loadbalancer running outside of cluster).
// +optional
External
*
ExternalMetricSource
`json:"external,omitempty" protobuf:"bytes,5,opt,name=external"`
}
}
// ObjectMetricSource indicates how to scale on a metric describing a
// ObjectMetricSource indicates how to scale on a metric describing a
...
@@ -146,6 +159,27 @@ type ResourceMetricSource struct {
...
@@ -146,6 +159,27 @@ type ResourceMetricSource struct {
TargetAverageValue
*
resource
.
Quantity
`json:"targetAverageValue,omitempty" protobuf:"bytes,3,opt,name=targetAverageValue"`
TargetAverageValue
*
resource
.
Quantity
`json:"targetAverageValue,omitempty" protobuf:"bytes,3,opt,name=targetAverageValue"`
}
}
// ExternalMetricSource indicates how to scale on a metric not associated with
// any Kubernetes object (for example length of queue in cloud
// messaging service, or QPS from loadbalancer running outside of cluster).
// Exactly one "target" type should be set.
type
ExternalMetricSource
struct
{
// metricName is the name of the metric in question.
MetricName
string
`json:"metricName" protobuf:"bytes,1,name=metricName"`
// metricSelector is used to identify a specific time series
// within a given metric.
// +optional
MetricSelector
*
metav1
.
LabelSelector
`json:"metricSelector,omitempty" protobuf:"bytes,2,opt,name=metricSelector"`
// targetValue is the target value of the metric (as a quantity).
// Mutually exclusive with TargetAverageValue.
// +optional
TargetValue
*
resource
.
Quantity
`json:"targetValue,omitempty" protobuf:"bytes,3,opt,name=targetValue"`
// targetAverageValue is the target per-pod value of global metric (as a quantity).
// Mutually exclusive with TargetValue.
// +optional
TargetAverageValue
*
resource
.
Quantity
`json:"targetAverageValue,omitempty" protobuf:"bytes,4,opt,name=targetAverageValue"`
}
// HorizontalPodAutoscalerStatus describes the current status of a horizontal pod autoscaler.
// HorizontalPodAutoscalerStatus describes the current status of a horizontal pod autoscaler.
type
HorizontalPodAutoscalerStatus
struct
{
type
HorizontalPodAutoscalerStatus
struct
{
// observedGeneration is the most recent generation observed by this autoscaler.
// observedGeneration is the most recent generation observed by this autoscaler.
...
@@ -231,6 +265,13 @@ type MetricStatus struct {
...
@@ -231,6 +265,13 @@ type MetricStatus struct {
// to normal per-pod metrics using the "pods" source.
// to normal per-pod metrics using the "pods" source.
// +optional
// +optional
Resource
*
ResourceMetricStatus
`json:"resource,omitempty" protobuf:"bytes,4,opt,name=resource"`
Resource
*
ResourceMetricStatus
`json:"resource,omitempty" protobuf:"bytes,4,opt,name=resource"`
// external refers to a global metric that is not associated
// with any Kubernetes object. It allows autoscaling based on information
// coming from components running outside of cluster
// (for example length of queue in cloud messaging service, or
// QPS from loadbalancer running outside of cluster).
// +optional
External
*
ExternalMetricStatus
`json:"external,omitempty" protobuf:"bytes,5,opt,name=external"`
}
}
// ObjectMetricStatus indicates the current value of a metric describing a
// ObjectMetricStatus indicates the current value of a metric describing a
...
@@ -277,6 +318,23 @@ type ResourceMetricStatus struct {
...
@@ -277,6 +318,23 @@ type ResourceMetricStatus struct {
CurrentAverageValue
resource
.
Quantity
`json:"currentAverageValue" protobuf:"bytes,3,name=currentAverageValue"`
CurrentAverageValue
resource
.
Quantity
`json:"currentAverageValue" protobuf:"bytes,3,name=currentAverageValue"`
}
}
// ExternalMetricStatus indicates the current value of a global metric
// not associated with any Kubernetes object.
type
ExternalMetricStatus
struct
{
// metricName is the name of a metric used for autoscaling in
// metric system.
MetricName
string
`json:"metricName" protobuf:"bytes,1,name=metricName"`
// metricSelector is used to identify a specific time series
// within a given metric.
// +optional
MetricSelector
*
metav1
.
LabelSelector
`json:"metricSelector,omitempty" protobuf:"bytes,2,opt,name=metricSelector"`
// currentValue is the current value of the metric (as a quantity)
CurrentValue
resource
.
Quantity
`json:"currentValue" protobuf:"bytes,3,name=currentValue"`
// currentAverageValue is the current value of metric averaged over autoscaled pods.
// +optional
CurrentAverageValue
*
resource
.
Quantity
`json:"currentAverageValue,omitempty" protobuf:"bytes,4,opt,name=currentAverageValue"`
}
// +genclient
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment