Initial v1.0.0 commit

This commit is contained in:
Jakub Vavřík
2021-01-28 17:37:47 +01:00
commit 1481d27782
4164 changed files with 1264675 additions and 0 deletions

View File

@@ -0,0 +1,68 @@
/*
Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
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 v1alpha1 contains API Schema definitions for the autoscaling v1alpha1 API group
// +kubebuilder:object:generate=true
// +groupName=autoscaling.k8s.io
package v1alpha1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
vpa_api "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1beta2"
)
var (
// GroupName is the group name use in this package
GroupName = "autoscaling.k8s.io"
// SchemeGroupVersionVpa is group version used to register these objects
SchemeGroupVersionVpa = schema.GroupVersion{Group: GroupName, Version: "v1beta2"}
// SchemeGroupVersionHvpa is group version used to register these objects
SchemeGroupVersionHvpa = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"}
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
localSchemeBuilder = &SchemeBuilder
// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)
func init() {
// We only register manually written functions here. The registration of the
// generated functions takes place in the generated files. The separation
// makes the code compile even when the generated files are missing.
localSchemeBuilder.Register(addKnownTypes)
}
// Adds the list of known types to api.Scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersionHvpa,
&Hvpa{},
&HvpaList{},
)
scheme.AddKnownTypes(SchemeGroupVersionVpa,
&vpa_api.VerticalPodAutoscaler{},
&vpa_api.VerticalPodAutoscalerList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersionVpa)
metav1.AddToGroupVersion(scheme, SchemeGroupVersionHvpa)
return nil
}

View File

@@ -0,0 +1,352 @@
/*
Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
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 v1alpha1
import (
autoscaling "k8s.io/api/autoscaling/v2beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
vpa_api "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1beta2"
)
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
// VpaTemplateSpec defines the spec for VPA
type VpaTemplateSpec struct {
// 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 *vpa_api.PodResourcePolicy `json:"resourcePolicy,omitempty" protobuf:"bytes,2,opt,name=resourcePolicy"`
}
// UpdatePolicy describes the rules on how changes are applied.
type UpdatePolicy struct {
// Controls when autoscaler applies changes to the resources.
// The default is 'Auto'.
// +optional
UpdateMode *string `json:"updateMode,omitempty" protobuf:"bytes,1,opt,name=updateMode"`
}
const (
// UpdateModeOff means that autoscaler never changes resources.
UpdateModeOff string = "Off"
// UpdateModeAuto means that autoscaler can update resources during the lifetime of the resource.
UpdateModeAuto string = "Auto"
// UpdateModeMaintenanceWindow means that HPA/VPA will only act during maintenance window.
UpdateModeMaintenanceWindow string = "MaintenanceWindow"
// UpdateModeDefault is the default update mode
UpdateModeDefault = UpdateModeAuto
)
// MaintenanceTimeWindow contains information about the time window for maintenance operations.
type MaintenanceTimeWindow struct {
// Begin is the beginning of the time window in the format HHMMSS+ZONE, e.g. "220000+0100".
Begin string `json:"begin"`
// End is the end of the time window in the format HHMMSS+ZONE, e.g. "220000+0100".
End string `json:"end"`
}
// HpaTemplateSpec defines the spec for HPA
type HpaTemplateSpec struct {
// minReplicas is the lower limit for the number of replicas to which the autoscaler can scale down.
// It defaults to 1 pod.
// +optional
MinReplicas *int32 `json:"minReplicas,omitempty" protobuf:"varint,1,opt,name=minReplicas"`
// maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up.
// It cannot be less that minReplicas.
MaxReplicas int32 `json:"maxReplicas" protobuf:"varint,2,opt,name=maxReplicas"`
// metrics contains the specifications for which to use to calculate the
// desired replica count (the maximum replica count across all metrics will
// be used). The desired replica count is calculated multiplying the
// ratio between the target value and the current value by the current
// number of pods. Ergo, metrics used must decrease as the pod count is
// increased, and vice-versa. See the individual metric source types for
// more information about how each type of metric must respond.
// If not set, the default metric will be set to 80% average CPU utilization.
// +optional
Metrics []autoscaling.MetricSpec `json:"metrics,omitempty" protobuf:"bytes,3,rep,name=metrics"`
}
// WeightBasedScalingInterval defines the interval of replica counts in which VpaWeight is applied to VPA scaling
type WeightBasedScalingInterval struct {
// VpaWeight defines the weight (in percentage) to be given to VPA's recommendationd for the interval of number of replicas provided
// +kubebuilder:validation:Minimum=0
// +kubebuilder:validation:Maximum=100
VpaWeight VpaWeight `json:"vpaWeight,omitempty"`
// StartReplicaCount is the number of replicas from which VpaWeight is applied to VPA scaling
// If this field is not provided, it will default to minReplicas of HPA
// +optional
StartReplicaCount int32 `json:"startReplicaCount,omitempty"`
// LastReplicaCount is the number of replicas till which VpaWeight is applied to VPA scaling
// If this field is not provided, it will default to maxReplicas of HPA
// +optional
LastReplicaCount int32 `json:"lastReplicaCount,omitempty"`
}
// VpaSpec defines spec for VPA
type VpaSpec struct {
// Selector is a label query that should match VPA.
// Must match in order to be controlled.
// If empty, defaulted to labels on VPA template.
// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
// +optional
Selector *metav1.LabelSelector `json:"selector,omitempty"`
// Deploy defines whether the VPA is deployed or not
Deploy bool `json:"deploy,omitempty"`
// ScaleUp defines the parameters for scale up
ScaleUp ScaleType `json:"scaleUp,omitempty"`
// ScaleDown defines the parameters for scale down
ScaleDown ScaleType `json:"scaleDown,omitempty"`
// Template is the object that describes the VPA that will be created.
// +optional
Template VpaTemplate `json:"template,omitempty"`
// LimitsRequestsGapScaleParams is the scaling thresholds for limits
LimitsRequestsGapScaleParams ScaleParams `json:"limitsRequestsGapScaleParams,omitempty"`
}
// ScaleType defines parameters for scaling
type ScaleType struct {
// Describes the rules on when changes are applied.
// If not specified, all fields in the `UpdatePolicy` are set to their
// default values.
// +optional
UpdatePolicy UpdatePolicy `json:"updatePolicy,omitempty"`
// MinChange is the minimum change in the resource on which HVPA acts
// HVPA uses minimum of the Value and Percentage value
MinChange ScaleParams `json:"minChange,omitempty"`
// StabilizationDuration defines the minimum delay in minutes between 2 consecutive scale operations
// Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h"
StabilizationDuration *string `json:"stabilizationDuration,omitempty"`
}
// ScaleParams defines the scaling parameters for the limits
type ScaleParams struct {
// Scale parameters for CPU
CPU ChangeParams `json:"cpu,omitempty"`
// Scale parameters for memory
Memory ChangeParams `json:"memory,omitempty"`
// Scale patameters for replicas
Replicas ChangeParams `json:"replicas,omitempty"`
}
// VpaTemplate defines the template for VPA
type VpaTemplate struct {
// Metadata of the pods created from this template.
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`
// Spec defines the behavior of a VPA.
// +optional
Spec VpaTemplateSpec `json:"spec,omitempty"`
}
// HpaTemplate defines the template for HPA
type HpaTemplate struct {
// Metadata of the pods created from this template.
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`
// Spec defines the behavior of a HPA.
// +optional
Spec HpaTemplateSpec `json:"spec,omitempty"`
}
// HpaSpec defines spec for HPA
type HpaSpec struct {
// Selector is a label query that should match HPA.
// Must match in order to be controlled.
// If empty, defaulted to labels on HPA template.
// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
// +optional
Selector *metav1.LabelSelector `json:"selector,omitempty"`
// Deploy defines whether the HPA is deployed or not
Deploy bool `json:"deploy,omitempty"`
// ScaleUp defines the parameters for scale up
ScaleUp ScaleType `json:"scaleUp,omitempty"`
// ScaleDown defines the parameters for scale down
ScaleDown ScaleType `json:"scaleDown,omitempty"`
// Template is the object that describes the HPA that will be created.
// +optional
Template HpaTemplate `json:"template,omitempty"`
}
// HvpaSpec defines the desired state of Hvpa
type HvpaSpec struct {
// Replicas is the number of replicas of target resource
Replicas *int32 `json:"replicas,omitempty"`
// Hpa defines the spec of HPA
Hpa HpaSpec `json:"hpa,omitempty"`
// Vpa defines the spec of VPA
Vpa VpaSpec `json:"vpa,omitempty"`
// WeightBasedScalingIntervals defines the intervals of replica counts, and the weights for scaling a deployment vertically
// If there are overlapping intervals, then the vpaWeight will be taken from the first matching interval
WeightBasedScalingIntervals []WeightBasedScalingInterval `json:"weightBasedScalingIntervals,omitempty"`
// TargetRef points to the controller managing the set of pods for the autoscaler to control
TargetRef *autoscaling.CrossVersionObjectReference `json:"targetRef"`
// MaintenanceTimeWindow contains information about the time window for maintenance operations.
// +optional
MaintenanceTimeWindow *MaintenanceTimeWindow `json:"maintenanceTimeWindow,omitempty"`
}
// ChangeParams defines the parameters for scaling
type ChangeParams struct {
// Value is the absolute value of the scaling
// +optional
Value *string `json:"value,omitempty"`
// Percentage is the percentage of currently allocated value to be used for scaling
// +optional
Percentage *int32 `json:"percentage,omitempty"`
}
// VpaWeight - weight to provide to VPA scaling
type VpaWeight int32
const (
// VpaOnly - only vertical scaling
VpaOnly VpaWeight = 100
// HpaOnly - only horizontal scaling
HpaOnly VpaWeight = 0
)
// LastError has detailed information of the error
type LastError struct {
// Description of the error
Description string `json:"description,omitempty"`
// Time at which the error occurred
LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty"`
// LastOperation is the type of operation for which error occurred
LastOperation string `json:"lastOperation,omitempty"`
}
// HvpaStatus defines the observed state of Hvpa
type HvpaStatus struct {
// Replicas is the number of replicas of the target resource.
Replicas *int32 `json:"replicas,omitempty"`
// TargetSelector is the string form of the label selector of HPA. This is required for HPA to work with scale subresource.
TargetSelector *string `json:"targetSelector,omitempty"`
// Current HPA UpdatePolicy set in the spec
HpaScaleUpUpdatePolicy *UpdatePolicy `json:"hpaScaleUpUpdatePolicy,omitempty"`
// Current HPA UpdatePolicy set in the spec
HpaScaleDownUpdatePolicy *UpdatePolicy `json:"hpaScaleDownUpdatePolicy,omitempty"`
// Current VPA UpdatePolicy set in the spec
VpaScaleUpUpdatePolicy *UpdatePolicy `json:"vpaScaleUpUpdatePolicy,omitempty"`
// Current VPA UpdatePolicy set in the spec
VpaScaleDownUpdatePolicy *UpdatePolicy `json:"vpaScaleDownUpdatePolicy,omitempty"`
HpaWeight VpaWeight `json:"hpaWeight,omitempty"`
VpaWeight VpaWeight `json:"vpaWeight,omitempty"`
// Override scale up stabilization window
OverrideScaleUpStabilization bool `json:"overrideScaleUpStabilization,omitempty"`
LastBlockedScaling []*BlockedScaling `json:"lastBlockedScaling,omitempty"`
LastScaling ScalingStatus `json:"lastScaling,omitempty"`
// LastError has details of any errors that occurred
LastError *LastError `json:"lastError,omitempty"`
}
// BlockingReason defines the reason for blocking.
type BlockingReason string
const (
// BlockingReasonStabilizationWindow - HVPA is in stabilization window
BlockingReasonStabilizationWindow BlockingReason = "StabilizationWindow"
// BlockingReasonMaintenanceWindow - Resource is in maintenance window
BlockingReasonMaintenanceWindow BlockingReason = "MaintenanceWindow"
// BlockingReasonUpdatePolicy - Update policy doesn't support scaling
BlockingReasonUpdatePolicy BlockingReason = "UpdatePolicy"
// BlockingReasonWeight - VpaWeight doesn't support scaling
BlockingReasonWeight BlockingReason = "Weight"
// BlockingReasonMinChange - Min change doesn't support scaling
BlockingReasonMinChange BlockingReason = "MinChange"
)
// BlockingReasons lists all the blocking reasons
var BlockingReasons = [...]BlockingReason{
BlockingReasonMaintenanceWindow,
BlockingReasonMinChange,
BlockingReasonStabilizationWindow,
BlockingReasonUpdatePolicy,
BlockingReasonWeight,
}
// BlockedScaling defines the details for blocked scaling
type BlockedScaling struct {
Reason BlockingReason `json:"reason,omitempty"`
ScalingStatus `json:"scalingStatus,omitempty"`
}
// ScalingStatus defines the status of scaling
type ScalingStatus struct {
LastScaleTime *metav1.Time `json:"lastScaleTime,omitempty"`
HpaStatus HpaStatus `json:"hpaStatus,omitempty" protobuf:"bytes,1,opt,name=hpaStatus"`
VpaStatus vpa_api.VerticalPodAutoscalerStatus `json:"vpaStatus,omitempty" protobuf:"bytes,2,opt,name=vpaStatus"`
}
// HpaStatus defines the status of HPA
type HpaStatus struct {
CurrentReplicas int32 `json:"currentReplicas,omitempty"`
DesiredReplicas int32 `json:"desiredReplicas,omitempty"`
}
// Hvpa is the Schema for the hvpas API
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:subresource:scale:specpath=.spec.replicas,statuspath=.status.replicas,selectorpath=.status.targetSelector
type Hvpa struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec HvpaSpec `json:"spec,omitempty"`
Status HvpaStatus `json:"status,omitempty"`
}
// HvpaList contains a list of Hvpa
// +kubebuilder:object:root=true
type HvpaList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Hvpa `json:"items"`
}
/*func init() {
SchemeBuilder.Register(&Hvpa{}, &HvpaList{})
}*/

View File

@@ -0,0 +1,75 @@
/*
Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
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 v1alpha1
import (
"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/webhook"
)
// log is for logging in this package.
var hvpalog = logf.Log.WithName("hvpa-resource")
// SetupWebhookWithManager sets up manager with a new webhook and r as the reconcile.Reconciler
func (r *Hvpa) SetupWebhookWithManager(mgr ctrl.Manager) error {
return ctrl.NewWebhookManagedBy(mgr).
For(r).
Complete()
}
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// +kubebuilder:webhook:path=/mutate-autoscaling-k8s-io-v1alpha1-hvpa,mutating=true,failurePolicy=fail,groups=autoscaling.k8s.io,resources=hvpas,verbs=create;update,versions=v1alpha1,name=mhvpa.kb.io
var _ webhook.Defaulter = &Hvpa{}
// Default implements webhook.Defaulter so a webhook will be registered for the type
func (r *Hvpa) Default() {
hvpalog.Info("default", "name", r.Name)
// TODO(user): fill in your defaulting logic.
}
// +kubebuilder:webhook:path=/validate-autoscaling-k8s-io-v1alpha1-hvpa,mutating=false,failurePolicy=fail,groups=autoscaling.k8s.io,resources=hvpas,verbs=create;update,versions=v1alpha1,name=vhvpa.kb.io
var _ webhook.Validator = &Hvpa{}
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
func (r *Hvpa) ValidateCreate() error {
hvpalog.Info("validate create", "name", r.Name)
// TODO(user): fill in your validation logic upon object creation.
return nil
}
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
func (r *Hvpa) ValidateUpdate(old runtime.Object) error {
hvpalog.Info("validate update", "name", r.Name)
// TODO(user): fill in your validation logic upon object update.
return nil
}
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
func (r *Hvpa) ValidateDelete() error {
hvpalog.Info("validate delete", "name", r.Name)
// TODO(user): fill in your validation logic upon object update.
return nil
}

View File

@@ -0,0 +1,498 @@
// +build !ignore_autogenerated
/*
Copyright (c) 2019 SAP SE or an SAP affiliate company. All rights reserved.
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.
*/
// autogenerated by controller-gen object, do not modify manually
package v1alpha1
import (
"k8s.io/api/autoscaling/v2beta1"
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1beta2"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *BlockedScaling) DeepCopyInto(out *BlockedScaling) {
*out = *in
in.ScalingStatus.DeepCopyInto(&out.ScalingStatus)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new BlockedScaling.
func (in *BlockedScaling) DeepCopy() *BlockedScaling {
if in == nil {
return nil
}
out := new(BlockedScaling)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ChangeParams) DeepCopyInto(out *ChangeParams) {
*out = *in
if in.Value != nil {
in, out := &in.Value, &out.Value
*out = new(string)
**out = **in
}
if in.Percentage != nil {
in, out := &in.Percentage, &out.Percentage
*out = new(int32)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ChangeParams.
func (in *ChangeParams) DeepCopy() *ChangeParams {
if in == nil {
return nil
}
out := new(ChangeParams)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HpaSpec) DeepCopyInto(out *HpaSpec) {
*out = *in
if in.Selector != nil {
in, out := &in.Selector, &out.Selector
*out = new(v1.LabelSelector)
(*in).DeepCopyInto(*out)
}
in.ScaleUp.DeepCopyInto(&out.ScaleUp)
in.ScaleDown.DeepCopyInto(&out.ScaleDown)
in.Template.DeepCopyInto(&out.Template)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HpaSpec.
func (in *HpaSpec) DeepCopy() *HpaSpec {
if in == nil {
return nil
}
out := new(HpaSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HpaStatus) DeepCopyInto(out *HpaStatus) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HpaStatus.
func (in *HpaStatus) DeepCopy() *HpaStatus {
if in == nil {
return nil
}
out := new(HpaStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HpaTemplate) DeepCopyInto(out *HpaTemplate) {
*out = *in
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HpaTemplate.
func (in *HpaTemplate) DeepCopy() *HpaTemplate {
if in == nil {
return nil
}
out := new(HpaTemplate)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HpaTemplateSpec) DeepCopyInto(out *HpaTemplateSpec) {
*out = *in
if in.MinReplicas != nil {
in, out := &in.MinReplicas, &out.MinReplicas
*out = new(int32)
**out = **in
}
if in.Metrics != nil {
in, out := &in.Metrics, &out.Metrics
*out = make([]v2beta1.MetricSpec, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HpaTemplateSpec.
func (in *HpaTemplateSpec) DeepCopy() *HpaTemplateSpec {
if in == nil {
return nil
}
out := new(HpaTemplateSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Hvpa) DeepCopyInto(out *Hvpa) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Hvpa.
func (in *Hvpa) DeepCopy() *Hvpa {
if in == nil {
return nil
}
out := new(Hvpa)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *Hvpa) 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 *HvpaList) DeepCopyInto(out *HvpaList) {
*out = *in
out.TypeMeta = in.TypeMeta
out.ListMeta = in.ListMeta
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]Hvpa, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HvpaList.
func (in *HvpaList) DeepCopy() *HvpaList {
if in == nil {
return nil
}
out := new(HvpaList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *HvpaList) 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 *HvpaSpec) DeepCopyInto(out *HvpaSpec) {
*out = *in
if in.Replicas != nil {
in, out := &in.Replicas, &out.Replicas
*out = new(int32)
**out = **in
}
in.Hpa.DeepCopyInto(&out.Hpa)
in.Vpa.DeepCopyInto(&out.Vpa)
if in.WeightBasedScalingIntervals != nil {
in, out := &in.WeightBasedScalingIntervals, &out.WeightBasedScalingIntervals
*out = make([]WeightBasedScalingInterval, len(*in))
copy(*out, *in)
}
if in.TargetRef != nil {
in, out := &in.TargetRef, &out.TargetRef
*out = new(v2beta1.CrossVersionObjectReference)
**out = **in
}
if in.MaintenanceTimeWindow != nil {
in, out := &in.MaintenanceTimeWindow, &out.MaintenanceTimeWindow
*out = new(MaintenanceTimeWindow)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HvpaSpec.
func (in *HvpaSpec) DeepCopy() *HvpaSpec {
if in == nil {
return nil
}
out := new(HvpaSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *HvpaStatus) DeepCopyInto(out *HvpaStatus) {
*out = *in
if in.Replicas != nil {
in, out := &in.Replicas, &out.Replicas
*out = new(int32)
**out = **in
}
if in.TargetSelector != nil {
in, out := &in.TargetSelector, &out.TargetSelector
*out = new(string)
**out = **in
}
if in.HpaScaleUpUpdatePolicy != nil {
in, out := &in.HpaScaleUpUpdatePolicy, &out.HpaScaleUpUpdatePolicy
*out = new(UpdatePolicy)
(*in).DeepCopyInto(*out)
}
if in.HpaScaleDownUpdatePolicy != nil {
in, out := &in.HpaScaleDownUpdatePolicy, &out.HpaScaleDownUpdatePolicy
*out = new(UpdatePolicy)
(*in).DeepCopyInto(*out)
}
if in.VpaScaleUpUpdatePolicy != nil {
in, out := &in.VpaScaleUpUpdatePolicy, &out.VpaScaleUpUpdatePolicy
*out = new(UpdatePolicy)
(*in).DeepCopyInto(*out)
}
if in.VpaScaleDownUpdatePolicy != nil {
in, out := &in.VpaScaleDownUpdatePolicy, &out.VpaScaleDownUpdatePolicy
*out = new(UpdatePolicy)
(*in).DeepCopyInto(*out)
}
if in.LastBlockedScaling != nil {
in, out := &in.LastBlockedScaling, &out.LastBlockedScaling
*out = make([]*BlockedScaling, len(*in))
for i := range *in {
if (*in)[i] != nil {
in, out := &(*in)[i], &(*out)[i]
*out = new(BlockedScaling)
(*in).DeepCopyInto(*out)
}
}
}
in.LastScaling.DeepCopyInto(&out.LastScaling)
if in.LastError != nil {
in, out := &in.LastError, &out.LastError
*out = new(LastError)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HvpaStatus.
func (in *HvpaStatus) DeepCopy() *HvpaStatus {
if in == nil {
return nil
}
out := new(HvpaStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *LastError) DeepCopyInto(out *LastError) {
*out = *in
in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LastError.
func (in *LastError) DeepCopy() *LastError {
if in == nil {
return nil
}
out := new(LastError)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MaintenanceTimeWindow) DeepCopyInto(out *MaintenanceTimeWindow) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MaintenanceTimeWindow.
func (in *MaintenanceTimeWindow) DeepCopy() *MaintenanceTimeWindow {
if in == nil {
return nil
}
out := new(MaintenanceTimeWindow)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ScaleParams) DeepCopyInto(out *ScaleParams) {
*out = *in
in.CPU.DeepCopyInto(&out.CPU)
in.Memory.DeepCopyInto(&out.Memory)
in.Replicas.DeepCopyInto(&out.Replicas)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScaleParams.
func (in *ScaleParams) DeepCopy() *ScaleParams {
if in == nil {
return nil
}
out := new(ScaleParams)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ScaleType) DeepCopyInto(out *ScaleType) {
*out = *in
in.UpdatePolicy.DeepCopyInto(&out.UpdatePolicy)
in.MinChange.DeepCopyInto(&out.MinChange)
if in.StabilizationDuration != nil {
in, out := &in.StabilizationDuration, &out.StabilizationDuration
*out = new(string)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScaleType.
func (in *ScaleType) DeepCopy() *ScaleType {
if in == nil {
return nil
}
out := new(ScaleType)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ScalingStatus) DeepCopyInto(out *ScalingStatus) {
*out = *in
if in.LastScaleTime != nil {
in, out := &in.LastScaleTime, &out.LastScaleTime
*out = new(v1.Time)
(*in).DeepCopyInto(*out)
}
out.HpaStatus = in.HpaStatus
in.VpaStatus.DeepCopyInto(&out.VpaStatus)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScalingStatus.
func (in *ScalingStatus) DeepCopy() *ScalingStatus {
if in == nil {
return nil
}
out := new(ScalingStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *UpdatePolicy) DeepCopyInto(out *UpdatePolicy) {
*out = *in
if in.UpdateMode != nil {
in, out := &in.UpdateMode, &out.UpdateMode
*out = new(string)
**out = **in
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UpdatePolicy.
func (in *UpdatePolicy) DeepCopy() *UpdatePolicy {
if in == nil {
return nil
}
out := new(UpdatePolicy)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VpaSpec) DeepCopyInto(out *VpaSpec) {
*out = *in
if in.Selector != nil {
in, out := &in.Selector, &out.Selector
*out = new(v1.LabelSelector)
(*in).DeepCopyInto(*out)
}
in.ScaleUp.DeepCopyInto(&out.ScaleUp)
in.ScaleDown.DeepCopyInto(&out.ScaleDown)
in.Template.DeepCopyInto(&out.Template)
in.LimitsRequestsGapScaleParams.DeepCopyInto(&out.LimitsRequestsGapScaleParams)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VpaSpec.
func (in *VpaSpec) DeepCopy() *VpaSpec {
if in == nil {
return nil
}
out := new(VpaSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VpaTemplate) DeepCopyInto(out *VpaTemplate) {
*out = *in
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VpaTemplate.
func (in *VpaTemplate) DeepCopy() *VpaTemplate {
if in == nil {
return nil
}
out := new(VpaTemplate)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *VpaTemplateSpec) DeepCopyInto(out *VpaTemplateSpec) {
*out = *in
if in.ResourcePolicy != nil {
in, out := &in.ResourcePolicy, &out.ResourcePolicy
*out = new(v1beta2.PodResourcePolicy)
(*in).DeepCopyInto(*out)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VpaTemplateSpec.
func (in *VpaTemplateSpec) DeepCopy() *VpaTemplateSpec {
if in == nil {
return nil
}
out := new(VpaTemplateSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *WeightBasedScalingInterval) DeepCopyInto(out *WeightBasedScalingInterval) {
*out = *in
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WeightBasedScalingInterval.
func (in *WeightBasedScalingInterval) DeepCopy() *WeightBasedScalingInterval {
if in == nil {
return nil
}
out := new(WeightBasedScalingInterval)
in.DeepCopyInto(out)
return out
}