Merge pull request #64890 from liggitt/revert-vpa

Automatic merge from submit-queue (batch tested with PRs 64836, 64890). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>.

Revert: Add Vertical Pod Autoscaler to autoscaling/v2beta1

Reverts https://github.com/kubernetes/kubernetes/pull/63797 per [discussion](https://kubernetes.slack.com/archives/C09R1LV8S/p1528400528000615) with @jberkus and @mwielgus

The scope of the follow-ups required in https://github.com/kubernetes/kubernetes/pull/64286 was not well understood when the API PR was merged, and we are now past code freeze for 1.11

This can be reopened against 1.12

```release-note
NONE
```
pull/8/head
Kubernetes Submit Queue 2018-06-07 16:50:14 -07:00 committed by GitHub
commit 169df74341
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
42 changed files with 193 additions and 5955 deletions

View File

@ -420,210 +420,3 @@ type HorizontalPodAutoscalerList struct {
// Items is the list of horizontal pod autoscaler objects.
Items []HorizontalPodAutoscaler
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// VerticalPodAutoscalerList is a list of VerticalPodAutoscaler objects.
type VerticalPodAutoscalerList struct {
metav1.TypeMeta
// metadata is the standard list metadata.
// +optional
metav1.ListMeta
// items is the list of vertical pod autoscaler objects.
Items []VerticalPodAutoscaler
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// VerticalPodAutoscaler is the configuration for a vertical pod
// autoscaler, which automatically manages pod resources based on historical and
// real time resource utilization.
type VerticalPodAutoscaler struct {
metav1.TypeMeta
// Standard object metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
// +optional
metav1.ObjectMeta
// Specification of the behavior of the autoscaler.
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status.
Spec VerticalPodAutoscalerSpec
// Current information about the autoscaler.
// +optional
Status VerticalPodAutoscalerStatus
}
// VerticalPodAutoscalerSpec is the specification of the behavior of the autoscaler.
type VerticalPodAutoscalerSpec struct {
// A label query that determines the set of pods controlled by the Autoscaler.
// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
Selector *metav1.LabelSelector
// Describes the rules on how changes are applied to the pods.
// If not specified, all fields in the `PodUpdatePolicy` are set to their
// default values.
// +optional
UpdatePolicy *PodUpdatePolicy
// Controls how the autoscaler computes recommended resources.
// The resource policy may be used to set constraints on the recommendations
// for individual containers. If not specified, the autoscaler computes recommended
// resources for all containers in the pod, without additional constraints.
// +optional
ResourcePolicy *PodResourcePolicy
}
// PodUpdatePolicy describes the rules on how changes are applied to the pods.
type PodUpdatePolicy struct {
// Controls when autoscaler applies changes to the pod resources.
// The default is 'Auto'.
// +optional
UpdateMode *UpdateMode
}
// UpdateMode controls when autoscaler applies changes to the pod resoures.
type UpdateMode string
const (
// UpdateModeOff means that autoscaler never changes Pod resources.
// The recommender still sets the recommended resources in the
// VerticalPodAutoscaler object. This can be used for a "dry run".
UpdateModeOff UpdateMode = "Off"
// UpdateModeInitial means that autoscaler only assigns resources on pod
// creation and does not change them during the lifetime of the pod.
UpdateModeInitial UpdateMode = "Initial"
// UpdateModeRecreate means that autoscaler assigns resources on pod
// creation and additionally can update them during the lifetime of the
// pod by deleting and recreating the pod.
UpdateModeRecreate UpdateMode = "Recreate"
// UpdateModeAuto means that autoscaler assigns resources on pod creation
// and additionally can update them during the lifetime of the pod,
// using any available update method. Currently this is equivalent to
// Recreate, which is the only available update method.
UpdateModeAuto UpdateMode = "Auto"
)
// PodResourcePolicy controls how autoscaler computes the recommended resources
// for containers belonging to the pod. There can be at most one entry for every
// named container and optionally a single wildcard entry with `containerName` = '*',
// which handles all containers that don't have individual policies.
type PodResourcePolicy struct {
// Per-container resource policies.
// +optional
// +patchMergeKey=containerName
// +patchStrategy=merge
ContainerPolicies []ContainerResourcePolicy
}
// ContainerResourcePolicy controls how autoscaler computes the recommended
// resources for a specific container.
type ContainerResourcePolicy struct {
// Name of the container or DefaultContainerResourcePolicy, in which
// case the policy is used by the containers that don't have their own
// policy specified.
ContainerName string
// Whether autoscaler is enabled for the container. The default is "Auto".
// +optional
Mode *ContainerScalingMode
// Specifies the minimal amount of resources that will be recommended
// for the container. The default is no minimum.
// +optional
MinAllowed api.ResourceList
// Specifies the maximum amount of resources that will be recommended
// for the container. The default is no maximum.
// +optional
MaxAllowed api.ResourceList
}
const (
// DefaultContainerResourcePolicy can be passed as
// ContainerResourcePolicy.ContainerName to specify the default policy.
DefaultContainerResourcePolicy = "*"
)
// ContainerScalingMode controls whether autoscaler is enabled for a specific
// container.
type ContainerScalingMode string
const (
// ContainerScalingModeAuto means autoscaling is enabled for a container.
ContainerScalingModeAuto ContainerScalingMode = "Auto"
// ContainerScalingModeOff means autoscaling is disabled for a container.
ContainerScalingModeOff ContainerScalingMode = "Off"
)
// VerticalPodAutoscalerStatus describes the runtime state of the autoscaler.
type VerticalPodAutoscalerStatus struct {
// The most recently computed amount of resources recommended by the
// autoscaler for the controlled pods.
// +optional
Recommendation *RecommendedPodResources
// Conditions is the set of conditions required for this autoscaler to scale its target,
// and indicates whether or not those conditions are met.
// +optional
// +patchMergeKey=type
// +patchStrategy=merge
Conditions []VerticalPodAutoscalerCondition
}
// RecommendedPodResources is the recommendation of resources computed by
// autoscaler. It contains a recommendation for each container in the pod
// (except for those with `ContainerScalingMode` set to 'Off').
type RecommendedPodResources struct {
// Resources recommended by the autoscaler for each container.
// +optional
ContainerRecommendations []RecommendedContainerResources
}
// RecommendedContainerResources is the recommendation of resources computed by
// autoscaler for a specific container. Respects the container resource policy
// if present in the spec. In particular the recommendation is not produced for
// containers with `ContainerScalingMode` set to 'Off'.
type RecommendedContainerResources struct {
// Name of the container.
ContainerName string
// Recommended amount of resources.
Target api.ResourceList
// Minimum recommended amount of resources.
// This amount is not guaranteed to be sufficient for the application to operate in a stable way, however
// running with less resources is likely to have significant impact on performance/availability.
// +optional
LowerBound api.ResourceList
// Maximum recommended amount of resources.
// Any resources allocated beyond this value are likely wasted. This value may be larger than the maximum
// amount of application is actually capable of consuming.
// +optional
UpperBound api.ResourceList
}
// VerticalPodAutoscalerConditionType are the valid conditions of
// a VerticalPodAutoscaler.
type VerticalPodAutoscalerConditionType string
var (
// RecommendationProvided indicates whether the VPA recommender was able to calculate a recommendation.
RecommendationProvided VerticalPodAutoscalerConditionType = "RecommendationProvided"
)
// VerticalPodAutoscalerCondition describes the state of
// a VerticalPodAutoscaler at a certain point.
type VerticalPodAutoscalerCondition struct {
// type describes the current condition
Type VerticalPodAutoscalerConditionType
// status is the status of the condition (True, False, Unknown)
Status api.ConditionStatus
// lastTransitionTime is the last time the condition transitioned from
// one status to another
// +optional
LastTransitionTime metav1.Time
// reason is the reason for the condition's last transition.
// +optional
Reason string
// message is a human-readable explanation containing details about
// the transition
// +optional
Message string
}

View File

@ -19,7 +19,6 @@ go_library(
deps = [
"//pkg/apis/autoscaling:go_default_library",
"//pkg/apis/core:go_default_library",
"//pkg/apis/core/v1:go_default_library",
"//vendor/k8s.io/api/autoscaling/v2beta1:go_default_library",
"//vendor/k8s.io/api/core/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library",

View File

@ -24,9 +24,9 @@ import (
unsafe "unsafe"
v2beta1 "k8s.io/api/autoscaling/v2beta1"
v1 "k8s.io/api/core/v1"
core_v1 "k8s.io/api/core/v1"
resource "k8s.io/apimachinery/pkg/api/resource"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime"
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling"
@ -41,8 +41,6 @@ func init() {
// Public to allow building arbitrary schemes.
func RegisterConversions(scheme *runtime.Scheme) error {
return scheme.AddGeneratedConversionFuncs(
Convert_v2beta1_ContainerResourcePolicy_To_autoscaling_ContainerResourcePolicy,
Convert_autoscaling_ContainerResourcePolicy_To_v2beta1_ContainerResourcePolicy,
Convert_v2beta1_CrossVersionObjectReference_To_autoscaling_CrossVersionObjectReference,
Convert_autoscaling_CrossVersionObjectReference_To_v2beta1_CrossVersionObjectReference,
Convert_v2beta1_ExternalMetricSource_To_autoscaling_ExternalMetricSource,
@ -67,61 +65,17 @@ func RegisterConversions(scheme *runtime.Scheme) error {
Convert_autoscaling_ObjectMetricSource_To_v2beta1_ObjectMetricSource,
Convert_v2beta1_ObjectMetricStatus_To_autoscaling_ObjectMetricStatus,
Convert_autoscaling_ObjectMetricStatus_To_v2beta1_ObjectMetricStatus,
Convert_v2beta1_PodResourcePolicy_To_autoscaling_PodResourcePolicy,
Convert_autoscaling_PodResourcePolicy_To_v2beta1_PodResourcePolicy,
Convert_v2beta1_PodUpdatePolicy_To_autoscaling_PodUpdatePolicy,
Convert_autoscaling_PodUpdatePolicy_To_v2beta1_PodUpdatePolicy,
Convert_v2beta1_PodsMetricSource_To_autoscaling_PodsMetricSource,
Convert_autoscaling_PodsMetricSource_To_v2beta1_PodsMetricSource,
Convert_v2beta1_PodsMetricStatus_To_autoscaling_PodsMetricStatus,
Convert_autoscaling_PodsMetricStatus_To_v2beta1_PodsMetricStatus,
Convert_v2beta1_RecommendedContainerResources_To_autoscaling_RecommendedContainerResources,
Convert_autoscaling_RecommendedContainerResources_To_v2beta1_RecommendedContainerResources,
Convert_v2beta1_RecommendedPodResources_To_autoscaling_RecommendedPodResources,
Convert_autoscaling_RecommendedPodResources_To_v2beta1_RecommendedPodResources,
Convert_v2beta1_ResourceMetricSource_To_autoscaling_ResourceMetricSource,
Convert_autoscaling_ResourceMetricSource_To_v2beta1_ResourceMetricSource,
Convert_v2beta1_ResourceMetricStatus_To_autoscaling_ResourceMetricStatus,
Convert_autoscaling_ResourceMetricStatus_To_v2beta1_ResourceMetricStatus,
Convert_v2beta1_VerticalPodAutoscaler_To_autoscaling_VerticalPodAutoscaler,
Convert_autoscaling_VerticalPodAutoscaler_To_v2beta1_VerticalPodAutoscaler,
Convert_v2beta1_VerticalPodAutoscalerCondition_To_autoscaling_VerticalPodAutoscalerCondition,
Convert_autoscaling_VerticalPodAutoscalerCondition_To_v2beta1_VerticalPodAutoscalerCondition,
Convert_v2beta1_VerticalPodAutoscalerList_To_autoscaling_VerticalPodAutoscalerList,
Convert_autoscaling_VerticalPodAutoscalerList_To_v2beta1_VerticalPodAutoscalerList,
Convert_v2beta1_VerticalPodAutoscalerSpec_To_autoscaling_VerticalPodAutoscalerSpec,
Convert_autoscaling_VerticalPodAutoscalerSpec_To_v2beta1_VerticalPodAutoscalerSpec,
Convert_v2beta1_VerticalPodAutoscalerStatus_To_autoscaling_VerticalPodAutoscalerStatus,
Convert_autoscaling_VerticalPodAutoscalerStatus_To_v2beta1_VerticalPodAutoscalerStatus,
)
}
func autoConvert_v2beta1_ContainerResourcePolicy_To_autoscaling_ContainerResourcePolicy(in *v2beta1.ContainerResourcePolicy, out *autoscaling.ContainerResourcePolicy, s conversion.Scope) error {
out.ContainerName = in.ContainerName
out.Mode = (*autoscaling.ContainerScalingMode)(unsafe.Pointer(in.Mode))
out.MinAllowed = *(*core.ResourceList)(unsafe.Pointer(&in.MinAllowed))
out.MaxAllowed = *(*core.ResourceList)(unsafe.Pointer(&in.MaxAllowed))
return nil
}
// Convert_v2beta1_ContainerResourcePolicy_To_autoscaling_ContainerResourcePolicy is an autogenerated conversion function.
func Convert_v2beta1_ContainerResourcePolicy_To_autoscaling_ContainerResourcePolicy(in *v2beta1.ContainerResourcePolicy, out *autoscaling.ContainerResourcePolicy, s conversion.Scope) error {
return autoConvert_v2beta1_ContainerResourcePolicy_To_autoscaling_ContainerResourcePolicy(in, out, s)
}
func autoConvert_autoscaling_ContainerResourcePolicy_To_v2beta1_ContainerResourcePolicy(in *autoscaling.ContainerResourcePolicy, out *v2beta1.ContainerResourcePolicy, s conversion.Scope) error {
out.ContainerName = in.ContainerName
out.Mode = (*v2beta1.ContainerScalingMode)(unsafe.Pointer(in.Mode))
out.MinAllowed = *(*v1.ResourceList)(unsafe.Pointer(&in.MinAllowed))
out.MaxAllowed = *(*v1.ResourceList)(unsafe.Pointer(&in.MaxAllowed))
return nil
}
// Convert_autoscaling_ContainerResourcePolicy_To_v2beta1_ContainerResourcePolicy is an autogenerated conversion function.
func Convert_autoscaling_ContainerResourcePolicy_To_v2beta1_ContainerResourcePolicy(in *autoscaling.ContainerResourcePolicy, out *v2beta1.ContainerResourcePolicy, s conversion.Scope) error {
return autoConvert_autoscaling_ContainerResourcePolicy_To_v2beta1_ContainerResourcePolicy(in, out, s)
}
func autoConvert_v2beta1_CrossVersionObjectReference_To_autoscaling_CrossVersionObjectReference(in *v2beta1.CrossVersionObjectReference, out *autoscaling.CrossVersionObjectReference, s conversion.Scope) error {
out.Kind = in.Kind
out.Name = in.Name
@ -148,7 +102,7 @@ func Convert_autoscaling_CrossVersionObjectReference_To_v2beta1_CrossVersionObje
func autoConvert_v2beta1_ExternalMetricSource_To_autoscaling_ExternalMetricSource(in *v2beta1.ExternalMetricSource, out *autoscaling.ExternalMetricSource, s conversion.Scope) error {
out.MetricName = in.MetricName
out.MetricSelector = (*meta_v1.LabelSelector)(unsafe.Pointer(in.MetricSelector))
out.MetricSelector = (*v1.LabelSelector)(unsafe.Pointer(in.MetricSelector))
out.TargetValue = (*resource.Quantity)(unsafe.Pointer(in.TargetValue))
out.TargetAverageValue = (*resource.Quantity)(unsafe.Pointer(in.TargetAverageValue))
return nil
@ -161,7 +115,7 @@ func Convert_v2beta1_ExternalMetricSource_To_autoscaling_ExternalMetricSource(in
func autoConvert_autoscaling_ExternalMetricSource_To_v2beta1_ExternalMetricSource(in *autoscaling.ExternalMetricSource, out *v2beta1.ExternalMetricSource, s conversion.Scope) error {
out.MetricName = in.MetricName
out.MetricSelector = (*meta_v1.LabelSelector)(unsafe.Pointer(in.MetricSelector))
out.MetricSelector = (*v1.LabelSelector)(unsafe.Pointer(in.MetricSelector))
out.TargetValue = (*resource.Quantity)(unsafe.Pointer(in.TargetValue))
out.TargetAverageValue = (*resource.Quantity)(unsafe.Pointer(in.TargetAverageValue))
return nil
@ -174,7 +128,7 @@ func Convert_autoscaling_ExternalMetricSource_To_v2beta1_ExternalMetricSource(in
func autoConvert_v2beta1_ExternalMetricStatus_To_autoscaling_ExternalMetricStatus(in *v2beta1.ExternalMetricStatus, out *autoscaling.ExternalMetricStatus, s conversion.Scope) error {
out.MetricName = in.MetricName
out.MetricSelector = (*meta_v1.LabelSelector)(unsafe.Pointer(in.MetricSelector))
out.MetricSelector = (*v1.LabelSelector)(unsafe.Pointer(in.MetricSelector))
out.CurrentValue = in.CurrentValue
out.CurrentAverageValue = (*resource.Quantity)(unsafe.Pointer(in.CurrentAverageValue))
return nil
@ -187,7 +141,7 @@ func Convert_v2beta1_ExternalMetricStatus_To_autoscaling_ExternalMetricStatus(in
func autoConvert_autoscaling_ExternalMetricStatus_To_v2beta1_ExternalMetricStatus(in *autoscaling.ExternalMetricStatus, out *v2beta1.ExternalMetricStatus, s conversion.Scope) error {
out.MetricName = in.MetricName
out.MetricSelector = (*meta_v1.LabelSelector)(unsafe.Pointer(in.MetricSelector))
out.MetricSelector = (*v1.LabelSelector)(unsafe.Pointer(in.MetricSelector))
out.CurrentValue = in.CurrentValue
out.CurrentAverageValue = (*resource.Quantity)(unsafe.Pointer(in.CurrentAverageValue))
return nil
@ -246,7 +200,7 @@ func Convert_v2beta1_HorizontalPodAutoscalerCondition_To_autoscaling_HorizontalP
func autoConvert_autoscaling_HorizontalPodAutoscalerCondition_To_v2beta1_HorizontalPodAutoscalerCondition(in *autoscaling.HorizontalPodAutoscalerCondition, out *v2beta1.HorizontalPodAutoscalerCondition, s conversion.Scope) error {
out.Type = v2beta1.HorizontalPodAutoscalerConditionType(in.Type)
out.Status = v1.ConditionStatus(in.Status)
out.Status = core_v1.ConditionStatus(in.Status)
out.LastTransitionTime = in.LastTransitionTime
out.Reason = in.Reason
out.Message = in.Message
@ -312,7 +266,7 @@ func Convert_autoscaling_HorizontalPodAutoscalerSpec_To_v2beta1_HorizontalPodAut
func autoConvert_v2beta1_HorizontalPodAutoscalerStatus_To_autoscaling_HorizontalPodAutoscalerStatus(in *v2beta1.HorizontalPodAutoscalerStatus, out *autoscaling.HorizontalPodAutoscalerStatus, s conversion.Scope) error {
out.ObservedGeneration = (*int64)(unsafe.Pointer(in.ObservedGeneration))
out.LastScaleTime = (*meta_v1.Time)(unsafe.Pointer(in.LastScaleTime))
out.LastScaleTime = (*v1.Time)(unsafe.Pointer(in.LastScaleTime))
out.CurrentReplicas = in.CurrentReplicas
out.DesiredReplicas = in.DesiredReplicas
out.CurrentMetrics = *(*[]autoscaling.MetricStatus)(unsafe.Pointer(&in.CurrentMetrics))
@ -327,7 +281,7 @@ func Convert_v2beta1_HorizontalPodAutoscalerStatus_To_autoscaling_HorizontalPodA
func autoConvert_autoscaling_HorizontalPodAutoscalerStatus_To_v2beta1_HorizontalPodAutoscalerStatus(in *autoscaling.HorizontalPodAutoscalerStatus, out *v2beta1.HorizontalPodAutoscalerStatus, s conversion.Scope) error {
out.ObservedGeneration = (*int64)(unsafe.Pointer(in.ObservedGeneration))
out.LastScaleTime = (*meta_v1.Time)(unsafe.Pointer(in.LastScaleTime))
out.LastScaleTime = (*v1.Time)(unsafe.Pointer(in.LastScaleTime))
out.CurrentReplicas = in.CurrentReplicas
out.DesiredReplicas = in.DesiredReplicas
out.CurrentMetrics = *(*[]v2beta1.MetricStatus)(unsafe.Pointer(&in.CurrentMetrics))
@ -452,46 +406,6 @@ func Convert_autoscaling_ObjectMetricStatus_To_v2beta1_ObjectMetricStatus(in *au
return autoConvert_autoscaling_ObjectMetricStatus_To_v2beta1_ObjectMetricStatus(in, out, s)
}
func autoConvert_v2beta1_PodResourcePolicy_To_autoscaling_PodResourcePolicy(in *v2beta1.PodResourcePolicy, out *autoscaling.PodResourcePolicy, s conversion.Scope) error {
out.ContainerPolicies = *(*[]autoscaling.ContainerResourcePolicy)(unsafe.Pointer(&in.ContainerPolicies))
return nil
}
// Convert_v2beta1_PodResourcePolicy_To_autoscaling_PodResourcePolicy is an autogenerated conversion function.
func Convert_v2beta1_PodResourcePolicy_To_autoscaling_PodResourcePolicy(in *v2beta1.PodResourcePolicy, out *autoscaling.PodResourcePolicy, s conversion.Scope) error {
return autoConvert_v2beta1_PodResourcePolicy_To_autoscaling_PodResourcePolicy(in, out, s)
}
func autoConvert_autoscaling_PodResourcePolicy_To_v2beta1_PodResourcePolicy(in *autoscaling.PodResourcePolicy, out *v2beta1.PodResourcePolicy, s conversion.Scope) error {
out.ContainerPolicies = *(*[]v2beta1.ContainerResourcePolicy)(unsafe.Pointer(&in.ContainerPolicies))
return nil
}
// Convert_autoscaling_PodResourcePolicy_To_v2beta1_PodResourcePolicy is an autogenerated conversion function.
func Convert_autoscaling_PodResourcePolicy_To_v2beta1_PodResourcePolicy(in *autoscaling.PodResourcePolicy, out *v2beta1.PodResourcePolicy, s conversion.Scope) error {
return autoConvert_autoscaling_PodResourcePolicy_To_v2beta1_PodResourcePolicy(in, out, s)
}
func autoConvert_v2beta1_PodUpdatePolicy_To_autoscaling_PodUpdatePolicy(in *v2beta1.PodUpdatePolicy, out *autoscaling.PodUpdatePolicy, s conversion.Scope) error {
out.UpdateMode = (*autoscaling.UpdateMode)(unsafe.Pointer(in.UpdateMode))
return nil
}
// Convert_v2beta1_PodUpdatePolicy_To_autoscaling_PodUpdatePolicy is an autogenerated conversion function.
func Convert_v2beta1_PodUpdatePolicy_To_autoscaling_PodUpdatePolicy(in *v2beta1.PodUpdatePolicy, out *autoscaling.PodUpdatePolicy, s conversion.Scope) error {
return autoConvert_v2beta1_PodUpdatePolicy_To_autoscaling_PodUpdatePolicy(in, out, s)
}
func autoConvert_autoscaling_PodUpdatePolicy_To_v2beta1_PodUpdatePolicy(in *autoscaling.PodUpdatePolicy, out *v2beta1.PodUpdatePolicy, s conversion.Scope) error {
out.UpdateMode = (*v2beta1.UpdateMode)(unsafe.Pointer(in.UpdateMode))
return nil
}
// Convert_autoscaling_PodUpdatePolicy_To_v2beta1_PodUpdatePolicy is an autogenerated conversion function.
func Convert_autoscaling_PodUpdatePolicy_To_v2beta1_PodUpdatePolicy(in *autoscaling.PodUpdatePolicy, out *v2beta1.PodUpdatePolicy, s conversion.Scope) error {
return autoConvert_autoscaling_PodUpdatePolicy_To_v2beta1_PodUpdatePolicy(in, out, s)
}
func autoConvert_v2beta1_PodsMetricSource_To_autoscaling_PodsMetricSource(in *v2beta1.PodsMetricSource, out *autoscaling.PodsMetricSource, s conversion.Scope) error {
out.MetricName = in.MetricName
out.TargetAverageValue = in.TargetAverageValue
@ -536,52 +450,6 @@ func Convert_autoscaling_PodsMetricStatus_To_v2beta1_PodsMetricStatus(in *autosc
return autoConvert_autoscaling_PodsMetricStatus_To_v2beta1_PodsMetricStatus(in, out, s)
}
func autoConvert_v2beta1_RecommendedContainerResources_To_autoscaling_RecommendedContainerResources(in *v2beta1.RecommendedContainerResources, out *autoscaling.RecommendedContainerResources, s conversion.Scope) error {
out.ContainerName = in.ContainerName
out.Target = *(*core.ResourceList)(unsafe.Pointer(&in.Target))
out.LowerBound = *(*core.ResourceList)(unsafe.Pointer(&in.LowerBound))
out.UpperBound = *(*core.ResourceList)(unsafe.Pointer(&in.UpperBound))
return nil
}
// Convert_v2beta1_RecommendedContainerResources_To_autoscaling_RecommendedContainerResources is an autogenerated conversion function.
func Convert_v2beta1_RecommendedContainerResources_To_autoscaling_RecommendedContainerResources(in *v2beta1.RecommendedContainerResources, out *autoscaling.RecommendedContainerResources, s conversion.Scope) error {
return autoConvert_v2beta1_RecommendedContainerResources_To_autoscaling_RecommendedContainerResources(in, out, s)
}
func autoConvert_autoscaling_RecommendedContainerResources_To_v2beta1_RecommendedContainerResources(in *autoscaling.RecommendedContainerResources, out *v2beta1.RecommendedContainerResources, s conversion.Scope) error {
out.ContainerName = in.ContainerName
out.Target = *(*v1.ResourceList)(unsafe.Pointer(&in.Target))
out.LowerBound = *(*v1.ResourceList)(unsafe.Pointer(&in.LowerBound))
out.UpperBound = *(*v1.ResourceList)(unsafe.Pointer(&in.UpperBound))
return nil
}
// Convert_autoscaling_RecommendedContainerResources_To_v2beta1_RecommendedContainerResources is an autogenerated conversion function.
func Convert_autoscaling_RecommendedContainerResources_To_v2beta1_RecommendedContainerResources(in *autoscaling.RecommendedContainerResources, out *v2beta1.RecommendedContainerResources, s conversion.Scope) error {
return autoConvert_autoscaling_RecommendedContainerResources_To_v2beta1_RecommendedContainerResources(in, out, s)
}
func autoConvert_v2beta1_RecommendedPodResources_To_autoscaling_RecommendedPodResources(in *v2beta1.RecommendedPodResources, out *autoscaling.RecommendedPodResources, s conversion.Scope) error {
out.ContainerRecommendations = *(*[]autoscaling.RecommendedContainerResources)(unsafe.Pointer(&in.ContainerRecommendations))
return nil
}
// Convert_v2beta1_RecommendedPodResources_To_autoscaling_RecommendedPodResources is an autogenerated conversion function.
func Convert_v2beta1_RecommendedPodResources_To_autoscaling_RecommendedPodResources(in *v2beta1.RecommendedPodResources, out *autoscaling.RecommendedPodResources, s conversion.Scope) error {
return autoConvert_v2beta1_RecommendedPodResources_To_autoscaling_RecommendedPodResources(in, out, s)
}
func autoConvert_autoscaling_RecommendedPodResources_To_v2beta1_RecommendedPodResources(in *autoscaling.RecommendedPodResources, out *v2beta1.RecommendedPodResources, s conversion.Scope) error {
out.ContainerRecommendations = *(*[]v2beta1.RecommendedContainerResources)(unsafe.Pointer(&in.ContainerRecommendations))
return nil
}
// Convert_autoscaling_RecommendedPodResources_To_v2beta1_RecommendedPodResources is an autogenerated conversion function.
func Convert_autoscaling_RecommendedPodResources_To_v2beta1_RecommendedPodResources(in *autoscaling.RecommendedPodResources, out *v2beta1.RecommendedPodResources, s conversion.Scope) error {
return autoConvert_autoscaling_RecommendedPodResources_To_v2beta1_RecommendedPodResources(in, out, s)
}
func autoConvert_v2beta1_ResourceMetricSource_To_autoscaling_ResourceMetricSource(in *v2beta1.ResourceMetricSource, out *autoscaling.ResourceMetricSource, s conversion.Scope) error {
out.Name = core.ResourceName(in.Name)
out.TargetAverageUtilization = (*int32)(unsafe.Pointer(in.TargetAverageUtilization))
@ -595,7 +463,7 @@ func Convert_v2beta1_ResourceMetricSource_To_autoscaling_ResourceMetricSource(in
}
func autoConvert_autoscaling_ResourceMetricSource_To_v2beta1_ResourceMetricSource(in *autoscaling.ResourceMetricSource, out *v2beta1.ResourceMetricSource, s conversion.Scope) error {
out.Name = v1.ResourceName(in.Name)
out.Name = core_v1.ResourceName(in.Name)
out.TargetAverageUtilization = (*int32)(unsafe.Pointer(in.TargetAverageUtilization))
out.TargetAverageValue = (*resource.Quantity)(unsafe.Pointer(in.TargetAverageValue))
return nil
@ -619,7 +487,7 @@ func Convert_v2beta1_ResourceMetricStatus_To_autoscaling_ResourceMetricStatus(in
}
func autoConvert_autoscaling_ResourceMetricStatus_To_v2beta1_ResourceMetricStatus(in *autoscaling.ResourceMetricStatus, out *v2beta1.ResourceMetricStatus, s conversion.Scope) error {
out.Name = v1.ResourceName(in.Name)
out.Name = core_v1.ResourceName(in.Name)
out.CurrentAverageUtilization = (*int32)(unsafe.Pointer(in.CurrentAverageUtilization))
out.CurrentAverageValue = in.CurrentAverageValue
return nil
@ -629,131 +497,3 @@ func autoConvert_autoscaling_ResourceMetricStatus_To_v2beta1_ResourceMetricStatu
func Convert_autoscaling_ResourceMetricStatus_To_v2beta1_ResourceMetricStatus(in *autoscaling.ResourceMetricStatus, out *v2beta1.ResourceMetricStatus, s conversion.Scope) error {
return autoConvert_autoscaling_ResourceMetricStatus_To_v2beta1_ResourceMetricStatus(in, out, s)
}
func autoConvert_v2beta1_VerticalPodAutoscaler_To_autoscaling_VerticalPodAutoscaler(in *v2beta1.VerticalPodAutoscaler, out *autoscaling.VerticalPodAutoscaler, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
if err := Convert_v2beta1_VerticalPodAutoscalerSpec_To_autoscaling_VerticalPodAutoscalerSpec(&in.Spec, &out.Spec, s); err != nil {
return err
}
if err := Convert_v2beta1_VerticalPodAutoscalerStatus_To_autoscaling_VerticalPodAutoscalerStatus(&in.Status, &out.Status, s); err != nil {
return err
}
return nil
}
// Convert_v2beta1_VerticalPodAutoscaler_To_autoscaling_VerticalPodAutoscaler is an autogenerated conversion function.
func Convert_v2beta1_VerticalPodAutoscaler_To_autoscaling_VerticalPodAutoscaler(in *v2beta1.VerticalPodAutoscaler, out *autoscaling.VerticalPodAutoscaler, s conversion.Scope) error {
return autoConvert_v2beta1_VerticalPodAutoscaler_To_autoscaling_VerticalPodAutoscaler(in, out, s)
}
func autoConvert_autoscaling_VerticalPodAutoscaler_To_v2beta1_VerticalPodAutoscaler(in *autoscaling.VerticalPodAutoscaler, out *v2beta1.VerticalPodAutoscaler, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
if err := Convert_autoscaling_VerticalPodAutoscalerSpec_To_v2beta1_VerticalPodAutoscalerSpec(&in.Spec, &out.Spec, s); err != nil {
return err
}
if err := Convert_autoscaling_VerticalPodAutoscalerStatus_To_v2beta1_VerticalPodAutoscalerStatus(&in.Status, &out.Status, s); err != nil {
return err
}
return nil
}
// Convert_autoscaling_VerticalPodAutoscaler_To_v2beta1_VerticalPodAutoscaler is an autogenerated conversion function.
func Convert_autoscaling_VerticalPodAutoscaler_To_v2beta1_VerticalPodAutoscaler(in *autoscaling.VerticalPodAutoscaler, out *v2beta1.VerticalPodAutoscaler, s conversion.Scope) error {
return autoConvert_autoscaling_VerticalPodAutoscaler_To_v2beta1_VerticalPodAutoscaler(in, out, s)
}
func autoConvert_v2beta1_VerticalPodAutoscalerCondition_To_autoscaling_VerticalPodAutoscalerCondition(in *v2beta1.VerticalPodAutoscalerCondition, out *autoscaling.VerticalPodAutoscalerCondition, s conversion.Scope) error {
out.Type = autoscaling.VerticalPodAutoscalerConditionType(in.Type)
out.Status = core.ConditionStatus(in.Status)
out.LastTransitionTime = in.LastTransitionTime
out.Reason = in.Reason
out.Message = in.Message
return nil
}
// Convert_v2beta1_VerticalPodAutoscalerCondition_To_autoscaling_VerticalPodAutoscalerCondition is an autogenerated conversion function.
func Convert_v2beta1_VerticalPodAutoscalerCondition_To_autoscaling_VerticalPodAutoscalerCondition(in *v2beta1.VerticalPodAutoscalerCondition, out *autoscaling.VerticalPodAutoscalerCondition, s conversion.Scope) error {
return autoConvert_v2beta1_VerticalPodAutoscalerCondition_To_autoscaling_VerticalPodAutoscalerCondition(in, out, s)
}
func autoConvert_autoscaling_VerticalPodAutoscalerCondition_To_v2beta1_VerticalPodAutoscalerCondition(in *autoscaling.VerticalPodAutoscalerCondition, out *v2beta1.VerticalPodAutoscalerCondition, s conversion.Scope) error {
out.Type = v2beta1.VerticalPodAutoscalerConditionType(in.Type)
out.Status = v1.ConditionStatus(in.Status)
out.LastTransitionTime = in.LastTransitionTime
out.Reason = in.Reason
out.Message = in.Message
return nil
}
// Convert_autoscaling_VerticalPodAutoscalerCondition_To_v2beta1_VerticalPodAutoscalerCondition is an autogenerated conversion function.
func Convert_autoscaling_VerticalPodAutoscalerCondition_To_v2beta1_VerticalPodAutoscalerCondition(in *autoscaling.VerticalPodAutoscalerCondition, out *v2beta1.VerticalPodAutoscalerCondition, s conversion.Scope) error {
return autoConvert_autoscaling_VerticalPodAutoscalerCondition_To_v2beta1_VerticalPodAutoscalerCondition(in, out, s)
}
func autoConvert_v2beta1_VerticalPodAutoscalerList_To_autoscaling_VerticalPodAutoscalerList(in *v2beta1.VerticalPodAutoscalerList, out *autoscaling.VerticalPodAutoscalerList, s conversion.Scope) error {
out.ListMeta = in.ListMeta
out.Items = *(*[]autoscaling.VerticalPodAutoscaler)(unsafe.Pointer(&in.Items))
return nil
}
// Convert_v2beta1_VerticalPodAutoscalerList_To_autoscaling_VerticalPodAutoscalerList is an autogenerated conversion function.
func Convert_v2beta1_VerticalPodAutoscalerList_To_autoscaling_VerticalPodAutoscalerList(in *v2beta1.VerticalPodAutoscalerList, out *autoscaling.VerticalPodAutoscalerList, s conversion.Scope) error {
return autoConvert_v2beta1_VerticalPodAutoscalerList_To_autoscaling_VerticalPodAutoscalerList(in, out, s)
}
func autoConvert_autoscaling_VerticalPodAutoscalerList_To_v2beta1_VerticalPodAutoscalerList(in *autoscaling.VerticalPodAutoscalerList, out *v2beta1.VerticalPodAutoscalerList, s conversion.Scope) error {
out.ListMeta = in.ListMeta
out.Items = *(*[]v2beta1.VerticalPodAutoscaler)(unsafe.Pointer(&in.Items))
return nil
}
// Convert_autoscaling_VerticalPodAutoscalerList_To_v2beta1_VerticalPodAutoscalerList is an autogenerated conversion function.
func Convert_autoscaling_VerticalPodAutoscalerList_To_v2beta1_VerticalPodAutoscalerList(in *autoscaling.VerticalPodAutoscalerList, out *v2beta1.VerticalPodAutoscalerList, s conversion.Scope) error {
return autoConvert_autoscaling_VerticalPodAutoscalerList_To_v2beta1_VerticalPodAutoscalerList(in, out, s)
}
func autoConvert_v2beta1_VerticalPodAutoscalerSpec_To_autoscaling_VerticalPodAutoscalerSpec(in *v2beta1.VerticalPodAutoscalerSpec, out *autoscaling.VerticalPodAutoscalerSpec, s conversion.Scope) error {
out.Selector = (*meta_v1.LabelSelector)(unsafe.Pointer(in.Selector))
out.UpdatePolicy = (*autoscaling.PodUpdatePolicy)(unsafe.Pointer(in.UpdatePolicy))
out.ResourcePolicy = (*autoscaling.PodResourcePolicy)(unsafe.Pointer(in.ResourcePolicy))
return nil
}
// Convert_v2beta1_VerticalPodAutoscalerSpec_To_autoscaling_VerticalPodAutoscalerSpec is an autogenerated conversion function.
func Convert_v2beta1_VerticalPodAutoscalerSpec_To_autoscaling_VerticalPodAutoscalerSpec(in *v2beta1.VerticalPodAutoscalerSpec, out *autoscaling.VerticalPodAutoscalerSpec, s conversion.Scope) error {
return autoConvert_v2beta1_VerticalPodAutoscalerSpec_To_autoscaling_VerticalPodAutoscalerSpec(in, out, s)
}
func autoConvert_autoscaling_VerticalPodAutoscalerSpec_To_v2beta1_VerticalPodAutoscalerSpec(in *autoscaling.VerticalPodAutoscalerSpec, out *v2beta1.VerticalPodAutoscalerSpec, s conversion.Scope) error {
out.Selector = (*meta_v1.LabelSelector)(unsafe.Pointer(in.Selector))
out.UpdatePolicy = (*v2beta1.PodUpdatePolicy)(unsafe.Pointer(in.UpdatePolicy))
out.ResourcePolicy = (*v2beta1.PodResourcePolicy)(unsafe.Pointer(in.ResourcePolicy))
return nil
}
// Convert_autoscaling_VerticalPodAutoscalerSpec_To_v2beta1_VerticalPodAutoscalerSpec is an autogenerated conversion function.
func Convert_autoscaling_VerticalPodAutoscalerSpec_To_v2beta1_VerticalPodAutoscalerSpec(in *autoscaling.VerticalPodAutoscalerSpec, out *v2beta1.VerticalPodAutoscalerSpec, s conversion.Scope) error {
return autoConvert_autoscaling_VerticalPodAutoscalerSpec_To_v2beta1_VerticalPodAutoscalerSpec(in, out, s)
}
func autoConvert_v2beta1_VerticalPodAutoscalerStatus_To_autoscaling_VerticalPodAutoscalerStatus(in *v2beta1.VerticalPodAutoscalerStatus, out *autoscaling.VerticalPodAutoscalerStatus, s conversion.Scope) error {
out.Recommendation = (*autoscaling.RecommendedPodResources)(unsafe.Pointer(in.Recommendation))
out.Conditions = *(*[]autoscaling.VerticalPodAutoscalerCondition)(unsafe.Pointer(&in.Conditions))
return nil
}
// Convert_v2beta1_VerticalPodAutoscalerStatus_To_autoscaling_VerticalPodAutoscalerStatus is an autogenerated conversion function.
func Convert_v2beta1_VerticalPodAutoscalerStatus_To_autoscaling_VerticalPodAutoscalerStatus(in *v2beta1.VerticalPodAutoscalerStatus, out *autoscaling.VerticalPodAutoscalerStatus, s conversion.Scope) error {
return autoConvert_v2beta1_VerticalPodAutoscalerStatus_To_autoscaling_VerticalPodAutoscalerStatus(in, out, s)
}
func autoConvert_autoscaling_VerticalPodAutoscalerStatus_To_v2beta1_VerticalPodAutoscalerStatus(in *autoscaling.VerticalPodAutoscalerStatus, out *v2beta1.VerticalPodAutoscalerStatus, s conversion.Scope) error {
out.Recommendation = (*v2beta1.RecommendedPodResources)(unsafe.Pointer(in.Recommendation))
out.Conditions = *(*[]v2beta1.VerticalPodAutoscalerCondition)(unsafe.Pointer(&in.Conditions))
return nil
}
// Convert_autoscaling_VerticalPodAutoscalerStatus_To_v2beta1_VerticalPodAutoscalerStatus is an autogenerated conversion function.
func Convert_autoscaling_VerticalPodAutoscalerStatus_To_v2beta1_VerticalPodAutoscalerStatus(in *autoscaling.VerticalPodAutoscalerStatus, out *v2beta1.VerticalPodAutoscalerStatus, s conversion.Scope) error {
return autoConvert_autoscaling_VerticalPodAutoscalerStatus_To_v2beta1_VerticalPodAutoscalerStatus(in, out, s)
}

View File

@ -23,7 +23,6 @@ package v2beta1
import (
v2beta1 "k8s.io/api/autoscaling/v2beta1"
runtime "k8s.io/apimachinery/pkg/runtime"
v1 "k8s.io/kubernetes/pkg/apis/core/v1"
)
// RegisterDefaults adds defaulters functions to the given scheme.
@ -36,10 +35,6 @@ func RegisterDefaults(scheme *runtime.Scheme) error {
scheme.AddTypeDefaultingFunc(&v2beta1.HorizontalPodAutoscalerList{}, func(obj interface{}) {
SetObjectDefaults_HorizontalPodAutoscalerList(obj.(*v2beta1.HorizontalPodAutoscalerList))
})
scheme.AddTypeDefaultingFunc(&v2beta1.VerticalPodAutoscaler{}, func(obj interface{}) { SetObjectDefaults_VerticalPodAutoscaler(obj.(*v2beta1.VerticalPodAutoscaler)) })
scheme.AddTypeDefaultingFunc(&v2beta1.VerticalPodAutoscalerList{}, func(obj interface{}) {
SetObjectDefaults_VerticalPodAutoscalerList(obj.(*v2beta1.VerticalPodAutoscalerList))
})
return nil
}
@ -53,28 +48,3 @@ func SetObjectDefaults_HorizontalPodAutoscalerList(in *v2beta1.HorizontalPodAuto
SetObjectDefaults_HorizontalPodAutoscaler(a)
}
}
func SetObjectDefaults_VerticalPodAutoscaler(in *v2beta1.VerticalPodAutoscaler) {
if in.Spec.ResourcePolicy != nil {
for i := range in.Spec.ResourcePolicy.ContainerPolicies {
a := &in.Spec.ResourcePolicy.ContainerPolicies[i]
v1.SetDefaults_ResourceList(&a.MinAllowed)
v1.SetDefaults_ResourceList(&a.MaxAllowed)
}
}
if in.Status.Recommendation != nil {
for i := range in.Status.Recommendation.ContainerRecommendations {
a := &in.Status.Recommendation.ContainerRecommendations[i]
v1.SetDefaults_ResourceList(&a.Target)
v1.SetDefaults_ResourceList(&a.LowerBound)
v1.SetDefaults_ResourceList(&a.UpperBound)
}
}
}
func SetObjectDefaults_VerticalPodAutoscalerList(in *v2beta1.VerticalPodAutoscalerList) {
for i := range in.Items {
a := &in.Items[i]
SetObjectDefaults_VerticalPodAutoscaler(a)
}
}

View File

@ -8,17 +8,12 @@ load(
go_library(
name = "go_default_library",
srcs = [
"validation.go",
"vpa.go",
],
srcs = ["validation.go"],
importpath = "k8s.io/kubernetes/pkg/apis/autoscaling/validation",
deps = [
"//pkg/apis/autoscaling:go_default_library",
"//pkg/apis/core:go_default_library",
"//pkg/apis/core/validation:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/api/validation/path:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/sets:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/validation/field:go_default_library",
],
@ -26,10 +21,7 @@ go_library(
go_test(
name = "go_default_test",
srcs = [
"validation_test.go",
"vpa_test.go",
],
srcs = ["validation_test.go"],
embed = [":go_default_library"],
deps = [
"//pkg/apis/autoscaling:go_default_library",
@ -37,7 +29,6 @@ go_test(
"//pkg/util/pointer:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/util/validation/field:go_default_library",
],
)

View File

@ -1,184 +0,0 @@
/*
Copyright 2018 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 validation
import (
metavalidation "k8s.io/apimachinery/pkg/apis/meta/v1/validation"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/kubernetes/pkg/apis/autoscaling"
core "k8s.io/kubernetes/pkg/apis/core"
corevalidation "k8s.io/kubernetes/pkg/apis/core/validation"
)
var supportedUpdateModes = sets.NewString(
string(autoscaling.UpdateModeOff),
string(autoscaling.UpdateModeInitial),
string(autoscaling.UpdateModeAuto),
)
var supportedContainerScalingModes = sets.NewString(
string(autoscaling.ContainerScalingModeAuto),
string(autoscaling.ContainerScalingModeOff),
)
var supportedResources = sets.NewString(
string(core.ResourceCPU),
string(core.ResourceMemory),
)
func validateUpdateMode(updateMode *autoscaling.UpdateMode, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if updateMode != nil && !supportedUpdateModes.Has(string(*updateMode)) {
allErrs = append(allErrs, field.NotSupported(fldPath, updateMode, supportedUpdateModes.List()))
}
return allErrs
}
func validateContainerScalingMode(containerScalingMode *autoscaling.ContainerScalingMode, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if containerScalingMode != nil && !supportedContainerScalingModes.Has(string(*containerScalingMode)) {
allErrs = append(allErrs, field.NotSupported(fldPath, containerScalingMode, supportedContainerScalingModes.List()))
}
return allErrs
}
func validateResourceName(resourceName *core.ResourceName, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if resourceName != nil && !supportedResources.Has(string(*resourceName)) {
allErrs = append(allErrs, field.NotSupported(fldPath, resourceName, supportedResources.List()))
}
return allErrs
}
func validatePodUpdatePolicy(podUpdatePolicy *autoscaling.PodUpdatePolicy, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if podUpdatePolicy != nil {
allErrs = append(allErrs, validateUpdateMode(podUpdatePolicy.UpdateMode, fldPath.Child("updateMode"))...)
}
return allErrs
}
// Verifies that the core.ResourceList contains valid and supported resources (see supportedResources).
// Additionally checks that the quantity of resources in resourceList does not exceed the corresponding
// quantity in upperBound, if present.
func validateResourceList(resourceList core.ResourceList, upperBound core.ResourceList, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
for resourceName, quantity := range resourceList {
resPath := fldPath.Key(string(resourceName))
// Validate resource name.
allErrs = append(allErrs, validateResourceName(&resourceName, resPath)...)
// Validate resource quantity.
allErrs = append(allErrs, corevalidation.ValidateResourceQuantityValue(string(resourceName), quantity, resPath)...)
if upperBound != nil {
// Check that request <= limit.
upperBoundQuantity, exists := upperBound[resourceName]
if exists && quantity.Cmp(upperBoundQuantity) > 0 {
allErrs = append(allErrs, field.Invalid(fldPath, quantity.String(),
"must be less than or equal to the upper bound"))
}
}
}
return allErrs
}
func validateContainerResourcePolicy(containerResourcePolicy *autoscaling.ContainerResourcePolicy, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if containerResourcePolicy != nil {
allErrs = append(allErrs, validateContainerScalingMode(containerResourcePolicy.Mode, fldPath.Child("mode"))...)
allErrs = append(allErrs, validateResourceList(containerResourcePolicy.MinAllowed, containerResourcePolicy.MaxAllowed, fldPath.Child("minAllowed"))...)
allErrs = append(allErrs, validateResourceList(containerResourcePolicy.MaxAllowed, core.ResourceList{}, fldPath.Child("maxAllowed"))...)
}
return allErrs
}
func validatePodResourcePolicy(podResourcePolicy *autoscaling.PodResourcePolicy, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if podResourcePolicy != nil {
for i, containerPolicy := range podResourcePolicy.ContainerPolicies {
allErrs = append(allErrs, validateContainerResourcePolicy(&containerPolicy, fldPath.Child("containerPolicies").Index(i))...)
}
}
return allErrs
}
func validateVerticalPodAutoscalerSpec(spec *autoscaling.VerticalPodAutoscalerSpec, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if spec.Selector == nil {
allErrs = append(allErrs, field.Required(fldPath.Child("selector"), ""))
} else {
allErrs = append(allErrs, metavalidation.ValidateLabelSelector(spec.Selector, fldPath.Child("selector"))...)
}
allErrs = append(allErrs, validatePodUpdatePolicy(spec.UpdatePolicy, fldPath.Child("updatePolicy"))...)
allErrs = append(allErrs, validatePodResourcePolicy(spec.ResourcePolicy, fldPath.Child("resourcePolicy"))...)
return allErrs
}
func validateRecommendedContainerResources(recommendedContainerResources *autoscaling.RecommendedContainerResources, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if recommendedContainerResources != nil {
allErrs = append(allErrs, validateResourceList(recommendedContainerResources.LowerBound, recommendedContainerResources.Target, fldPath.Child("minRecommended"))...)
allErrs = append(allErrs, validateResourceList(recommendedContainerResources.Target, recommendedContainerResources.UpperBound, fldPath.Child("target"))...)
allErrs = append(allErrs, validateResourceList(recommendedContainerResources.UpperBound, core.ResourceList{}, fldPath.Child("maxRecommended"))...)
}
return allErrs
}
func validateRecommendedPodResources(recommendedPodResources *autoscaling.RecommendedPodResources, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if recommendedPodResources != nil {
for i, containerRecommendation := range recommendedPodResources.ContainerRecommendations {
allErrs = append(allErrs, validateRecommendedContainerResources(&containerRecommendation, fldPath.Child("containerRecommendations").Index(i))...)
}
}
return allErrs
}
func validateVerticalPodAutoscalerStatus(status *autoscaling.VerticalPodAutoscalerStatus, fldPath *field.Path) field.ErrorList {
allErrs := field.ErrorList{}
if status != nil {
allErrs = append(allErrs, validateRecommendedPodResources(status.Recommendation, fldPath.Child("recommendation"))...)
}
return allErrs
}
// ValidateVerticalPodAutoscalerName verifies that the vertical pod autoscaler name is valid.
var ValidateVerticalPodAutoscalerName = corevalidation.ValidateReplicationControllerName
// ValidateVerticalPodAutoscaler that VerticalPodAutoscaler is valid.
func ValidateVerticalPodAutoscaler(autoscaler *autoscaling.VerticalPodAutoscaler) field.ErrorList {
allErrs := corevalidation.ValidateObjectMeta(&autoscaler.ObjectMeta, true, ValidateVerticalPodAutoscalerName, field.NewPath("metadata"))
if autoscaler != nil {
allErrs = append(allErrs, validateVerticalPodAutoscalerSpec(&autoscaler.Spec, field.NewPath("spec"))...)
allErrs = append(allErrs, validateVerticalPodAutoscalerStatus(&autoscaler.Status, field.NewPath("status"))...)
}
return allErrs
}
// ValidateVerticalPodAutoscalerUpdate that VerticalPodAutoscaler update is valid.
func ValidateVerticalPodAutoscalerUpdate(newAutoscaler, oldAutoscaler *autoscaling.VerticalPodAutoscaler) field.ErrorList {
allErrs := corevalidation.ValidateObjectMetaUpdate(&newAutoscaler.ObjectMeta, &oldAutoscaler.ObjectMeta, field.NewPath("metadata"))
allErrs = append(allErrs, validateVerticalPodAutoscalerSpec(&newAutoscaler.Spec, field.NewPath("spec"))...)
return allErrs
}
// ValidateVerticalPodAutoscalerStatusUpdate that VerticalPodAutoscaler status update is valid.
func ValidateVerticalPodAutoscalerStatusUpdate(newAutoscaler, oldAutoscaler *autoscaling.VerticalPodAutoscaler) field.ErrorList {
allErrs := corevalidation.ValidateObjectMetaUpdate(&newAutoscaler.ObjectMeta, &oldAutoscaler.ObjectMeta, field.NewPath("metadata"))
allErrs = append(allErrs, validateVerticalPodAutoscalerStatus(&newAutoscaler.Status, field.NewPath("status"))...)
return allErrs
}

View File

@ -1,235 +0,0 @@
/*
Copyright 2018 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 validation
import (
"strings"
"testing"
"time"
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/kubernetes/pkg/apis/autoscaling"
core "k8s.io/kubernetes/pkg/apis/core"
)
func expectErrorWithMessage(t *testing.T, errs field.ErrorList, expectedMsg string) {
if len(errs) == 0 {
t.Errorf("expected failure with message '%s'", expectedMsg)
} else if !strings.Contains(errs[0].Error(), expectedMsg) {
t.Errorf("unexpected error: '%v', expected: '%s'", errs[0], expectedMsg)
}
}
func makeValidAutoscaler() *autoscaling.VerticalPodAutoscaler {
return &autoscaling.VerticalPodAutoscaler{
ObjectMeta: metav1.ObjectMeta{Name: "my-vpa", Namespace: metav1.NamespaceDefault},
Spec: autoscaling.VerticalPodAutoscalerSpec{
Selector: &metav1.LabelSelector{},
},
}
}
func TestValidateUpdateModeSuccess(t *testing.T) {
autoscaler := makeValidAutoscaler()
validUpdateMode := autoscaling.UpdateMode("Initial")
autoscaler.Spec.UpdatePolicy = &autoscaling.PodUpdatePolicy{UpdateMode: &validUpdateMode}
if errs := ValidateVerticalPodAutoscaler(autoscaler); len(errs) != 0 {
t.Errorf("expected success: %v", errs)
}
}
func TestValidateUpdateModeFailure(t *testing.T) {
autoscaler := makeValidAutoscaler()
invalidUpdateMode := autoscaling.UpdateMode("SomethingElse")
autoscaler.Spec.UpdatePolicy = &autoscaling.PodUpdatePolicy{UpdateMode: &invalidUpdateMode}
expectErrorWithMessage(t, ValidateVerticalPodAutoscaler(autoscaler), "Unsupported value: \"SomethingElse\"")
}
func TestValidateContainerScalingModeSuccess(t *testing.T) {
autoscaler := makeValidAutoscaler()
validContainerScalingMode := autoscaling.ContainerScalingMode("Off")
autoscaler.Spec.ResourcePolicy = &autoscaling.PodResourcePolicy{
ContainerPolicies: []autoscaling.ContainerResourcePolicy{{
ContainerName: "container1",
Mode: &validContainerScalingMode,
}},
}
if errs := ValidateVerticalPodAutoscaler(autoscaler); len(errs) != 0 {
t.Errorf("expected success: %v", errs)
}
}
func TestValidateContainerScalingModeFailure(t *testing.T) {
autoscaler := makeValidAutoscaler()
invalidContainerScalingMode := autoscaling.ContainerScalingMode("SomethingElse")
autoscaler.Spec.ResourcePolicy = &autoscaling.PodResourcePolicy{
ContainerPolicies: []autoscaling.ContainerResourcePolicy{{
ContainerName: "container1",
Mode: &invalidContainerScalingMode,
}},
}
expectErrorWithMessage(t, ValidateVerticalPodAutoscaler(autoscaler), "Unsupported value: \"SomethingElse\"")
}
func TestValidateResourceListSuccess(t *testing.T) {
cases := []struct {
resources core.ResourceList
upperBound core.ResourceList
}{
// Specified CPU and memory. Upper bound not specified for any resource.
{
core.ResourceList{
core.ResourceName(core.ResourceCPU): resource.MustParse("250m"),
core.ResourceName(core.ResourceMemory): resource.MustParse("10G"),
},
core.ResourceList{},
},
// Specified memory only. Upper bound for memory not specified.
{
core.ResourceList{
core.ResourceName(core.ResourceMemory): resource.MustParse("10G"),
},
core.ResourceList{
core.ResourceName(core.ResourceCPU): resource.MustParse("250m"),
},
},
// Specified CPU and memory. Upper bound for CPU and memory equal or greater.
{
core.ResourceList{
core.ResourceName(core.ResourceCPU): resource.MustParse("250m"),
core.ResourceName(core.ResourceMemory): resource.MustParse("10G"),
},
core.ResourceList{
core.ResourceName(core.ResourceCPU): resource.MustParse("300m"),
core.ResourceName(core.ResourceMemory): resource.MustParse("10G"),
},
},
}
for _, c := range cases {
if errs := validateResourceList(c.resources, c.upperBound, field.NewPath("resources")); len(errs) != 0 {
t.Errorf("expected success: %v", errs)
}
}
}
func TestValidateResourceListFailure(t *testing.T) {
cases := []struct {
resources core.ResourceList
upperBound core.ResourceList
expectedMsg string
}{
// Invalid resource type.
{
core.ResourceList{core.ResourceName(core.ResourceStorage): resource.MustParse("10G")},
core.ResourceList{},
"Unsupported value: storage",
},
// Invalid resource quantity.
{
core.ResourceList{core.ResourceName(core.ResourceCPU): resource.MustParse("-250m")},
core.ResourceList{},
"Invalid value: \"-250m\"",
},
// Lower bound exceeds upper bound.
{
core.ResourceList{core.ResourceName(core.ResourceCPU): resource.MustParse("250m")},
core.ResourceList{core.ResourceName(core.ResourceCPU): resource.MustParse("200m")},
"must be less than or equal to the upper bound",
},
}
for _, c := range cases {
expectErrorWithMessage(t, validateResourceList(c.resources, c.upperBound, field.NewPath("resources")),
c.expectedMsg)
}
}
func TestMissingRequiredSelector(t *testing.T) {
autoscaler := makeValidAutoscaler()
autoscaler.Spec.Selector = nil
expectedMsg := "spec.selector: Required value"
if errs := ValidateVerticalPodAutoscaler(autoscaler); len(errs) == 0 {
t.Errorf("expected failure with message '%s'", expectedMsg)
} else if !strings.Contains(errs[0].Error(), expectedMsg) {
t.Errorf("unexpected error: '%v', expected: '%s'", errs[0], expectedMsg)
}
}
func TestInvalidAutoscalerName(t *testing.T) {
autoscaler := makeValidAutoscaler()
autoscaler.ObjectMeta = metav1.ObjectMeta{Name: "@@@", Namespace: metav1.NamespaceDefault}
expectedMsg := "metadata.name: Invalid value: \"@@@\""
if errs := ValidateVerticalPodAutoscaler(autoscaler); len(errs) == 0 {
t.Errorf("expected failure with message '%s'", expectedMsg)
} else if !strings.Contains(errs[0].Error(), expectedMsg) {
t.Errorf("unexpected error: '%v', expected: '%s'", errs[0], expectedMsg)
}
}
func TestMinimalValidAutoscaler(t *testing.T) {
autoscaler := makeValidAutoscaler()
if errs := ValidateVerticalPodAutoscaler(autoscaler); len(errs) != 0 {
t.Errorf("expected success: %v", errs)
}
}
func TestCompleteValidAutoscaler(t *testing.T) {
sampleResourceList := core.ResourceList{
core.ResourceName(core.ResourceCPU): resource.MustParse("250m"),
core.ResourceName(core.ResourceMemory): resource.MustParse("10G"),
}
validUpdateMode := autoscaling.UpdateMode("Initial")
validContainerScalingMode := autoscaling.ContainerScalingMode("Auto")
autoscaler := &autoscaling.VerticalPodAutoscaler{
ObjectMeta: metav1.ObjectMeta{Name: "my-vpa", Namespace: metav1.NamespaceDefault},
Spec: autoscaling.VerticalPodAutoscalerSpec{
Selector: &metav1.LabelSelector{MatchLabels: map[string]string{"foo": "bar"}},
UpdatePolicy: &autoscaling.PodUpdatePolicy{
UpdateMode: &validUpdateMode,
},
ResourcePolicy: &autoscaling.PodResourcePolicy{
ContainerPolicies: []autoscaling.ContainerResourcePolicy{{
ContainerName: "container1",
Mode: &validContainerScalingMode,
MinAllowed: sampleResourceList,
MaxAllowed: sampleResourceList,
}},
},
},
Status: autoscaling.VerticalPodAutoscalerStatus{
Recommendation: &autoscaling.RecommendedPodResources{
ContainerRecommendations: []autoscaling.RecommendedContainerResources{{
ContainerName: "container1",
Target: sampleResourceList,
LowerBound: sampleResourceList,
UpperBound: sampleResourceList,
}},
},
Conditions: []autoscaling.VerticalPodAutoscalerCondition{{
Type: autoscaling.RecommendationProvided,
Status: core.ConditionStatus("True"),
LastTransitionTime: metav1.NewTime(time.Date(2018, time.January, 15, 0, 0, 0, 0, time.UTC)),
Reason: "Some reason",
Message: "Some message",
}},
},
}
if errs := ValidateVerticalPodAutoscaler(autoscaler); len(errs) != 0 {
t.Errorf("expected success: %v", errs)
}
}

View File

@ -23,48 +23,8 @@ package autoscaling
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
core "k8s.io/kubernetes/pkg/apis/core"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ContainerResourcePolicy) DeepCopyInto(out *ContainerResourcePolicy) {
*out = *in
if in.Mode != nil {
in, out := &in.Mode, &out.Mode
if *in == nil {
*out = nil
} else {
*out = new(ContainerScalingMode)
**out = **in
}
}
if in.MinAllowed != nil {
in, out := &in.MinAllowed, &out.MinAllowed
*out = make(core.ResourceList, len(*in))
for key, val := range *in {
(*out)[key] = val.DeepCopy()
}
}
if in.MaxAllowed != nil {
in, out := &in.MaxAllowed, &out.MaxAllowed
*out = make(core.ResourceList, len(*in))
for key, val := range *in {
(*out)[key] = val.DeepCopy()
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerResourcePolicy.
func (in *ContainerResourcePolicy) DeepCopy() *ContainerResourcePolicy {
if in == nil {
return nil
}
out := new(ContainerResourcePolicy)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {
*out = *in
@ -457,54 +417,6 @@ func (in *ObjectMetricStatus) DeepCopy() *ObjectMetricStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PodResourcePolicy) DeepCopyInto(out *PodResourcePolicy) {
*out = *in
if in.ContainerPolicies != nil {
in, out := &in.ContainerPolicies, &out.ContainerPolicies
*out = make([]ContainerResourcePolicy, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodResourcePolicy.
func (in *PodResourcePolicy) DeepCopy() *PodResourcePolicy {
if in == nil {
return nil
}
out := new(PodResourcePolicy)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PodUpdatePolicy) DeepCopyInto(out *PodUpdatePolicy) {
*out = *in
if in.UpdateMode != nil {
in, out := &in.UpdateMode, &out.UpdateMode
if *in == nil {
*out = nil
} else {
*out = new(UpdateMode)
**out = **in
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodUpdatePolicy.
func (in *PodUpdatePolicy) DeepCopy() *PodUpdatePolicy {
if in == nil {
return nil
}
out := new(PodUpdatePolicy)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PodsMetricSource) DeepCopyInto(out *PodsMetricSource) {
*out = *in
@ -539,66 +451,6 @@ func (in *PodsMetricStatus) DeepCopy() *PodsMetricStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RecommendedContainerResources) DeepCopyInto(out *RecommendedContainerResources) {
*out = *in
if in.Target != nil {
in, out := &in.Target, &out.Target
*out = make(core.ResourceList, len(*in))
for key, val := range *in {
(*out)[key] = val.DeepCopy()
}
}
if in.LowerBound != nil {
in, out := &in.LowerBound, &out.LowerBound
*out = make(core.ResourceList, len(*in))
for key, val := range *in {
(*out)[key] = val.DeepCopy()
}
}
if in.UpperBound != nil {
in, out := &in.UpperBound, &out.UpperBound
*out = make(core.ResourceList, len(*in))
for key, val := range *in {
(*out)[key] = val.DeepCopy()
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RecommendedContainerResources.
func (in *RecommendedContainerResources) DeepCopy() *RecommendedContainerResources {
if in == nil {
return nil
}
out := new(RecommendedContainerResources)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RecommendedPodResources) DeepCopyInto(out *RecommendedPodResources) {
*out = *in
if in.ContainerRecommendations != nil {
in, out := &in.ContainerRecommendations, &out.ContainerRecommendations
*out = make([]RecommendedContainerResources, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RecommendedPodResources.
func (in *RecommendedPodResources) DeepCopy() *RecommendedPodResources {
if in == nil {
return nil
}
out := new(RecommendedPodResources)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ResourceMetricSource) DeepCopyInto(out *ResourceMetricSource) {
*out = *in
@ -718,156 +570,3 @@ func (in *ScaleStatus) DeepCopy() *ScaleStatus {
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VerticalPodAutoscaler) DeepCopyInto(out *VerticalPodAutoscaler) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VerticalPodAutoscaler.
func (in *VerticalPodAutoscaler) DeepCopy() *VerticalPodAutoscaler {
if in == nil {
return nil
}
out := new(VerticalPodAutoscaler)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *VerticalPodAutoscaler) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VerticalPodAutoscalerCondition) DeepCopyInto(out *VerticalPodAutoscalerCondition) {
*out = *in
in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VerticalPodAutoscalerCondition.
func (in *VerticalPodAutoscalerCondition) DeepCopy() *VerticalPodAutoscalerCondition {
if in == nil {
return nil
}
out := new(VerticalPodAutoscalerCondition)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VerticalPodAutoscalerList) DeepCopyInto(out *VerticalPodAutoscalerList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]VerticalPodAutoscaler, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VerticalPodAutoscalerList.
func (in *VerticalPodAutoscalerList) DeepCopy() *VerticalPodAutoscalerList {
if in == nil {
return nil
}
out := new(VerticalPodAutoscalerList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *VerticalPodAutoscalerList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VerticalPodAutoscalerSpec) DeepCopyInto(out *VerticalPodAutoscalerSpec) {
*out = *in
if in.Selector != nil {
in, out := &in.Selector, &out.Selector
if *in == nil {
*out = nil
} else {
*out = new(v1.LabelSelector)
(*in).DeepCopyInto(*out)
}
}
if in.UpdatePolicy != nil {
in, out := &in.UpdatePolicy, &out.UpdatePolicy
if *in == nil {
*out = nil
} else {
*out = new(PodUpdatePolicy)
(*in).DeepCopyInto(*out)
}
}
if in.ResourcePolicy != nil {
in, out := &in.ResourcePolicy, &out.ResourcePolicy
if *in == nil {
*out = nil
} else {
*out = new(PodResourcePolicy)
(*in).DeepCopyInto(*out)
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VerticalPodAutoscalerSpec.
func (in *VerticalPodAutoscalerSpec) DeepCopy() *VerticalPodAutoscalerSpec {
if in == nil {
return nil
}
out := new(VerticalPodAutoscalerSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VerticalPodAutoscalerStatus) DeepCopyInto(out *VerticalPodAutoscalerStatus) {
*out = *in
if in.Recommendation != nil {
in, out := &in.Recommendation, &out.Recommendation
if *in == nil {
*out = nil
} else {
*out = new(RecommendedPodResources)
(*in).DeepCopyInto(*out)
}
}
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]VerticalPodAutoscalerCondition, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VerticalPodAutoscalerStatus.
func (in *VerticalPodAutoscalerStatus) DeepCopy() *VerticalPodAutoscalerStatus {
if in == nil {
return nil
}
out := new(VerticalPodAutoscalerStatus)
in.DeepCopyInto(out)
return out
}

View File

@ -12,7 +12,6 @@ go_library(
"doc.go",
"generated_expansion.go",
"horizontalpodautoscaler.go",
"verticalpodautoscaler.go",
],
importpath = "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/autoscaling/internalversion",
deps = [

View File

@ -26,7 +26,6 @@ import (
type AutoscalingInterface interface {
RESTClient() rest.Interface
HorizontalPodAutoscalersGetter
VerticalPodAutoscalersGetter
}
// AutoscalingClient is used to interact with features provided by the autoscaling group.
@ -38,10 +37,6 @@ func (c *AutoscalingClient) HorizontalPodAutoscalers(namespace string) Horizonta
return newHorizontalPodAutoscalers(c, namespace)
}
func (c *AutoscalingClient) VerticalPodAutoscalers(namespace string) VerticalPodAutoscalerInterface {
return newVerticalPodAutoscalers(c, namespace)
}
// NewForConfig creates a new AutoscalingClient for the given config.
func NewForConfig(c *rest.Config) (*AutoscalingClient, error) {
config := *c

View File

@ -11,7 +11,6 @@ go_library(
"doc.go",
"fake_autoscaling_client.go",
"fake_horizontalpodautoscaler.go",
"fake_verticalpodautoscaler.go",
],
importpath = "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/typed/autoscaling/internalversion/fake",
deps = [

View File

@ -32,10 +32,6 @@ func (c *FakeAutoscaling) HorizontalPodAutoscalers(namespace string) internalver
return &FakeHorizontalPodAutoscalers{c, namespace}
}
func (c *FakeAutoscaling) VerticalPodAutoscalers(namespace string) internalversion.VerticalPodAutoscalerInterface {
return &FakeVerticalPodAutoscalers{c, namespace}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeAutoscaling) RESTClient() rest.Interface {

View File

@ -1,140 +0,0 @@
/*
Copyright 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.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling"
)
// FakeVerticalPodAutoscalers implements VerticalPodAutoscalerInterface
type FakeVerticalPodAutoscalers struct {
Fake *FakeAutoscaling
ns string
}
var verticalpodautoscalersResource = schema.GroupVersionResource{Group: "autoscaling", Version: "", Resource: "verticalpodautoscalers"}
var verticalpodautoscalersKind = schema.GroupVersionKind{Group: "autoscaling", Version: "", Kind: "VerticalPodAutoscaler"}
// Get takes name of the verticalPodAutoscaler, and returns the corresponding verticalPodAutoscaler object, and an error if there is any.
func (c *FakeVerticalPodAutoscalers) Get(name string, options v1.GetOptions) (result *autoscaling.VerticalPodAutoscaler, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(verticalpodautoscalersResource, c.ns, name), &autoscaling.VerticalPodAutoscaler{})
if obj == nil {
return nil, err
}
return obj.(*autoscaling.VerticalPodAutoscaler), err
}
// List takes label and field selectors, and returns the list of VerticalPodAutoscalers that match those selectors.
func (c *FakeVerticalPodAutoscalers) List(opts v1.ListOptions) (result *autoscaling.VerticalPodAutoscalerList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(verticalpodautoscalersResource, verticalpodautoscalersKind, c.ns, opts), &autoscaling.VerticalPodAutoscalerList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &autoscaling.VerticalPodAutoscalerList{ListMeta: obj.(*autoscaling.VerticalPodAutoscalerList).ListMeta}
for _, item := range obj.(*autoscaling.VerticalPodAutoscalerList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested verticalPodAutoscalers.
func (c *FakeVerticalPodAutoscalers) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(verticalpodautoscalersResource, c.ns, opts))
}
// Create takes the representation of a verticalPodAutoscaler and creates it. Returns the server's representation of the verticalPodAutoscaler, and an error, if there is any.
func (c *FakeVerticalPodAutoscalers) Create(verticalPodAutoscaler *autoscaling.VerticalPodAutoscaler) (result *autoscaling.VerticalPodAutoscaler, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(verticalpodautoscalersResource, c.ns, verticalPodAutoscaler), &autoscaling.VerticalPodAutoscaler{})
if obj == nil {
return nil, err
}
return obj.(*autoscaling.VerticalPodAutoscaler), err
}
// Update takes the representation of a verticalPodAutoscaler and updates it. Returns the server's representation of the verticalPodAutoscaler, and an error, if there is any.
func (c *FakeVerticalPodAutoscalers) Update(verticalPodAutoscaler *autoscaling.VerticalPodAutoscaler) (result *autoscaling.VerticalPodAutoscaler, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(verticalpodautoscalersResource, c.ns, verticalPodAutoscaler), &autoscaling.VerticalPodAutoscaler{})
if obj == nil {
return nil, err
}
return obj.(*autoscaling.VerticalPodAutoscaler), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeVerticalPodAutoscalers) UpdateStatus(verticalPodAutoscaler *autoscaling.VerticalPodAutoscaler) (*autoscaling.VerticalPodAutoscaler, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(verticalpodautoscalersResource, "status", c.ns, verticalPodAutoscaler), &autoscaling.VerticalPodAutoscaler{})
if obj == nil {
return nil, err
}
return obj.(*autoscaling.VerticalPodAutoscaler), err
}
// Delete takes name of the verticalPodAutoscaler and deletes it. Returns an error if one occurs.
func (c *FakeVerticalPodAutoscalers) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(verticalpodautoscalersResource, c.ns, name), &autoscaling.VerticalPodAutoscaler{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeVerticalPodAutoscalers) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(verticalpodautoscalersResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &autoscaling.VerticalPodAutoscalerList{})
return err
}
// Patch applies the patch and returns the patched verticalPodAutoscaler.
func (c *FakeVerticalPodAutoscalers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *autoscaling.VerticalPodAutoscaler, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(verticalpodautoscalersResource, c.ns, name, data, subresources...), &autoscaling.VerticalPodAutoscaler{})
if obj == nil {
return nil, err
}
return obj.(*autoscaling.VerticalPodAutoscaler), err
}

View File

@ -19,5 +19,3 @@ limitations under the License.
package internalversion
type HorizontalPodAutoscalerExpansion interface{}
type VerticalPodAutoscalerExpansion interface{}

View File

@ -1,174 +0,0 @@
/*
Copyright 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.
*/
// Code generated by client-gen. DO NOT EDIT.
package internalversion
import (
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling"
scheme "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset/scheme"
)
// VerticalPodAutoscalersGetter has a method to return a VerticalPodAutoscalerInterface.
// A group's client should implement this interface.
type VerticalPodAutoscalersGetter interface {
VerticalPodAutoscalers(namespace string) VerticalPodAutoscalerInterface
}
// VerticalPodAutoscalerInterface has methods to work with VerticalPodAutoscaler resources.
type VerticalPodAutoscalerInterface interface {
Create(*autoscaling.VerticalPodAutoscaler) (*autoscaling.VerticalPodAutoscaler, error)
Update(*autoscaling.VerticalPodAutoscaler) (*autoscaling.VerticalPodAutoscaler, error)
UpdateStatus(*autoscaling.VerticalPodAutoscaler) (*autoscaling.VerticalPodAutoscaler, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*autoscaling.VerticalPodAutoscaler, error)
List(opts v1.ListOptions) (*autoscaling.VerticalPodAutoscalerList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *autoscaling.VerticalPodAutoscaler, err error)
VerticalPodAutoscalerExpansion
}
// verticalPodAutoscalers implements VerticalPodAutoscalerInterface
type verticalPodAutoscalers struct {
client rest.Interface
ns string
}
// newVerticalPodAutoscalers returns a VerticalPodAutoscalers
func newVerticalPodAutoscalers(c *AutoscalingClient, namespace string) *verticalPodAutoscalers {
return &verticalPodAutoscalers{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the verticalPodAutoscaler, and returns the corresponding verticalPodAutoscaler object, and an error if there is any.
func (c *verticalPodAutoscalers) Get(name string, options v1.GetOptions) (result *autoscaling.VerticalPodAutoscaler, err error) {
result = &autoscaling.VerticalPodAutoscaler{}
err = c.client.Get().
Namespace(c.ns).
Resource("verticalpodautoscalers").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of VerticalPodAutoscalers that match those selectors.
func (c *verticalPodAutoscalers) List(opts v1.ListOptions) (result *autoscaling.VerticalPodAutoscalerList, err error) {
result = &autoscaling.VerticalPodAutoscalerList{}
err = c.client.Get().
Namespace(c.ns).
Resource("verticalpodautoscalers").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested verticalPodAutoscalers.
func (c *verticalPodAutoscalers) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("verticalpodautoscalers").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Create takes the representation of a verticalPodAutoscaler and creates it. Returns the server's representation of the verticalPodAutoscaler, and an error, if there is any.
func (c *verticalPodAutoscalers) Create(verticalPodAutoscaler *autoscaling.VerticalPodAutoscaler) (result *autoscaling.VerticalPodAutoscaler, err error) {
result = &autoscaling.VerticalPodAutoscaler{}
err = c.client.Post().
Namespace(c.ns).
Resource("verticalpodautoscalers").
Body(verticalPodAutoscaler).
Do().
Into(result)
return
}
// Update takes the representation of a verticalPodAutoscaler and updates it. Returns the server's representation of the verticalPodAutoscaler, and an error, if there is any.
func (c *verticalPodAutoscalers) Update(verticalPodAutoscaler *autoscaling.VerticalPodAutoscaler) (result *autoscaling.VerticalPodAutoscaler, err error) {
result = &autoscaling.VerticalPodAutoscaler{}
err = c.client.Put().
Namespace(c.ns).
Resource("verticalpodautoscalers").
Name(verticalPodAutoscaler.Name).
Body(verticalPodAutoscaler).
Do().
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *verticalPodAutoscalers) UpdateStatus(verticalPodAutoscaler *autoscaling.VerticalPodAutoscaler) (result *autoscaling.VerticalPodAutoscaler, err error) {
result = &autoscaling.VerticalPodAutoscaler{}
err = c.client.Put().
Namespace(c.ns).
Resource("verticalpodautoscalers").
Name(verticalPodAutoscaler.Name).
SubResource("status").
Body(verticalPodAutoscaler).
Do().
Into(result)
return
}
// Delete takes name of the verticalPodAutoscaler and deletes it. Returns an error if one occurs.
func (c *verticalPodAutoscalers) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("verticalpodautoscalers").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *verticalPodAutoscalers) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("verticalpodautoscalers").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Patch applies the patch and returns the patched verticalPodAutoscaler.
func (c *verticalPodAutoscalers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *autoscaling.VerticalPodAutoscaler, err error) {
result = &autoscaling.VerticalPodAutoscaler{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("verticalpodautoscalers").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -10,7 +10,6 @@ go_library(
srcs = [
"horizontalpodautoscaler.go",
"interface.go",
"verticalpodautoscaler.go",
],
importpath = "k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion/autoscaling/internalversion",
deps = [

View File

@ -26,8 +26,6 @@ import (
type Interface interface {
// HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer.
HorizontalPodAutoscalers() HorizontalPodAutoscalerInformer
// VerticalPodAutoscalers returns a VerticalPodAutoscalerInformer.
VerticalPodAutoscalers() VerticalPodAutoscalerInformer
}
type version struct {
@ -45,8 +43,3 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
func (v *version) HorizontalPodAutoscalers() HorizontalPodAutoscalerInformer {
return &horizontalPodAutoscalerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// VerticalPodAutoscalers returns a VerticalPodAutoscalerInformer.
func (v *version) VerticalPodAutoscalers() VerticalPodAutoscalerInformer {
return &verticalPodAutoscalerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}

View File

@ -1,89 +0,0 @@
/*
Copyright 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.
*/
// Code generated by informer-gen. DO NOT EDIT.
package internalversion
import (
time "time"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
cache "k8s.io/client-go/tools/cache"
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling"
internalclientset "k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
internalinterfaces "k8s.io/kubernetes/pkg/client/informers/informers_generated/internalversion/internalinterfaces"
internalversion "k8s.io/kubernetes/pkg/client/listers/autoscaling/internalversion"
)
// VerticalPodAutoscalerInformer provides access to a shared informer and lister for
// VerticalPodAutoscalers.
type VerticalPodAutoscalerInformer interface {
Informer() cache.SharedIndexInformer
Lister() internalversion.VerticalPodAutoscalerLister
}
type verticalPodAutoscalerInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
namespace string
}
// NewVerticalPodAutoscalerInformer constructs a new informer for VerticalPodAutoscaler type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewVerticalPodAutoscalerInformer(client internalclientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredVerticalPodAutoscalerInformer(client, namespace, resyncPeriod, indexers, nil)
}
// NewFilteredVerticalPodAutoscalerInformer constructs a new informer for VerticalPodAutoscaler type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewFilteredVerticalPodAutoscalerInformer(client internalclientset.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.Autoscaling().VerticalPodAutoscalers(namespace).List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.Autoscaling().VerticalPodAutoscalers(namespace).Watch(options)
},
},
&autoscaling.VerticalPodAutoscaler{},
resyncPeriod,
indexers,
)
}
func (f *verticalPodAutoscalerInformer) defaultInformer(client internalclientset.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredVerticalPodAutoscalerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *verticalPodAutoscalerInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&autoscaling.VerticalPodAutoscaler{}, f.defaultInformer)
}
func (f *verticalPodAutoscalerInformer) Lister() internalversion.VerticalPodAutoscalerLister {
return internalversion.NewVerticalPodAutoscalerLister(f.Informer().GetIndexer())
}

View File

@ -81,8 +81,6 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
// Group=autoscaling, Version=internalVersion
case autoscaling.SchemeGroupVersion.WithResource("horizontalpodautoscalers"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().InternalVersion().HorizontalPodAutoscalers().Informer()}, nil
case autoscaling.SchemeGroupVersion.WithResource("verticalpodautoscalers"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().InternalVersion().VerticalPodAutoscalers().Informer()}, nil
// Group=batch, Version=internalVersion
case batch.SchemeGroupVersion.WithResource("cronjobs"):

View File

@ -10,7 +10,6 @@ go_library(
srcs = [
"expansion_generated.go",
"horizontalpodautoscaler.go",
"verticalpodautoscaler.go",
],
importpath = "k8s.io/kubernetes/pkg/client/listers/autoscaling/internalversion",
deps = [

View File

@ -25,11 +25,3 @@ type HorizontalPodAutoscalerListerExpansion interface{}
// HorizontalPodAutoscalerNamespaceListerExpansion allows custom methods to be added to
// HorizontalPodAutoscalerNamespaceLister.
type HorizontalPodAutoscalerNamespaceListerExpansion interface{}
// VerticalPodAutoscalerListerExpansion allows custom methods to be added to
// VerticalPodAutoscalerLister.
type VerticalPodAutoscalerListerExpansion interface{}
// VerticalPodAutoscalerNamespaceListerExpansion allows custom methods to be added to
// VerticalPodAutoscalerNamespaceLister.
type VerticalPodAutoscalerNamespaceListerExpansion interface{}

View File

@ -1,94 +0,0 @@
/*
Copyright 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.
*/
// Code generated by lister-gen. DO NOT EDIT.
package internalversion
import (
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
autoscaling "k8s.io/kubernetes/pkg/apis/autoscaling"
)
// VerticalPodAutoscalerLister helps list VerticalPodAutoscalers.
type VerticalPodAutoscalerLister interface {
// List lists all VerticalPodAutoscalers in the indexer.
List(selector labels.Selector) (ret []*autoscaling.VerticalPodAutoscaler, err error)
// VerticalPodAutoscalers returns an object that can list and get VerticalPodAutoscalers.
VerticalPodAutoscalers(namespace string) VerticalPodAutoscalerNamespaceLister
VerticalPodAutoscalerListerExpansion
}
// verticalPodAutoscalerLister implements the VerticalPodAutoscalerLister interface.
type verticalPodAutoscalerLister struct {
indexer cache.Indexer
}
// NewVerticalPodAutoscalerLister returns a new VerticalPodAutoscalerLister.
func NewVerticalPodAutoscalerLister(indexer cache.Indexer) VerticalPodAutoscalerLister {
return &verticalPodAutoscalerLister{indexer: indexer}
}
// List lists all VerticalPodAutoscalers in the indexer.
func (s *verticalPodAutoscalerLister) List(selector labels.Selector) (ret []*autoscaling.VerticalPodAutoscaler, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*autoscaling.VerticalPodAutoscaler))
})
return ret, err
}
// VerticalPodAutoscalers returns an object that can list and get VerticalPodAutoscalers.
func (s *verticalPodAutoscalerLister) VerticalPodAutoscalers(namespace string) VerticalPodAutoscalerNamespaceLister {
return verticalPodAutoscalerNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// VerticalPodAutoscalerNamespaceLister helps list and get VerticalPodAutoscalers.
type VerticalPodAutoscalerNamespaceLister interface {
// List lists all VerticalPodAutoscalers in the indexer for a given namespace.
List(selector labels.Selector) (ret []*autoscaling.VerticalPodAutoscaler, err error)
// Get retrieves the VerticalPodAutoscaler from the indexer for a given namespace and name.
Get(name string) (*autoscaling.VerticalPodAutoscaler, error)
VerticalPodAutoscalerNamespaceListerExpansion
}
// verticalPodAutoscalerNamespaceLister implements the VerticalPodAutoscalerNamespaceLister
// interface.
type verticalPodAutoscalerNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all VerticalPodAutoscalers in the indexer for a given namespace.
func (s verticalPodAutoscalerNamespaceLister) List(selector labels.Selector) (ret []*autoscaling.VerticalPodAutoscaler, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*autoscaling.VerticalPodAutoscaler))
})
return ret, err
}
// Get retrieves the VerticalPodAutoscaler from the indexer for a given namespace and name.
func (s verticalPodAutoscalerNamespaceLister) Get(name string) (*autoscaling.VerticalPodAutoscaler, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(autoscaling.Resource("verticalpodautoscaler"), name)
}
return obj.(*autoscaling.VerticalPodAutoscaler), nil
}

View File

@ -18,7 +18,6 @@ go_library(
importpath = "k8s.io/api/autoscaling/v2beta1",
deps = [
"//vendor/github.com/gogo/protobuf/proto:go_default_library",
"//vendor/github.com/gogo/protobuf/sortkeys:go_default_library",
"//vendor/k8s.io/api/core/v1:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/api/resource:go_default_library",
"//vendor/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",

File diff suppressed because it is too large Load Diff

View File

@ -31,29 +31,6 @@ import "k8s.io/apimachinery/pkg/util/intstr/generated.proto";
// Package-wide variables from generator "generated".
option go_package = "v2beta1";
// ContainerResourcePolicy controls how autoscaler computes the recommended
// resources for a specific container.
message ContainerResourcePolicy {
// Name of the container or DefaultContainerResourcePolicy, in which
// case the policy is used by the containers that don't have their own
// policy specified.
optional string containerName = 1;
// Whether autoscaler is enabled for the container. The default is "Auto".
// +optional
optional string mode = 2;
// Specifies the minimal amount of resources that will be recommended
// for the container. The default is no minimum.
// +optional
map<string, k8s.io.apimachinery.pkg.api.resource.Quantity> minAllowed = 3;
// Specifies the maximum amount of resources that will be recommended
// for the container. The default is no maximum.
// +optional
map<string, k8s.io.apimachinery.pkg.api.resource.Quantity> maxAllowed = 4;
}
// CrossVersionObjectReference contains enough information to let you identify the referred resource.
message CrossVersionObjectReference {
// Kind of the referent; More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds"
@ -312,26 +289,6 @@ message ObjectMetricStatus {
optional k8s.io.apimachinery.pkg.api.resource.Quantity currentValue = 3;
}
// PodResourcePolicy controls how autoscaler computes the recommended resources
// for containers belonging to the pod. There can be at most one entry for every
// named container and optionally a single wildcard entry with `containerName` = '*',
// which handles all containers that don't have individual policies.
message PodResourcePolicy {
// Per-container resource policies.
// +optional
// +patchMergeKey=containerName
// +patchStrategy=merge
repeated ContainerResourcePolicy containerPolicies = 1;
}
// PodUpdatePolicy describes the rules on how changes are applied to the pods.
message PodUpdatePolicy {
// Controls when autoscaler applies changes to the pod resources.
// The default is 'Auto'.
// +optional
optional string updateMode = 1;
}
// PodsMetricSource indicates how to scale on a metric describing each pod in
// the current scale target (for example, transactions-processed-per-second).
// The values will be averaged together before being compared to the target
@ -356,39 +313,6 @@ message PodsMetricStatus {
optional k8s.io.apimachinery.pkg.api.resource.Quantity currentAverageValue = 2;
}
// RecommendedContainerResources is the recommendation of resources computed by
// autoscaler for a specific container. Respects the container resource policy
// if present in the spec. In particular the recommendation is not produced for
// containers with `ContainerScalingMode` set to 'Off'.
message RecommendedContainerResources {
// Name of the container.
optional string containerName = 1;
// Recommended amount of resources.
map<string, k8s.io.apimachinery.pkg.api.resource.Quantity> target = 2;
// Minimum recommended amount of resources.
// This amount is not guaranteed to be sufficient for the application to operate in a stable way, however
// running with less resources is likely to have significant impact on performance/availability.
// +optional
map<string, k8s.io.apimachinery.pkg.api.resource.Quantity> lowerBound = 3;
// Maximum recommended amount of resources.
// Any resources allocated beyond this value are likely wasted. This value may be larger than the maximum
// amount of application is actually capable of consuming.
// +optional
map<string, k8s.io.apimachinery.pkg.api.resource.Quantity> upperBound = 4;
}
// RecommendedPodResources is the recommendation of resources computed by
// autoscaler. It contains a recommendation for each container in the pod
// (except for those with `ContainerScalingMode` set to 'Off').
message RecommendedPodResources {
// Resources recommended by the autoscaler for each container.
// +optional
repeated RecommendedContainerResources containerRecommendations = 1;
}
// ResourceMetricSource indicates how to scale on a resource metric known to
// Kubernetes, as specified in requests and limits, describing each pod in the
// current scale target (e.g. CPU or memory). The values will be averaged
@ -437,89 +361,3 @@ message ResourceMetricStatus {
optional k8s.io.apimachinery.pkg.api.resource.Quantity currentAverageValue = 3;
}
// VerticalPodAutoscaler is the configuration for a vertical pod
// autoscaler, which automatically manages pod resources based on historical and
// real time resource utilization.
message VerticalPodAutoscaler {
// Standard object metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
// +optional
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// Specification of the behavior of the autoscaler.
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status.
optional VerticalPodAutoscalerSpec spec = 2;
// Current information about the autoscaler.
// +optional
optional VerticalPodAutoscalerStatus status = 3;
}
// VerticalPodAutoscalerCondition describes the state of
// a VerticalPodAutoscaler at a certain point.
message VerticalPodAutoscalerCondition {
// type describes the current condition
optional string type = 1;
// status is the status of the condition (True, False, Unknown)
optional string status = 2;
// lastTransitionTime is the last time the condition transitioned from
// one status to another
// +optional
optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 3;
// reason is the reason for the condition's last transition.
// +optional
optional string reason = 4;
// message is a human-readable explanation containing details about
// the transition
// +optional
optional string message = 5;
}
// VerticalPodAutoscalerList is a list of VerticalPodAutoscaler objects.
message VerticalPodAutoscalerList {
// metadata is the standard list metadata.
// +optional
optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
// items is the list of vertical pod autoscaler objects.
repeated VerticalPodAutoscaler items = 2;
}
// VerticalPodAutoscalerSpec is the specification of the behavior of the autoscaler.
message VerticalPodAutoscalerSpec {
// A label query that determines the set of pods controlled by the Autoscaler.
// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
optional k8s.io.apimachinery.pkg.apis.meta.v1.LabelSelector selector = 1;
// Describes the rules on how changes are applied to the pods.
// If not specified, all fields in the `PodUpdatePolicy` are set to their
// default values.
// +optional
optional PodUpdatePolicy updatePolicy = 2;
// Controls how the autoscaler computes recommended resources.
// The resource policy may be used to set constraints on the recommendations
// for individual containers. If not specified, the autoscaler computes recommended
// resources for all containers in the pod, without additional constraints.
// +optional
optional PodResourcePolicy resourcePolicy = 3;
}
// VerticalPodAutoscalerStatus describes the runtime state of the autoscaler.
message VerticalPodAutoscalerStatus {
// The most recently computed amount of resources recommended by the
// autoscaler for the controlled pods.
// +optional
optional RecommendedPodResources recommendation = 1;
// Conditions is the set of conditions required for this autoscaler to scale its target,
// and indicates whether or not those conditions are met.
// +optional
// +patchMergeKey=type
// +patchStrategy=merge
repeated VerticalPodAutoscalerCondition conditions = 2;
}

View File

@ -22,8 +22,6 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// ** Horizontal Pod Autoscaler types start here **
// CrossVersionObjectReference contains enough information to let you identify the referred resource.
type CrossVersionObjectReference struct {
// Kind of the referent; More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds"
@ -372,212 +370,3 @@ type HorizontalPodAutoscalerList struct {
// items is the list of horizontal pod autoscaler objects.
Items []HorizontalPodAutoscaler `json:"items" protobuf:"bytes,2,rep,name=items"`
}
// ** Vertical Pod Autoscaler types start here **
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// VerticalPodAutoscalerList is a list of VerticalPodAutoscaler objects.
type VerticalPodAutoscalerList struct {
metav1.TypeMeta `json:",inline"`
// metadata is the standard list metadata.
// +optional
metav1.ListMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"`
// items is the list of vertical pod autoscaler objects.
Items []VerticalPodAutoscaler `json:"items" protobuf:"bytes,2,rep,name=items"`
}
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// VerticalPodAutoscaler is the configuration for a vertical pod
// autoscaler, which automatically manages pod resources based on historical and
// real time resource utilization.
type VerticalPodAutoscaler struct {
metav1.TypeMeta `json:",inline"`
// Standard object metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata
// +optional
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Specification of the behavior of the autoscaler.
// More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status.
Spec VerticalPodAutoscalerSpec `json:"spec" protobuf:"bytes,2,name=spec"`
// Current information about the autoscaler.
// +optional
Status VerticalPodAutoscalerStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
}
// VerticalPodAutoscalerSpec is the specification of the behavior of the autoscaler.
type VerticalPodAutoscalerSpec struct {
// A label query that determines the set of pods controlled by the Autoscaler.
// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
Selector *metav1.LabelSelector `json:"selector" protobuf:"bytes,1,name=selector"`
// Describes the rules on how changes are applied to the pods.
// If not specified, all fields in the `PodUpdatePolicy` are set to their
// default values.
// +optional
UpdatePolicy *PodUpdatePolicy `json:"updatePolicy,omitempty" protobuf:"bytes,2,opt,name=updatePolicy"`
// Controls how the autoscaler computes recommended resources.
// The resource policy may be used to set constraints on the recommendations
// for individual containers. If not specified, the autoscaler computes recommended
// resources for all containers in the pod, without additional constraints.
// +optional
ResourcePolicy *PodResourcePolicy `json:"resourcePolicy,omitempty" protobuf:"bytes,3,opt,name=resourcePolicy"`
}
// PodUpdatePolicy describes the rules on how changes are applied to the pods.
type PodUpdatePolicy struct {
// Controls when autoscaler applies changes to the pod resources.
// The default is 'Auto'.
// +optional
UpdateMode *UpdateMode `json:"updateMode,omitempty" protobuf:"bytes,1,opt,name=updateMode"`
}
// UpdateMode controls when autoscaler applies changes to the pod resoures.
type UpdateMode string
const (
// UpdateModeOff means that autoscaler never changes Pod resources.
// The recommender still sets the recommended resources in the
// VerticalPodAutoscaler object. This can be used for a "dry run".
UpdateModeOff UpdateMode = "Off"
// UpdateModeInitial means that autoscaler only assigns resources on pod
// creation and does not change them during the lifetime of the pod.
UpdateModeInitial UpdateMode = "Initial"
// UpdateModeRecreate means that autoscaler assigns resources on pod
// creation and additionally can update them during the lifetime of the
// pod by deleting and recreating the pod.
UpdateModeRecreate UpdateMode = "Recreate"
// UpdateModeAuto means that autoscaler assigns resources on pod creation
// and additionally can update them during the lifetime of the pod,
// using any available update method. Currently this is equivalent to
// Recreate, which is the only available update method.
UpdateModeAuto UpdateMode = "Auto"
)
// PodResourcePolicy controls how autoscaler computes the recommended resources
// for containers belonging to the pod. There can be at most one entry for every
// named container and optionally a single wildcard entry with `containerName` = '*',
// which handles all containers that don't have individual policies.
type PodResourcePolicy struct {
// Per-container resource policies.
// +optional
// +patchMergeKey=containerName
// +patchStrategy=merge
ContainerPolicies []ContainerResourcePolicy `json:"containerPolicies,omitempty" patchStrategy:"merge" patchMergeKey:"containerName" protobuf:"bytes,1,rep,name=containerPolicies"`
}
// ContainerResourcePolicy controls how autoscaler computes the recommended
// resources for a specific container.
type ContainerResourcePolicy struct {
// Name of the container or DefaultContainerResourcePolicy, in which
// case the policy is used by the containers that don't have their own
// policy specified.
ContainerName string `json:"containerName,omitempty" protobuf:"bytes,1,opt,name=containerName"`
// Whether autoscaler is enabled for the container. The default is "Auto".
// +optional
Mode *ContainerScalingMode `json:"mode,omitempty" protobuf:"bytes,2,opt,name=mode"`
// Specifies the minimal amount of resources that will be recommended
// for the container. The default is no minimum.
// +optional
MinAllowed v1.ResourceList `json:"minAllowed,omitempty" protobuf:"bytes,3,rep,name=minAllowed,casttype=ResourceList,castkey=ResourceName"`
// Specifies the maximum amount of resources that will be recommended
// for the container. The default is no maximum.
// +optional
MaxAllowed v1.ResourceList `json:"maxAllowed,omitempty" protobuf:"bytes,4,rep,name=maxAllowed,casttype=ResourceList,castkey=ResourceName"`
}
const (
// DefaultContainerResourcePolicy can be passed as
// ContainerResourcePolicy.ContainerName to specify the default policy.
DefaultContainerResourcePolicy = "*"
)
// ContainerScalingMode controls whether autoscaler is enabled for a specific
// container.
type ContainerScalingMode string
const (
// ContainerScalingModeAuto means autoscaling is enabled for a container.
ContainerScalingModeAuto ContainerScalingMode = "Auto"
// ContainerScalingModeOff means autoscaling is disabled for a container.
ContainerScalingModeOff ContainerScalingMode = "Off"
)
// VerticalPodAutoscalerStatus describes the runtime state of the autoscaler.
type VerticalPodAutoscalerStatus struct {
// The most recently computed amount of resources recommended by the
// autoscaler for the controlled pods.
// +optional
Recommendation *RecommendedPodResources `json:"recommendation,omitempty" protobuf:"bytes,1,opt,name=recommendation"`
// Conditions is the set of conditions required for this autoscaler to scale its target,
// and indicates whether or not those conditions are met.
// +optional
// +patchMergeKey=type
// +patchStrategy=merge
Conditions []VerticalPodAutoscalerCondition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,2,rep,name=conditions"`
}
// RecommendedPodResources is the recommendation of resources computed by
// autoscaler. It contains a recommendation for each container in the pod
// (except for those with `ContainerScalingMode` set to 'Off').
type RecommendedPodResources struct {
// Resources recommended by the autoscaler for each container.
// +optional
ContainerRecommendations []RecommendedContainerResources `json:"containerRecommendations,omitempty" protobuf:"bytes,1,rep,name=containerRecommendations"`
}
// RecommendedContainerResources is the recommendation of resources computed by
// autoscaler for a specific container. Respects the container resource policy
// if present in the spec. In particular the recommendation is not produced for
// containers with `ContainerScalingMode` set to 'Off'.
type RecommendedContainerResources struct {
// Name of the container.
ContainerName string `json:"containerName,omitempty" protobuf:"bytes,1,opt,name=containerName"`
// Recommended amount of resources.
Target v1.ResourceList `json:"target" protobuf:"bytes,2,rep,name=target,casttype=ResourceList,castkey=ResourceName"`
// Minimum recommended amount of resources.
// This amount is not guaranteed to be sufficient for the application to operate in a stable way, however
// running with less resources is likely to have significant impact on performance/availability.
// +optional
LowerBound v1.ResourceList `json:"lowerBound,omitempty" protobuf:"bytes,3,rep,name=lowerBound,casttype=ResourceList,castkey=ResourceName"`
// Maximum recommended amount of resources.
// Any resources allocated beyond this value are likely wasted. This value may be larger than the maximum
// amount of application is actually capable of consuming.
// +optional
UpperBound v1.ResourceList `json:"upperBound,omitempty" protobuf:"bytes,4,rep,name=upperBound,casttype=ResourceList,castkey=ResourceName"`
}
// VerticalPodAutoscalerConditionType are the valid conditions of
// a VerticalPodAutoscaler.
type VerticalPodAutoscalerConditionType string
var (
// RecommendationProvided indicates whether the VPA recommender was able to calculate a recommendation.
RecommendationProvided VerticalPodAutoscalerConditionType = "RecommendationProvided"
)
// VerticalPodAutoscalerCondition describes the state of
// a VerticalPodAutoscaler at a certain point.
type VerticalPodAutoscalerCondition struct {
// type describes the current condition
Type VerticalPodAutoscalerConditionType `json:"type" protobuf:"bytes,1,name=type"`
// status is the status of the condition (True, False, Unknown)
Status v1.ConditionStatus `json:"status" protobuf:"bytes,2,name=status"`
// lastTransitionTime is the last time the condition transitioned from
// one status to another
// +optional
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"`
// reason is the reason for the condition's last transition.
// +optional
Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
// message is a human-readable explanation containing details about
// the transition
// +optional
Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
}

View File

@ -27,18 +27,6 @@ package v2beta1
// Those methods can be generated by using hack/update-generated-swagger-docs.sh
// AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT.
var map_ContainerResourcePolicy = map[string]string{
"": "ContainerResourcePolicy controls how autoscaler computes the recommended resources for a specific container.",
"containerName": "Name of the container or DefaultContainerResourcePolicy, in which case the policy is used by the containers that don't have their own policy specified.",
"mode": "Whether autoscaler is enabled for the container. The default is \"Auto\".",
"minAllowed": "Specifies the minimal amount of resources that will be recommended for the container. The default is no minimum.",
"maxAllowed": "Specifies the maximum amount of resources that will be recommended for the container. The default is no maximum.",
}
func (ContainerResourcePolicy) SwaggerDoc() map[string]string {
return map_ContainerResourcePolicy
}
var map_CrossVersionObjectReference = map[string]string{
"": "CrossVersionObjectReference contains enough information to let you identify the referred resource.",
"kind": "Kind of the referent; More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds\"",
@ -182,24 +170,6 @@ func (ObjectMetricStatus) SwaggerDoc() map[string]string {
return map_ObjectMetricStatus
}
var map_PodResourcePolicy = map[string]string{
"": "PodResourcePolicy controls how autoscaler computes the recommended resources for containers belonging to the pod. There can be at most one entry for every named container and optionally a single wildcard entry with `containerName` = '*', which handles all containers that don't have individual policies.",
"containerPolicies": "Per-container resource policies.",
}
func (PodResourcePolicy) SwaggerDoc() map[string]string {
return map_PodResourcePolicy
}
var map_PodUpdatePolicy = map[string]string{
"": "PodUpdatePolicy describes the rules on how changes are applied to the pods.",
"updateMode": "Controls when autoscaler applies changes to the pod resources. The default is 'Auto'.",
}
func (PodUpdatePolicy) SwaggerDoc() map[string]string {
return map_PodUpdatePolicy
}
var map_PodsMetricSource = map[string]string{
"": "PodsMetricSource indicates how to scale on a metric describing each pod in the current scale target (for example, transactions-processed-per-second). The values will be averaged together before being compared to the target value.",
"metricName": "metricName is the name of the metric in question",
@ -220,27 +190,6 @@ func (PodsMetricStatus) SwaggerDoc() map[string]string {
return map_PodsMetricStatus
}
var map_RecommendedContainerResources = map[string]string{
"": "RecommendedContainerResources is the recommendation of resources computed by autoscaler for a specific container. Respects the container resource policy if present in the spec. In particular the recommendation is not produced for containers with `ContainerScalingMode` set to 'Off'.",
"containerName": "Name of the container.",
"target": "Recommended amount of resources.",
"lowerBound": "Minimum recommended amount of resources. This amount is not guaranteed to be sufficient for the application to operate in a stable way, however running with less resources is likely to have significant impact on performance/availability.",
"upperBound": "Maximum recommended amount of resources. Any resources allocated beyond this value are likely wasted. This value may be larger than the maximum amount of application is actually capable of consuming.",
}
func (RecommendedContainerResources) SwaggerDoc() map[string]string {
return map_RecommendedContainerResources
}
var map_RecommendedPodResources = map[string]string{
"": "RecommendedPodResources is the recommendation of resources computed by autoscaler. It contains a recommendation for each container in the pod (except for those with `ContainerScalingMode` set to 'Off').",
"containerRecommendations": "Resources recommended by the autoscaler for each container.",
}
func (RecommendedPodResources) SwaggerDoc() map[string]string {
return map_RecommendedPodResources
}
var map_ResourceMetricSource = map[string]string{
"": "ResourceMetricSource indicates how to scale on a resource metric known to Kubernetes, as specified in requests and limits, describing each pod in the current scale target (e.g. CPU or memory). The values will be averaged together before being compared to the target. Such metrics are built in to Kubernetes, and have special scaling options on top of those available to normal per-pod metrics using the \"pods\" source. Only one \"target\" type should be set.",
"name": "name is the name of the resource in question.",
@ -263,59 +212,4 @@ func (ResourceMetricStatus) SwaggerDoc() map[string]string {
return map_ResourceMetricStatus
}
var map_VerticalPodAutoscaler = map[string]string{
"": "VerticalPodAutoscaler is the configuration for a vertical pod autoscaler, which automatically manages pod resources based on historical and real time resource utilization.",
"metadata": "Standard object metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata",
"spec": "Specification of the behavior of the autoscaler. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status.",
"status": "Current information about the autoscaler.",
}
func (VerticalPodAutoscaler) SwaggerDoc() map[string]string {
return map_VerticalPodAutoscaler
}
var map_VerticalPodAutoscalerCondition = map[string]string{
"": "VerticalPodAutoscalerCondition describes the state of a VerticalPodAutoscaler at a certain point.",
"type": "type describes the current condition",
"status": "status is the status of the condition (True, False, Unknown)",
"lastTransitionTime": "lastTransitionTime is the last time the condition transitioned from one status to another",
"reason": "reason is the reason for the condition's last transition.",
"message": "message is a human-readable explanation containing details about the transition",
}
func (VerticalPodAutoscalerCondition) SwaggerDoc() map[string]string {
return map_VerticalPodAutoscalerCondition
}
var map_VerticalPodAutoscalerList = map[string]string{
"": "VerticalPodAutoscalerList is a list of VerticalPodAutoscaler objects.",
"metadata": "metadata is the standard list metadata.",
"items": "items is the list of vertical pod autoscaler objects.",
}
func (VerticalPodAutoscalerList) SwaggerDoc() map[string]string {
return map_VerticalPodAutoscalerList
}
var map_VerticalPodAutoscalerSpec = map[string]string{
"": "VerticalPodAutoscalerSpec is the specification of the behavior of the autoscaler.",
"selector": "A label query that determines the set of pods controlled by the Autoscaler. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors",
"updatePolicy": "Describes the rules on how changes are applied to the pods. If not specified, all fields in the `PodUpdatePolicy` are set to their default values.",
"resourcePolicy": "Controls how the autoscaler computes recommended resources. The resource policy may be used to set constraints on the recommendations for individual containers. If not specified, the autoscaler computes recommended resources for all containers in the pod, without additional constraints.",
}
func (VerticalPodAutoscalerSpec) SwaggerDoc() map[string]string {
return map_VerticalPodAutoscalerSpec
}
var map_VerticalPodAutoscalerStatus = map[string]string{
"": "VerticalPodAutoscalerStatus describes the runtime state of the autoscaler.",
"recommendation": "The most recently computed amount of resources recommended by the autoscaler for the controlled pods.",
"conditions": "Conditions is the set of conditions required for this autoscaler to scale its target, and indicates whether or not those conditions are met.",
}
func (VerticalPodAutoscalerStatus) SwaggerDoc() map[string]string {
return map_VerticalPodAutoscalerStatus
}
// AUTO-GENERATED FUNCTIONS END HERE

View File

@ -21,50 +21,10 @@ limitations under the License.
package v2beta1
import (
v1 "k8s.io/api/core/v1"
meta_v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ContainerResourcePolicy) DeepCopyInto(out *ContainerResourcePolicy) {
*out = *in
if in.Mode != nil {
in, out := &in.Mode, &out.Mode
if *in == nil {
*out = nil
} else {
*out = new(ContainerScalingMode)
**out = **in
}
}
if in.MinAllowed != nil {
in, out := &in.MinAllowed, &out.MinAllowed
*out = make(v1.ResourceList, len(*in))
for key, val := range *in {
(*out)[key] = val.DeepCopy()
}
}
if in.MaxAllowed != nil {
in, out := &in.MaxAllowed, &out.MaxAllowed
*out = make(v1.ResourceList, len(*in))
for key, val := range *in {
(*out)[key] = val.DeepCopy()
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerResourcePolicy.
func (in *ContainerResourcePolicy) DeepCopy() *ContainerResourcePolicy {
if in == nil {
return nil
}
out := new(ContainerResourcePolicy)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *CrossVersionObjectReference) DeepCopyInto(out *CrossVersionObjectReference) {
*out = *in
@ -89,7 +49,7 @@ func (in *ExternalMetricSource) DeepCopyInto(out *ExternalMetricSource) {
if *in == nil {
*out = nil
} else {
*out = new(meta_v1.LabelSelector)
*out = new(v1.LabelSelector)
(*in).DeepCopyInto(*out)
}
}
@ -132,7 +92,7 @@ func (in *ExternalMetricStatus) DeepCopyInto(out *ExternalMetricStatus) {
if *in == nil {
*out = nil
} else {
*out = new(meta_v1.LabelSelector)
*out = new(v1.LabelSelector)
(*in).DeepCopyInto(*out)
}
}
@ -457,54 +417,6 @@ func (in *ObjectMetricStatus) DeepCopy() *ObjectMetricStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PodResourcePolicy) DeepCopyInto(out *PodResourcePolicy) {
*out = *in
if in.ContainerPolicies != nil {
in, out := &in.ContainerPolicies, &out.ContainerPolicies
*out = make([]ContainerResourcePolicy, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodResourcePolicy.
func (in *PodResourcePolicy) DeepCopy() *PodResourcePolicy {
if in == nil {
return nil
}
out := new(PodResourcePolicy)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PodUpdatePolicy) DeepCopyInto(out *PodUpdatePolicy) {
*out = *in
if in.UpdateMode != nil {
in, out := &in.UpdateMode, &out.UpdateMode
if *in == nil {
*out = nil
} else {
*out = new(UpdateMode)
**out = **in
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodUpdatePolicy.
func (in *PodUpdatePolicy) DeepCopy() *PodUpdatePolicy {
if in == nil {
return nil
}
out := new(PodUpdatePolicy)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PodsMetricSource) DeepCopyInto(out *PodsMetricSource) {
*out = *in
@ -539,66 +451,6 @@ func (in *PodsMetricStatus) DeepCopy() *PodsMetricStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RecommendedContainerResources) DeepCopyInto(out *RecommendedContainerResources) {
*out = *in
if in.Target != nil {
in, out := &in.Target, &out.Target
*out = make(v1.ResourceList, len(*in))
for key, val := range *in {
(*out)[key] = val.DeepCopy()
}
}
if in.LowerBound != nil {
in, out := &in.LowerBound, &out.LowerBound
*out = make(v1.ResourceList, len(*in))
for key, val := range *in {
(*out)[key] = val.DeepCopy()
}
}
if in.UpperBound != nil {
in, out := &in.UpperBound, &out.UpperBound
*out = make(v1.ResourceList, len(*in))
for key, val := range *in {
(*out)[key] = val.DeepCopy()
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RecommendedContainerResources.
func (in *RecommendedContainerResources) DeepCopy() *RecommendedContainerResources {
if in == nil {
return nil
}
out := new(RecommendedContainerResources)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *RecommendedPodResources) DeepCopyInto(out *RecommendedPodResources) {
*out = *in
if in.ContainerRecommendations != nil {
in, out := &in.ContainerRecommendations, &out.ContainerRecommendations
*out = make([]RecommendedContainerResources, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RecommendedPodResources.
func (in *RecommendedPodResources) DeepCopy() *RecommendedPodResources {
if in == nil {
return nil
}
out := new(RecommendedPodResources)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ResourceMetricSource) DeepCopyInto(out *ResourceMetricSource) {
*out = *in
@ -658,156 +510,3 @@ func (in *ResourceMetricStatus) DeepCopy() *ResourceMetricStatus {
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VerticalPodAutoscaler) DeepCopyInto(out *VerticalPodAutoscaler) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VerticalPodAutoscaler.
func (in *VerticalPodAutoscaler) DeepCopy() *VerticalPodAutoscaler {
if in == nil {
return nil
}
out := new(VerticalPodAutoscaler)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *VerticalPodAutoscaler) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VerticalPodAutoscalerCondition) DeepCopyInto(out *VerticalPodAutoscalerCondition) {
*out = *in
in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VerticalPodAutoscalerCondition.
func (in *VerticalPodAutoscalerCondition) DeepCopy() *VerticalPodAutoscalerCondition {
if in == nil {
return nil
}
out := new(VerticalPodAutoscalerCondition)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VerticalPodAutoscalerList) DeepCopyInto(out *VerticalPodAutoscalerList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]VerticalPodAutoscaler, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VerticalPodAutoscalerList.
func (in *VerticalPodAutoscalerList) DeepCopy() *VerticalPodAutoscalerList {
if in == nil {
return nil
}
out := new(VerticalPodAutoscalerList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *VerticalPodAutoscalerList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VerticalPodAutoscalerSpec) DeepCopyInto(out *VerticalPodAutoscalerSpec) {
*out = *in
if in.Selector != nil {
in, out := &in.Selector, &out.Selector
if *in == nil {
*out = nil
} else {
*out = new(meta_v1.LabelSelector)
(*in).DeepCopyInto(*out)
}
}
if in.UpdatePolicy != nil {
in, out := &in.UpdatePolicy, &out.UpdatePolicy
if *in == nil {
*out = nil
} else {
*out = new(PodUpdatePolicy)
(*in).DeepCopyInto(*out)
}
}
if in.ResourcePolicy != nil {
in, out := &in.ResourcePolicy, &out.ResourcePolicy
if *in == nil {
*out = nil
} else {
*out = new(PodResourcePolicy)
(*in).DeepCopyInto(*out)
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VerticalPodAutoscalerSpec.
func (in *VerticalPodAutoscalerSpec) DeepCopy() *VerticalPodAutoscalerSpec {
if in == nil {
return nil
}
out := new(VerticalPodAutoscalerSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VerticalPodAutoscalerStatus) DeepCopyInto(out *VerticalPodAutoscalerStatus) {
*out = *in
if in.Recommendation != nil {
in, out := &in.Recommendation, &out.Recommendation
if *in == nil {
*out = nil
} else {
*out = new(RecommendedPodResources)
(*in).DeepCopyInto(*out)
}
}
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]VerticalPodAutoscalerCondition, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VerticalPodAutoscalerStatus.
func (in *VerticalPodAutoscalerStatus) DeepCopy() *VerticalPodAutoscalerStatus {
if in == nil {
return nil
}
out := new(VerticalPodAutoscalerStatus)
in.DeepCopyInto(out)
return out
}

View File

@ -5,7 +5,6 @@ go_library(
srcs = [
"horizontalpodautoscaler.go",
"interface.go",
"verticalpodautoscaler.go",
],
importpath = "k8s.io/client-go/informers/autoscaling/v2beta1",
visibility = ["//visibility:public"],

View File

@ -26,8 +26,6 @@ import (
type Interface interface {
// HorizontalPodAutoscalers returns a HorizontalPodAutoscalerInformer.
HorizontalPodAutoscalers() HorizontalPodAutoscalerInformer
// VerticalPodAutoscalers returns a VerticalPodAutoscalerInformer.
VerticalPodAutoscalers() VerticalPodAutoscalerInformer
}
type version struct {
@ -45,8 +43,3 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
func (v *version) HorizontalPodAutoscalers() HorizontalPodAutoscalerInformer {
return &horizontalPodAutoscalerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}
// VerticalPodAutoscalers returns a VerticalPodAutoscalerInformer.
func (v *version) VerticalPodAutoscalers() VerticalPodAutoscalerInformer {
return &verticalPodAutoscalerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
}

View File

@ -1,89 +0,0 @@
/*
Copyright 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.
*/
// Code generated by informer-gen. DO NOT EDIT.
package v2beta1
import (
time "time"
autoscaling_v2beta1 "k8s.io/api/autoscaling/v2beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
kubernetes "k8s.io/client-go/kubernetes"
v2beta1 "k8s.io/client-go/listers/autoscaling/v2beta1"
cache "k8s.io/client-go/tools/cache"
)
// VerticalPodAutoscalerInformer provides access to a shared informer and lister for
// VerticalPodAutoscalers.
type VerticalPodAutoscalerInformer interface {
Informer() cache.SharedIndexInformer
Lister() v2beta1.VerticalPodAutoscalerLister
}
type verticalPodAutoscalerInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
namespace string
}
// NewVerticalPodAutoscalerInformer constructs a new informer for VerticalPodAutoscaler type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewVerticalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredVerticalPodAutoscalerInformer(client, namespace, resyncPeriod, indexers, nil)
}
// NewFilteredVerticalPodAutoscalerInformer constructs a new informer for VerticalPodAutoscaler type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewFilteredVerticalPodAutoscalerInformer(client kubernetes.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.AutoscalingV2beta1().VerticalPodAutoscalers(namespace).List(options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.AutoscalingV2beta1().VerticalPodAutoscalers(namespace).Watch(options)
},
},
&autoscaling_v2beta1.VerticalPodAutoscaler{},
resyncPeriod,
indexers,
)
}
func (f *verticalPodAutoscalerInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredVerticalPodAutoscalerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *verticalPodAutoscalerInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&autoscaling_v2beta1.VerticalPodAutoscaler{}, f.defaultInformer)
}
func (f *verticalPodAutoscalerInformer) Lister() v2beta1.VerticalPodAutoscalerLister {
return v2beta1.NewVerticalPodAutoscalerLister(f.Informer().GetIndexer())
}

View File

@ -125,8 +125,6 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
// Group=autoscaling, Version=v2beta1
case v2beta1.SchemeGroupVersion.WithResource("horizontalpodautoscalers"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V2beta1().HorizontalPodAutoscalers().Informer()}, nil
case v2beta1.SchemeGroupVersion.WithResource("verticalpodautoscalers"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V2beta1().VerticalPodAutoscalers().Informer()}, nil
// Group=batch, Version=v1
case batch_v1.SchemeGroupVersion.WithResource("jobs"):

View File

@ -7,7 +7,6 @@ go_library(
"doc.go",
"generated_expansion.go",
"horizontalpodautoscaler.go",
"verticalpodautoscaler.go",
],
importpath = "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1",
visibility = ["//visibility:public"],

View File

@ -28,7 +28,6 @@ import (
type AutoscalingV2beta1Interface interface {
RESTClient() rest.Interface
HorizontalPodAutoscalersGetter
VerticalPodAutoscalersGetter
}
// AutoscalingV2beta1Client is used to interact with features provided by the autoscaling group.
@ -40,10 +39,6 @@ func (c *AutoscalingV2beta1Client) HorizontalPodAutoscalers(namespace string) Ho
return newHorizontalPodAutoscalers(c, namespace)
}
func (c *AutoscalingV2beta1Client) VerticalPodAutoscalers(namespace string) VerticalPodAutoscalerInterface {
return newVerticalPodAutoscalers(c, namespace)
}
// NewForConfig creates a new AutoscalingV2beta1Client for the given config.
func NewForConfig(c *rest.Config) (*AutoscalingV2beta1Client, error) {
config := *c

View File

@ -6,7 +6,6 @@ go_library(
"doc.go",
"fake_autoscaling_client.go",
"fake_horizontalpodautoscaler.go",
"fake_verticalpodautoscaler.go",
],
importpath = "k8s.io/client-go/kubernetes/typed/autoscaling/v2beta1/fake",
visibility = ["//visibility:public"],

View File

@ -32,10 +32,6 @@ func (c *FakeAutoscalingV2beta1) HorizontalPodAutoscalers(namespace string) v2be
return &FakeHorizontalPodAutoscalers{c, namespace}
}
func (c *FakeAutoscalingV2beta1) VerticalPodAutoscalers(namespace string) v2beta1.VerticalPodAutoscalerInterface {
return &FakeVerticalPodAutoscalers{c, namespace}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeAutoscalingV2beta1) RESTClient() rest.Interface {

View File

@ -1,140 +0,0 @@
/*
Copyright 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.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
v2beta1 "k8s.io/api/autoscaling/v2beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeVerticalPodAutoscalers implements VerticalPodAutoscalerInterface
type FakeVerticalPodAutoscalers struct {
Fake *FakeAutoscalingV2beta1
ns string
}
var verticalpodautoscalersResource = schema.GroupVersionResource{Group: "autoscaling", Version: "v2beta1", Resource: "verticalpodautoscalers"}
var verticalpodautoscalersKind = schema.GroupVersionKind{Group: "autoscaling", Version: "v2beta1", Kind: "VerticalPodAutoscaler"}
// Get takes name of the verticalPodAutoscaler, and returns the corresponding verticalPodAutoscaler object, and an error if there is any.
func (c *FakeVerticalPodAutoscalers) Get(name string, options v1.GetOptions) (result *v2beta1.VerticalPodAutoscaler, err error) {
obj, err := c.Fake.
Invokes(testing.NewGetAction(verticalpodautoscalersResource, c.ns, name), &v2beta1.VerticalPodAutoscaler{})
if obj == nil {
return nil, err
}
return obj.(*v2beta1.VerticalPodAutoscaler), err
}
// List takes label and field selectors, and returns the list of VerticalPodAutoscalers that match those selectors.
func (c *FakeVerticalPodAutoscalers) List(opts v1.ListOptions) (result *v2beta1.VerticalPodAutoscalerList, err error) {
obj, err := c.Fake.
Invokes(testing.NewListAction(verticalpodautoscalersResource, verticalpodautoscalersKind, c.ns, opts), &v2beta1.VerticalPodAutoscalerList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v2beta1.VerticalPodAutoscalerList{ListMeta: obj.(*v2beta1.VerticalPodAutoscalerList).ListMeta}
for _, item := range obj.(*v2beta1.VerticalPodAutoscalerList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested verticalPodAutoscalers.
func (c *FakeVerticalPodAutoscalers) Watch(opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(verticalpodautoscalersResource, c.ns, opts))
}
// Create takes the representation of a verticalPodAutoscaler and creates it. Returns the server's representation of the verticalPodAutoscaler, and an error, if there is any.
func (c *FakeVerticalPodAutoscalers) Create(verticalPodAutoscaler *v2beta1.VerticalPodAutoscaler) (result *v2beta1.VerticalPodAutoscaler, err error) {
obj, err := c.Fake.
Invokes(testing.NewCreateAction(verticalpodautoscalersResource, c.ns, verticalPodAutoscaler), &v2beta1.VerticalPodAutoscaler{})
if obj == nil {
return nil, err
}
return obj.(*v2beta1.VerticalPodAutoscaler), err
}
// Update takes the representation of a verticalPodAutoscaler and updates it. Returns the server's representation of the verticalPodAutoscaler, and an error, if there is any.
func (c *FakeVerticalPodAutoscalers) Update(verticalPodAutoscaler *v2beta1.VerticalPodAutoscaler) (result *v2beta1.VerticalPodAutoscaler, err error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateAction(verticalpodautoscalersResource, c.ns, verticalPodAutoscaler), &v2beta1.VerticalPodAutoscaler{})
if obj == nil {
return nil, err
}
return obj.(*v2beta1.VerticalPodAutoscaler), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeVerticalPodAutoscalers) UpdateStatus(verticalPodAutoscaler *v2beta1.VerticalPodAutoscaler) (*v2beta1.VerticalPodAutoscaler, error) {
obj, err := c.Fake.
Invokes(testing.NewUpdateSubresourceAction(verticalpodautoscalersResource, "status", c.ns, verticalPodAutoscaler), &v2beta1.VerticalPodAutoscaler{})
if obj == nil {
return nil, err
}
return obj.(*v2beta1.VerticalPodAutoscaler), err
}
// Delete takes name of the verticalPodAutoscaler and deletes it. Returns an error if one occurs.
func (c *FakeVerticalPodAutoscalers) Delete(name string, options *v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewDeleteAction(verticalpodautoscalersResource, c.ns, name), &v2beta1.VerticalPodAutoscaler{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeVerticalPodAutoscalers) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
action := testing.NewDeleteCollectionAction(verticalpodautoscalersResource, c.ns, listOptions)
_, err := c.Fake.Invokes(action, &v2beta1.VerticalPodAutoscalerList{})
return err
}
// Patch applies the patch and returns the patched verticalPodAutoscaler.
func (c *FakeVerticalPodAutoscalers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v2beta1.VerticalPodAutoscaler, err error) {
obj, err := c.Fake.
Invokes(testing.NewPatchSubresourceAction(verticalpodautoscalersResource, c.ns, name, data, subresources...), &v2beta1.VerticalPodAutoscaler{})
if obj == nil {
return nil, err
}
return obj.(*v2beta1.VerticalPodAutoscaler), err
}

View File

@ -19,5 +19,3 @@ limitations under the License.
package v2beta1
type HorizontalPodAutoscalerExpansion interface{}
type VerticalPodAutoscalerExpansion interface{}

View File

@ -1,174 +0,0 @@
/*
Copyright 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.
*/
// Code generated by client-gen. DO NOT EDIT.
package v2beta1
import (
v2beta1 "k8s.io/api/autoscaling/v2beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
scheme "k8s.io/client-go/kubernetes/scheme"
rest "k8s.io/client-go/rest"
)
// VerticalPodAutoscalersGetter has a method to return a VerticalPodAutoscalerInterface.
// A group's client should implement this interface.
type VerticalPodAutoscalersGetter interface {
VerticalPodAutoscalers(namespace string) VerticalPodAutoscalerInterface
}
// VerticalPodAutoscalerInterface has methods to work with VerticalPodAutoscaler resources.
type VerticalPodAutoscalerInterface interface {
Create(*v2beta1.VerticalPodAutoscaler) (*v2beta1.VerticalPodAutoscaler, error)
Update(*v2beta1.VerticalPodAutoscaler) (*v2beta1.VerticalPodAutoscaler, error)
UpdateStatus(*v2beta1.VerticalPodAutoscaler) (*v2beta1.VerticalPodAutoscaler, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v2beta1.VerticalPodAutoscaler, error)
List(opts v1.ListOptions) (*v2beta1.VerticalPodAutoscalerList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v2beta1.VerticalPodAutoscaler, err error)
VerticalPodAutoscalerExpansion
}
// verticalPodAutoscalers implements VerticalPodAutoscalerInterface
type verticalPodAutoscalers struct {
client rest.Interface
ns string
}
// newVerticalPodAutoscalers returns a VerticalPodAutoscalers
func newVerticalPodAutoscalers(c *AutoscalingV2beta1Client, namespace string) *verticalPodAutoscalers {
return &verticalPodAutoscalers{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the verticalPodAutoscaler, and returns the corresponding verticalPodAutoscaler object, and an error if there is any.
func (c *verticalPodAutoscalers) Get(name string, options v1.GetOptions) (result *v2beta1.VerticalPodAutoscaler, err error) {
result = &v2beta1.VerticalPodAutoscaler{}
err = c.client.Get().
Namespace(c.ns).
Resource("verticalpodautoscalers").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of VerticalPodAutoscalers that match those selectors.
func (c *verticalPodAutoscalers) List(opts v1.ListOptions) (result *v2beta1.VerticalPodAutoscalerList, err error) {
result = &v2beta1.VerticalPodAutoscalerList{}
err = c.client.Get().
Namespace(c.ns).
Resource("verticalpodautoscalers").
VersionedParams(&opts, scheme.ParameterCodec).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested verticalPodAutoscalers.
func (c *verticalPodAutoscalers) Watch(opts v1.ListOptions) (watch.Interface, error) {
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("verticalpodautoscalers").
VersionedParams(&opts, scheme.ParameterCodec).
Watch()
}
// Create takes the representation of a verticalPodAutoscaler and creates it. Returns the server's representation of the verticalPodAutoscaler, and an error, if there is any.
func (c *verticalPodAutoscalers) Create(verticalPodAutoscaler *v2beta1.VerticalPodAutoscaler) (result *v2beta1.VerticalPodAutoscaler, err error) {
result = &v2beta1.VerticalPodAutoscaler{}
err = c.client.Post().
Namespace(c.ns).
Resource("verticalpodautoscalers").
Body(verticalPodAutoscaler).
Do().
Into(result)
return
}
// Update takes the representation of a verticalPodAutoscaler and updates it. Returns the server's representation of the verticalPodAutoscaler, and an error, if there is any.
func (c *verticalPodAutoscalers) Update(verticalPodAutoscaler *v2beta1.VerticalPodAutoscaler) (result *v2beta1.VerticalPodAutoscaler, err error) {
result = &v2beta1.VerticalPodAutoscaler{}
err = c.client.Put().
Namespace(c.ns).
Resource("verticalpodautoscalers").
Name(verticalPodAutoscaler.Name).
Body(verticalPodAutoscaler).
Do().
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *verticalPodAutoscalers) UpdateStatus(verticalPodAutoscaler *v2beta1.VerticalPodAutoscaler) (result *v2beta1.VerticalPodAutoscaler, err error) {
result = &v2beta1.VerticalPodAutoscaler{}
err = c.client.Put().
Namespace(c.ns).
Resource("verticalpodautoscalers").
Name(verticalPodAutoscaler.Name).
SubResource("status").
Body(verticalPodAutoscaler).
Do().
Into(result)
return
}
// Delete takes name of the verticalPodAutoscaler and deletes it. Returns an error if one occurs.
func (c *verticalPodAutoscalers) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("verticalpodautoscalers").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *verticalPodAutoscalers) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("verticalpodautoscalers").
VersionedParams(&listOptions, scheme.ParameterCodec).
Body(options).
Do().
Error()
}
// Patch applies the patch and returns the patched verticalPodAutoscaler.
func (c *verticalPodAutoscalers) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v2beta1.VerticalPodAutoscaler, err error) {
result = &v2beta1.VerticalPodAutoscaler{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("verticalpodautoscalers").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

View File

@ -5,7 +5,6 @@ go_library(
srcs = [
"expansion_generated.go",
"horizontalpodautoscaler.go",
"verticalpodautoscaler.go",
],
importpath = "k8s.io/client-go/listers/autoscaling/v2beta1",
visibility = ["//visibility:public"],

View File

@ -25,11 +25,3 @@ type HorizontalPodAutoscalerListerExpansion interface{}
// HorizontalPodAutoscalerNamespaceListerExpansion allows custom methods to be added to
// HorizontalPodAutoscalerNamespaceLister.
type HorizontalPodAutoscalerNamespaceListerExpansion interface{}
// VerticalPodAutoscalerListerExpansion allows custom methods to be added to
// VerticalPodAutoscalerLister.
type VerticalPodAutoscalerListerExpansion interface{}
// VerticalPodAutoscalerNamespaceListerExpansion allows custom methods to be added to
// VerticalPodAutoscalerNamespaceLister.
type VerticalPodAutoscalerNamespaceListerExpansion interface{}

View File

@ -1,94 +0,0 @@
/*
Copyright 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.
*/
// Code generated by lister-gen. DO NOT EDIT.
package v2beta1
import (
v2beta1 "k8s.io/api/autoscaling/v2beta1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
)
// VerticalPodAutoscalerLister helps list VerticalPodAutoscalers.
type VerticalPodAutoscalerLister interface {
// List lists all VerticalPodAutoscalers in the indexer.
List(selector labels.Selector) (ret []*v2beta1.VerticalPodAutoscaler, err error)
// VerticalPodAutoscalers returns an object that can list and get VerticalPodAutoscalers.
VerticalPodAutoscalers(namespace string) VerticalPodAutoscalerNamespaceLister
VerticalPodAutoscalerListerExpansion
}
// verticalPodAutoscalerLister implements the VerticalPodAutoscalerLister interface.
type verticalPodAutoscalerLister struct {
indexer cache.Indexer
}
// NewVerticalPodAutoscalerLister returns a new VerticalPodAutoscalerLister.
func NewVerticalPodAutoscalerLister(indexer cache.Indexer) VerticalPodAutoscalerLister {
return &verticalPodAutoscalerLister{indexer: indexer}
}
// List lists all VerticalPodAutoscalers in the indexer.
func (s *verticalPodAutoscalerLister) List(selector labels.Selector) (ret []*v2beta1.VerticalPodAutoscaler, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v2beta1.VerticalPodAutoscaler))
})
return ret, err
}
// VerticalPodAutoscalers returns an object that can list and get VerticalPodAutoscalers.
func (s *verticalPodAutoscalerLister) VerticalPodAutoscalers(namespace string) VerticalPodAutoscalerNamespaceLister {
return verticalPodAutoscalerNamespaceLister{indexer: s.indexer, namespace: namespace}
}
// VerticalPodAutoscalerNamespaceLister helps list and get VerticalPodAutoscalers.
type VerticalPodAutoscalerNamespaceLister interface {
// List lists all VerticalPodAutoscalers in the indexer for a given namespace.
List(selector labels.Selector) (ret []*v2beta1.VerticalPodAutoscaler, err error)
// Get retrieves the VerticalPodAutoscaler from the indexer for a given namespace and name.
Get(name string) (*v2beta1.VerticalPodAutoscaler, error)
VerticalPodAutoscalerNamespaceListerExpansion
}
// verticalPodAutoscalerNamespaceLister implements the VerticalPodAutoscalerNamespaceLister
// interface.
type verticalPodAutoscalerNamespaceLister struct {
indexer cache.Indexer
namespace string
}
// List lists all VerticalPodAutoscalers in the indexer for a given namespace.
func (s verticalPodAutoscalerNamespaceLister) List(selector labels.Selector) (ret []*v2beta1.VerticalPodAutoscaler, err error) {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v2beta1.VerticalPodAutoscaler))
})
return ret, err
}
// Get retrieves the VerticalPodAutoscaler from the indexer for a given namespace and name.
func (s verticalPodAutoscalerNamespaceLister) Get(name string) (*v2beta1.VerticalPodAutoscaler, error) {
obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v2beta1.Resource("verticalpodautoscaler"), name)
}
return obj.(*v2beta1.VerticalPodAutoscaler), nil
}