diff --git a/vertical-pod-autoscaler/deploy/vpa-v1-crd.yaml b/vertical-pod-autoscaler/deploy/vpa-v1-crd.yaml new file mode 100644 index 00000000000..c649b880666 --- /dev/null +++ b/vertical-pod-autoscaler/deploy/vpa-v1-crd.yaml @@ -0,0 +1,67 @@ +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: verticalpodautoscalers.autoscaling.k8s.io +spec: + group: autoscaling.k8s.io + scope: Namespaced + names: + plural: verticalpodautoscalers + singular: verticalpodautoscaler + kind: VerticalPodAutoscaler + shortNames: + - vpa + version: v1beta1 + versions: + - name: v1beta1 + served: false + storage: false + - name: v1beta2 + served: true + storage: true + - name: v1 + served: true + storage: false + validation: + # openAPIV3Schema is the schema for validating custom objects. + openAPIV3Schema: + properties: + spec: + required: [] + properties: + targetRef: + type: object + updatePolicy: + properties: + updateMode: + type: string + resourcePolicy: + properties: + containerPolicies: + type: array +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: verticalpodautoscalercheckpoints.autoscaling.k8s.io +spec: + group: autoscaling.k8s.io + scope: Namespaced + names: + plural: verticalpodautoscalercheckpoints + singular: verticalpodautoscalercheckpoint + kind: VerticalPodAutoscalerCheckpoint + shortNames: + - vpacheckpoint + version: v1beta1 + versions: + - name: v1beta1 + served: false + storage: false + - name: v1beta2 + served: true + storage: true + - name: v1 + served: true + storage: false diff --git a/vertical-pod-autoscaler/hack/update-codegen.sh b/vertical-pod-autoscaler/hack/update-codegen.sh index be7906e4fc9..80b9012a3eb 100755 --- a/vertical-pod-autoscaler/hack/update-codegen.sh +++ b/vertical-pod-autoscaler/hack/update-codegen.sh @@ -27,7 +27,7 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${SCRIPT_ROOT}; ls -d -1 ./vendor/k8s.io/code-ge # instead of the $GOPATH directly. For normal projects this can be dropped. ${CODEGEN_PKG}/generate-groups.sh all \ k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis \ - "autoscaling.k8s.io:v1beta2 autoscaling.k8s.io:v1beta1 poc.autoscaling.k8s.io:v1alpha1" \ + "autoscaling.k8s.io:v1 autoscaling.k8s.io:v1beta2 autoscaling.k8s.io:v1beta1 poc.autoscaling.k8s.io:v1alpha1" \ --output-base "$(dirname ${BASH_SOURCE})/../../../.." # To use your own boilerplate text append: diff --git a/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/doc.go b/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/doc.go new file mode 100644 index 00000000000..ecc8f33d1bd --- /dev/null +++ b/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/doc.go @@ -0,0 +1,21 @@ +/* +Copyright 2019 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. +*/ + +// +k8s:deepcopy-gen=package,register + +// Package v1 contains definitions of Vertical Pod Autoscaler related objects. +// +groupName=autoscaling.k8s.io +package v1 diff --git a/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/register.go b/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/register.go new file mode 100644 index 00000000000..70214933be0 --- /dev/null +++ b/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/register.go @@ -0,0 +1,58 @@ +/* +Copyright 2019 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 v1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +// SchemeGroupVersion is group version used to register these objects +var SchemeGroupVersion = schema.GroupVersion{Group: "autoscaling.k8s.io", Version: "v1"} + +// Resource takes an unqualified resource and returns a Group qualified GroupResource +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +var ( + // SchemeBuilder points to a list of functions added to Scheme. + SchemeBuilder runtime.SchemeBuilder + localSchemeBuilder = &SchemeBuilder + // AddToScheme applies all the stored functions to the scheme. + AddToScheme = localSchemeBuilder.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(SchemeGroupVersion, + &VerticalPodAutoscaler{}, + &VerticalPodAutoscalerList{}, + &VerticalPodAutoscalerCheckpoint{}, + &VerticalPodAutoscalerCheckpointList{}, + ) + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.go b/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.go new file mode 100644 index 00000000000..f2be65511b8 --- /dev/null +++ b/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/types.go @@ -0,0 +1,339 @@ +/* +Copyright 2019 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 v1 contains definitions of Vertical Pod Autoscaler related objects. +package v1 + +import ( + autoscaling "k8s.io/api/autoscaling/v1" + v1 "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +// +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 { + + // TargetRef points to the controller managing the set of pods for the + // autoscaler to control - e.g. Deployment, StatefulSet. VerticalPodAutoscaler + // can be targeted at controller implementing scale subresource (the pod set is + // retrieved from the controller's ScaleStatus) or some well known controllers + // (e.g. for DaemonSet the pod set is read from the controller's spec). + // If VerticalPodAutoscaler cannot use specified target it will report + // ConfigUnsupported condition. + // Note that VerticalPodAutoscaler does not require full implementation + // of scale subresource - it will not use it to modify the replica count. + // The only thing retrieved is a label selector matching pods grouped by + // the target resource. + TargetRef *autoscaling.CrossVersionObjectReference `json:"targetRef" protobuf:"bytes,1,name=targetRef"` + + // 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. Observes ContainerResourcePolicy. + Target v1.ResourceList `json:"target" protobuf:"bytes,2,rep,name=target,casttype=ResourceList,castkey=ResourceName"` + // Minimum recommended amount of resources. Observes ContainerResourcePolicy. + // 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. Observes ContainerResourcePolicy. + // 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"` + // The most recent recommended resources target computed by the autoscaler + // for the controlled pods, based only on actual resource usage, not taking + // into account the ContainerResourcePolicy. + // May differ from the Recommendation if the actual resource usage causes + // the target to violate the ContainerResourcePolicy (lower than MinAllowed + // or higher that MaxAllowed). + // Used only as status indication, will not affect actual resource assignment. + // +optional + UncappedTarget v1.ResourceList `json:"uncappedTarget,omitempty" protobuf:"bytes,5,opt,name=uncappedTarget"` +} + +// 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" + // LowConfidence indicates whether the VPA recommender has low confidence in the recommendation for + // some of containers. + LowConfidence VerticalPodAutoscalerConditionType = "LowConfidence" + // NoPodsMatched indicates that label selector used with VPA object didn't match any pods. + NoPodsMatched VerticalPodAutoscalerConditionType = "NoPodsMatched" + // FetchingHistory indicates that VPA recommender is in the process of loading additional history samples. + FetchingHistory VerticalPodAutoscalerConditionType = "FetchingHistory" + // ConfigDeprecated indicates that this VPA configuration is deprecated + // and will stop being supported soon. + ConfigDeprecated VerticalPodAutoscalerConditionType = "ConfigDeprecated" + // ConfigUnsupported indicates that this VPA configuration is unsupported + // and recommendations will not be provided for it. + ConfigUnsupported VerticalPodAutoscalerConditionType = "ConfigUnsupported" +) + +// 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"` +} + +// +genclient +// +genclient:noStatus +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// VerticalPodAutoscalerCheckpoint is the checkpoint of the internal state of VPA that +// is used for recovery after recommender's restart. +type VerticalPodAutoscalerCheckpoint 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 checkpoint. + // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status. + // +optional + Spec VerticalPodAutoscalerCheckpointSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + + // Data of the checkpoint. + // +optional + Status VerticalPodAutoscalerCheckpointStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// VerticalPodAutoscalerCheckpointList is a list of VerticalPodAutoscalerCheckpoint objects. +type VerticalPodAutoscalerCheckpointList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata"` + Items []VerticalPodAutoscalerCheckpoint `json:"items"` +} + +// VerticalPodAutoscalerCheckpointSpec is the specification of the checkpoint object. +type VerticalPodAutoscalerCheckpointSpec struct { + // Name of the VPA object that stored VerticalPodAutoscalerCheckpoint object. + VPAObjectName string `json:"vpaObjectName,omitempty" protobuf:"bytes,1,opt,name=vpaObjectName"` + + // Name of the checkpointed container. + ContainerName string `json:"containerName,omitempty" protobuf:"bytes,2,opt,name=containerName"` +} + +// VerticalPodAutoscalerCheckpointStatus contains data of the checkpoint. +type VerticalPodAutoscalerCheckpointStatus struct { + // The time when the status was last refreshed. + LastUpdateTime metav1.Time `json:"lastUpdateTime,omitempty" protobuf:"bytes,1,opt,name=lastUpdateTime"` + + // Version of the format of the stored data. + Version string `json:"version,omitempty" protobuf:"bytes,2,opt,name=version"` + + // Checkpoint of histogram for consumption of CPU. + CPUHistogram HistogramCheckpoint `json:"cpuHistogram,omitempty" protobuf:"bytes,3,rep,name=cpuHistograms"` + + // Checkpoint of histogram for consumption of memory. + MemoryHistogram HistogramCheckpoint `json:"memoryHistogram,omitempty" protobuf:"bytes,4,rep,name=memoryHistogram"` + + // Timestamp of the fist sample from the histograms. + FirstSampleStart metav1.Time `json:"firstSampleStart,omitempty" protobuf:"bytes,5,opt,name=firstSampleStart"` + + // Timestamp of the last sample from the histograms. + LastSampleStart metav1.Time `json:"lastSampleStart,omitempty" protobuf:"bytes,6,opt,name=lastSampleStart"` + + // Total number of samples in the histograms. + TotalSamplesCount int `json:"totalSamplesCount,omitempty" protobuf:"bytes,7,opt,name=totalSamplesCount"` +} + +// HistogramCheckpoint contains data needed to reconstruct the histogram. +type HistogramCheckpoint struct { + // Reference timestamp for samples collected within this histogram. + ReferenceTimestamp metav1.Time `json:"referenceTimestamp,omitempty" protobuf:"bytes,1,opt,name=referenceTimestamp"` + + // Map from bucket index to bucket weight. + BucketWeights map[int]uint32 `json:"bucketWeights,omitempty" protobuf:"bytes,2,opt,name=bucketWeights"` + + // Sum of samples to be used as denominator for weights from BucketWeights. + TotalWeight float64 `json:"totalWeight,omitempty" protobuf:"bytes,3,opt,name=totalWeight"` +} diff --git a/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/zz_generated.deepcopy.go b/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/zz_generated.deepcopy.go new file mode 100644 index 00000000000..b7baaf21e90 --- /dev/null +++ b/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1/zz_generated.deepcopy.go @@ -0,0 +1,432 @@ +// +build !ignore_autogenerated + +/* +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 deepcopy-gen. DO NOT EDIT. + +package v1 + +import ( + autoscalingv1 "k8s.io/api/autoscaling/v1" + corev1 "k8s.io/api/core/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 + *out = new(ContainerScalingMode) + **out = **in + } + if in.MinAllowed != nil { + in, out := &in.MinAllowed, &out.MinAllowed + *out = make(corev1.ResourceList, len(*in)) + for key, val := range *in { + (*out)[key] = val.DeepCopy() + } + } + if in.MaxAllowed != nil { + in, out := &in.MaxAllowed, &out.MaxAllowed + *out = make(corev1.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 *HistogramCheckpoint) DeepCopyInto(out *HistogramCheckpoint) { + *out = *in + in.ReferenceTimestamp.DeepCopyInto(&out.ReferenceTimestamp) + if in.BucketWeights != nil { + in, out := &in.BucketWeights, &out.BucketWeights + *out = make(map[int]uint32, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HistogramCheckpoint. +func (in *HistogramCheckpoint) DeepCopy() *HistogramCheckpoint { + if in == nil { + return nil + } + out := new(HistogramCheckpoint) + in.DeepCopyInto(out) + 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 + *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 *RecommendedContainerResources) DeepCopyInto(out *RecommendedContainerResources) { + *out = *in + if in.Target != nil { + in, out := &in.Target, &out.Target + *out = make(corev1.ResourceList, len(*in)) + for key, val := range *in { + (*out)[key] = val.DeepCopy() + } + } + if in.LowerBound != nil { + in, out := &in.LowerBound, &out.LowerBound + *out = make(corev1.ResourceList, len(*in)) + for key, val := range *in { + (*out)[key] = val.DeepCopy() + } + } + if in.UpperBound != nil { + in, out := &in.UpperBound, &out.UpperBound + *out = make(corev1.ResourceList, len(*in)) + for key, val := range *in { + (*out)[key] = val.DeepCopy() + } + } + if in.UncappedTarget != nil { + in, out := &in.UncappedTarget, &out.UncappedTarget + *out = make(corev1.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 *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 *VerticalPodAutoscalerCheckpoint) DeepCopyInto(out *VerticalPodAutoscalerCheckpoint) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + out.Spec = in.Spec + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VerticalPodAutoscalerCheckpoint. +func (in *VerticalPodAutoscalerCheckpoint) DeepCopy() *VerticalPodAutoscalerCheckpoint { + if in == nil { + return nil + } + out := new(VerticalPodAutoscalerCheckpoint) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VerticalPodAutoscalerCheckpoint) 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 *VerticalPodAutoscalerCheckpointList) DeepCopyInto(out *VerticalPodAutoscalerCheckpointList) { + *out = *in + out.TypeMeta = in.TypeMeta + out.ListMeta = in.ListMeta + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]VerticalPodAutoscalerCheckpoint, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VerticalPodAutoscalerCheckpointList. +func (in *VerticalPodAutoscalerCheckpointList) DeepCopy() *VerticalPodAutoscalerCheckpointList { + if in == nil { + return nil + } + out := new(VerticalPodAutoscalerCheckpointList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VerticalPodAutoscalerCheckpointList) 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 *VerticalPodAutoscalerCheckpointSpec) DeepCopyInto(out *VerticalPodAutoscalerCheckpointSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VerticalPodAutoscalerCheckpointSpec. +func (in *VerticalPodAutoscalerCheckpointSpec) DeepCopy() *VerticalPodAutoscalerCheckpointSpec { + if in == nil { + return nil + } + out := new(VerticalPodAutoscalerCheckpointSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VerticalPodAutoscalerCheckpointStatus) DeepCopyInto(out *VerticalPodAutoscalerCheckpointStatus) { + *out = *in + in.LastUpdateTime.DeepCopyInto(&out.LastUpdateTime) + in.CPUHistogram.DeepCopyInto(&out.CPUHistogram) + in.MemoryHistogram.DeepCopyInto(&out.MemoryHistogram) + in.FirstSampleStart.DeepCopyInto(&out.FirstSampleStart) + in.LastSampleStart.DeepCopyInto(&out.LastSampleStart) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VerticalPodAutoscalerCheckpointStatus. +func (in *VerticalPodAutoscalerCheckpointStatus) DeepCopy() *VerticalPodAutoscalerCheckpointStatus { + if in == nil { + return nil + } + out := new(VerticalPodAutoscalerCheckpointStatus) + in.DeepCopyInto(out) + return out +} + +// 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.TargetRef != nil { + in, out := &in.TargetRef, &out.TargetRef + *out = new(autoscalingv1.CrossVersionObjectReference) + **out = **in + } + if in.UpdatePolicy != nil { + in, out := &in.UpdatePolicy, &out.UpdatePolicy + *out = new(PodUpdatePolicy) + (*in).DeepCopyInto(*out) + } + if in.ResourcePolicy != nil { + in, out := &in.ResourcePolicy, &out.ResourcePolicy + *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 + *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 +} diff --git a/vertical-pod-autoscaler/pkg/client/clientset/versioned/clientset.go b/vertical-pod-autoscaler/pkg/client/clientset/versioned/clientset.go index 015a022f925..5d0f262fa36 100644 --- a/vertical-pod-autoscaler/pkg/client/clientset/versioned/clientset.go +++ b/vertical-pod-autoscaler/pkg/client/clientset/versioned/clientset.go @@ -19,6 +19,7 @@ limitations under the License. package versioned import ( + autoscalingv1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1" autoscalingv1beta1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1beta1" autoscalingv1beta2 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1beta2" pocv1alpha1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/poc.autoscaling.k8s.io/v1alpha1" @@ -29,6 +30,7 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface + AutoscalingV1() autoscalingv1.AutoscalingV1Interface AutoscalingV1beta2() autoscalingv1beta2.AutoscalingV1beta2Interface AutoscalingV1beta1() autoscalingv1beta1.AutoscalingV1beta1Interface PocV1alpha1() pocv1alpha1.PocV1alpha1Interface @@ -38,11 +40,17 @@ type Interface interface { // version included in a Clientset. type Clientset struct { *discovery.DiscoveryClient + autoscalingV1 *autoscalingv1.AutoscalingV1Client autoscalingV1beta2 *autoscalingv1beta2.AutoscalingV1beta2Client autoscalingV1beta1 *autoscalingv1beta1.AutoscalingV1beta1Client pocV1alpha1 *pocv1alpha1.PocV1alpha1Client } +// AutoscalingV1 retrieves the AutoscalingV1Client +func (c *Clientset) AutoscalingV1() autoscalingv1.AutoscalingV1Interface { + return c.autoscalingV1 +} + // AutoscalingV1beta2 retrieves the AutoscalingV1beta2Client func (c *Clientset) AutoscalingV1beta2() autoscalingv1beta2.AutoscalingV1beta2Interface { return c.autoscalingV1beta2 @@ -74,6 +82,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { } var cs Clientset var err error + cs.autoscalingV1, err = autoscalingv1.NewForConfig(&configShallowCopy) + if err != nil { + return nil, err + } cs.autoscalingV1beta2, err = autoscalingv1beta2.NewForConfig(&configShallowCopy) if err != nil { return nil, err @@ -98,6 +110,7 @@ func NewForConfig(c *rest.Config) (*Clientset, error) { // panics if there is an error in the config. func NewForConfigOrDie(c *rest.Config) *Clientset { var cs Clientset + cs.autoscalingV1 = autoscalingv1.NewForConfigOrDie(c) cs.autoscalingV1beta2 = autoscalingv1beta2.NewForConfigOrDie(c) cs.autoscalingV1beta1 = autoscalingv1beta1.NewForConfigOrDie(c) cs.pocV1alpha1 = pocv1alpha1.NewForConfigOrDie(c) @@ -109,6 +122,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset { // New creates a new Clientset for the given RESTClient. func New(c rest.Interface) *Clientset { var cs Clientset + cs.autoscalingV1 = autoscalingv1.New(c) cs.autoscalingV1beta2 = autoscalingv1beta2.New(c) cs.autoscalingV1beta1 = autoscalingv1beta1.New(c) cs.pocV1alpha1 = pocv1alpha1.New(c) diff --git a/vertical-pod-autoscaler/pkg/client/clientset/versioned/fake/clientset_generated.go b/vertical-pod-autoscaler/pkg/client/clientset/versioned/fake/clientset_generated.go index 9be40d65fd0..d7fce65abd4 100644 --- a/vertical-pod-autoscaler/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/vertical-pod-autoscaler/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -22,6 +22,8 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/watch" clientset "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/clientset/versioned" + autoscalingv1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1" + fakeautoscalingv1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1/fake" autoscalingv1beta1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1beta1" fakeautoscalingv1beta1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1beta1/fake" autoscalingv1beta2 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1beta2" @@ -75,6 +77,11 @@ func (c *Clientset) Discovery() discovery.DiscoveryInterface { var _ clientset.Interface = &Clientset{} +// AutoscalingV1 retrieves the AutoscalingV1Client +func (c *Clientset) AutoscalingV1() autoscalingv1.AutoscalingV1Interface { + return &fakeautoscalingv1.FakeAutoscalingV1{Fake: &c.Fake} +} + // AutoscalingV1beta2 retrieves the AutoscalingV1beta2Client func (c *Clientset) AutoscalingV1beta2() autoscalingv1beta2.AutoscalingV1beta2Interface { return &fakeautoscalingv1beta2.FakeAutoscalingV1beta2{Fake: &c.Fake} diff --git a/vertical-pod-autoscaler/pkg/client/clientset/versioned/fake/register.go b/vertical-pod-autoscaler/pkg/client/clientset/versioned/fake/register.go index 54927e518db..6118b0b996e 100644 --- a/vertical-pod-autoscaler/pkg/client/clientset/versioned/fake/register.go +++ b/vertical-pod-autoscaler/pkg/client/clientset/versioned/fake/register.go @@ -24,6 +24,7 @@ import ( schema "k8s.io/apimachinery/pkg/runtime/schema" serializer "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" + autoscalingv1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1" autoscalingv1beta1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1beta1" autoscalingv1beta2 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1beta2" pocv1alpha1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/poc.autoscaling.k8s.io/v1alpha1" @@ -33,6 +34,7 @@ var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) var parameterCodec = runtime.NewParameterCodec(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ + autoscalingv1.AddToScheme, autoscalingv1beta2.AddToScheme, autoscalingv1beta1.AddToScheme, pocv1alpha1.AddToScheme, diff --git a/vertical-pod-autoscaler/pkg/client/clientset/versioned/scheme/register.go b/vertical-pod-autoscaler/pkg/client/clientset/versioned/scheme/register.go index bfaaf70df8f..b41afb4c9cf 100644 --- a/vertical-pod-autoscaler/pkg/client/clientset/versioned/scheme/register.go +++ b/vertical-pod-autoscaler/pkg/client/clientset/versioned/scheme/register.go @@ -24,6 +24,7 @@ import ( schema "k8s.io/apimachinery/pkg/runtime/schema" serializer "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" + autoscalingv1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1" autoscalingv1beta1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1beta1" autoscalingv1beta2 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1beta2" pocv1alpha1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/poc.autoscaling.k8s.io/v1alpha1" @@ -33,6 +34,7 @@ var Scheme = runtime.NewScheme() var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ + autoscalingv1.AddToScheme, autoscalingv1beta2.AddToScheme, autoscalingv1beta1.AddToScheme, pocv1alpha1.AddToScheme, diff --git a/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1/autoscaling.k8s.io_client.go b/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1/autoscaling.k8s.io_client.go new file mode 100644 index 00000000000..05789c4b743 --- /dev/null +++ b/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1/autoscaling.k8s.io_client.go @@ -0,0 +1,95 @@ +/* +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 v1 + +import ( + serializer "k8s.io/apimachinery/pkg/runtime/serializer" + v1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1" + "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +type AutoscalingV1Interface interface { + RESTClient() rest.Interface + VerticalPodAutoscalersGetter + VerticalPodAutoscalerCheckpointsGetter +} + +// AutoscalingV1Client is used to interact with features provided by the autoscaling.k8s.io group. +type AutoscalingV1Client struct { + restClient rest.Interface +} + +func (c *AutoscalingV1Client) VerticalPodAutoscalers(namespace string) VerticalPodAutoscalerInterface { + return newVerticalPodAutoscalers(c, namespace) +} + +func (c *AutoscalingV1Client) VerticalPodAutoscalerCheckpoints(namespace string) VerticalPodAutoscalerCheckpointInterface { + return newVerticalPodAutoscalerCheckpoints(c, namespace) +} + +// NewForConfig creates a new AutoscalingV1Client for the given config. +func NewForConfig(c *rest.Config) (*AutoscalingV1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientFor(&config) + if err != nil { + return nil, err + } + return &AutoscalingV1Client{client}, nil +} + +// NewForConfigOrDie creates a new AutoscalingV1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *AutoscalingV1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new AutoscalingV1Client for the given RESTClient. +func New(c rest.Interface) *AutoscalingV1Client { + return &AutoscalingV1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = serializer.DirectCodecFactory{CodecFactory: scheme.Codecs} + + if config.UserAgent == "" { + config.UserAgent = rest.DefaultKubernetesUserAgent() + } + + return nil +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *AutoscalingV1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1/doc.go b/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1/doc.go new file mode 100644 index 00000000000..3af5d054f10 --- /dev/null +++ b/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1/doc.go @@ -0,0 +1,20 @@ +/* +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. + +// This package has the automatically generated typed clients. +package v1 diff --git a/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1/fake/doc.go b/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1/fake/doc.go new file mode 100644 index 00000000000..16f44399065 --- /dev/null +++ b/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1/fake/doc.go @@ -0,0 +1,20 @@ +/* +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 has the automatically generated clients. +package fake diff --git a/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1/fake/fake_autoscaling.k8s.io_client.go b/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1/fake/fake_autoscaling.k8s.io_client.go new file mode 100644 index 00000000000..0ac93be9ed1 --- /dev/null +++ b/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1/fake/fake_autoscaling.k8s.io_client.go @@ -0,0 +1,44 @@ +/* +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/autoscaler/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1" + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" +) + +type FakeAutoscalingV1 struct { + *testing.Fake +} + +func (c *FakeAutoscalingV1) VerticalPodAutoscalers(namespace string) v1.VerticalPodAutoscalerInterface { + return &FakeVerticalPodAutoscalers{c, namespace} +} + +func (c *FakeAutoscalingV1) VerticalPodAutoscalerCheckpoints(namespace string) v1.VerticalPodAutoscalerCheckpointInterface { + return &FakeVerticalPodAutoscalerCheckpoints{c, namespace} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeAutoscalingV1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1/fake/fake_verticalpodautoscaler.go b/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1/fake/fake_verticalpodautoscaler.go new file mode 100644 index 00000000000..8beb3d602bf --- /dev/null +++ b/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1/fake/fake_verticalpodautoscaler.go @@ -0,0 +1,140 @@ +/* +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" + autoscalingk8siov1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1" + testing "k8s.io/client-go/testing" +) + +// FakeVerticalPodAutoscalers implements VerticalPodAutoscalerInterface +type FakeVerticalPodAutoscalers struct { + Fake *FakeAutoscalingV1 + ns string +} + +var verticalpodautoscalersResource = schema.GroupVersionResource{Group: "autoscaling.k8s.io", Version: "v1", Resource: "verticalpodautoscalers"} + +var verticalpodautoscalersKind = schema.GroupVersionKind{Group: "autoscaling.k8s.io", Version: "v1", 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 *autoscalingk8siov1.VerticalPodAutoscaler, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(verticalpodautoscalersResource, c.ns, name), &autoscalingk8siov1.VerticalPodAutoscaler{}) + + if obj == nil { + return nil, err + } + return obj.(*autoscalingk8siov1.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 *autoscalingk8siov1.VerticalPodAutoscalerList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(verticalpodautoscalersResource, verticalpodautoscalersKind, c.ns, opts), &autoscalingk8siov1.VerticalPodAutoscalerList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &autoscalingk8siov1.VerticalPodAutoscalerList{ListMeta: obj.(*autoscalingk8siov1.VerticalPodAutoscalerList).ListMeta} + for _, item := range obj.(*autoscalingk8siov1.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 *autoscalingk8siov1.VerticalPodAutoscaler) (result *autoscalingk8siov1.VerticalPodAutoscaler, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(verticalpodautoscalersResource, c.ns, verticalPodAutoscaler), &autoscalingk8siov1.VerticalPodAutoscaler{}) + + if obj == nil { + return nil, err + } + return obj.(*autoscalingk8siov1.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 *autoscalingk8siov1.VerticalPodAutoscaler) (result *autoscalingk8siov1.VerticalPodAutoscaler, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(verticalpodautoscalersResource, c.ns, verticalPodAutoscaler), &autoscalingk8siov1.VerticalPodAutoscaler{}) + + if obj == nil { + return nil, err + } + return obj.(*autoscalingk8siov1.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 *autoscalingk8siov1.VerticalPodAutoscaler) (*autoscalingk8siov1.VerticalPodAutoscaler, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(verticalpodautoscalersResource, "status", c.ns, verticalPodAutoscaler), &autoscalingk8siov1.VerticalPodAutoscaler{}) + + if obj == nil { + return nil, err + } + return obj.(*autoscalingk8siov1.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), &autoscalingk8siov1.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, &autoscalingk8siov1.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 *autoscalingk8siov1.VerticalPodAutoscaler, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(verticalpodautoscalersResource, c.ns, name, pt, data, subresources...), &autoscalingk8siov1.VerticalPodAutoscaler{}) + + if obj == nil { + return nil, err + } + return obj.(*autoscalingk8siov1.VerticalPodAutoscaler), err +} diff --git a/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1/fake/fake_verticalpodautoscalercheckpoint.go b/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1/fake/fake_verticalpodautoscalercheckpoint.go new file mode 100644 index 00000000000..ef3e671fc0d --- /dev/null +++ b/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1/fake/fake_verticalpodautoscalercheckpoint.go @@ -0,0 +1,128 @@ +/* +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" + autoscalingk8siov1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1" + testing "k8s.io/client-go/testing" +) + +// FakeVerticalPodAutoscalerCheckpoints implements VerticalPodAutoscalerCheckpointInterface +type FakeVerticalPodAutoscalerCheckpoints struct { + Fake *FakeAutoscalingV1 + ns string +} + +var verticalpodautoscalercheckpointsResource = schema.GroupVersionResource{Group: "autoscaling.k8s.io", Version: "v1", Resource: "verticalpodautoscalercheckpoints"} + +var verticalpodautoscalercheckpointsKind = schema.GroupVersionKind{Group: "autoscaling.k8s.io", Version: "v1", Kind: "VerticalPodAutoscalerCheckpoint"} + +// Get takes name of the verticalPodAutoscalerCheckpoint, and returns the corresponding verticalPodAutoscalerCheckpoint object, and an error if there is any. +func (c *FakeVerticalPodAutoscalerCheckpoints) Get(name string, options v1.GetOptions) (result *autoscalingk8siov1.VerticalPodAutoscalerCheckpoint, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(verticalpodautoscalercheckpointsResource, c.ns, name), &autoscalingk8siov1.VerticalPodAutoscalerCheckpoint{}) + + if obj == nil { + return nil, err + } + return obj.(*autoscalingk8siov1.VerticalPodAutoscalerCheckpoint), err +} + +// List takes label and field selectors, and returns the list of VerticalPodAutoscalerCheckpoints that match those selectors. +func (c *FakeVerticalPodAutoscalerCheckpoints) List(opts v1.ListOptions) (result *autoscalingk8siov1.VerticalPodAutoscalerCheckpointList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(verticalpodautoscalercheckpointsResource, verticalpodautoscalercheckpointsKind, c.ns, opts), &autoscalingk8siov1.VerticalPodAutoscalerCheckpointList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &autoscalingk8siov1.VerticalPodAutoscalerCheckpointList{ListMeta: obj.(*autoscalingk8siov1.VerticalPodAutoscalerCheckpointList).ListMeta} + for _, item := range obj.(*autoscalingk8siov1.VerticalPodAutoscalerCheckpointList).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 verticalPodAutoscalerCheckpoints. +func (c *FakeVerticalPodAutoscalerCheckpoints) Watch(opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(verticalpodautoscalercheckpointsResource, c.ns, opts)) + +} + +// Create takes the representation of a verticalPodAutoscalerCheckpoint and creates it. Returns the server's representation of the verticalPodAutoscalerCheckpoint, and an error, if there is any. +func (c *FakeVerticalPodAutoscalerCheckpoints) Create(verticalPodAutoscalerCheckpoint *autoscalingk8siov1.VerticalPodAutoscalerCheckpoint) (result *autoscalingk8siov1.VerticalPodAutoscalerCheckpoint, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(verticalpodautoscalercheckpointsResource, c.ns, verticalPodAutoscalerCheckpoint), &autoscalingk8siov1.VerticalPodAutoscalerCheckpoint{}) + + if obj == nil { + return nil, err + } + return obj.(*autoscalingk8siov1.VerticalPodAutoscalerCheckpoint), err +} + +// Update takes the representation of a verticalPodAutoscalerCheckpoint and updates it. Returns the server's representation of the verticalPodAutoscalerCheckpoint, and an error, if there is any. +func (c *FakeVerticalPodAutoscalerCheckpoints) Update(verticalPodAutoscalerCheckpoint *autoscalingk8siov1.VerticalPodAutoscalerCheckpoint) (result *autoscalingk8siov1.VerticalPodAutoscalerCheckpoint, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(verticalpodautoscalercheckpointsResource, c.ns, verticalPodAutoscalerCheckpoint), &autoscalingk8siov1.VerticalPodAutoscalerCheckpoint{}) + + if obj == nil { + return nil, err + } + return obj.(*autoscalingk8siov1.VerticalPodAutoscalerCheckpoint), err +} + +// Delete takes name of the verticalPodAutoscalerCheckpoint and deletes it. Returns an error if one occurs. +func (c *FakeVerticalPodAutoscalerCheckpoints) Delete(name string, options *v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteAction(verticalpodautoscalercheckpointsResource, c.ns, name), &autoscalingk8siov1.VerticalPodAutoscalerCheckpoint{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeVerticalPodAutoscalerCheckpoints) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(verticalpodautoscalercheckpointsResource, c.ns, listOptions) + + _, err := c.Fake.Invokes(action, &autoscalingk8siov1.VerticalPodAutoscalerCheckpointList{}) + return err +} + +// Patch applies the patch and returns the patched verticalPodAutoscalerCheckpoint. +func (c *FakeVerticalPodAutoscalerCheckpoints) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *autoscalingk8siov1.VerticalPodAutoscalerCheckpoint, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(verticalpodautoscalercheckpointsResource, c.ns, name, pt, data, subresources...), &autoscalingk8siov1.VerticalPodAutoscalerCheckpoint{}) + + if obj == nil { + return nil, err + } + return obj.(*autoscalingk8siov1.VerticalPodAutoscalerCheckpoint), err +} diff --git a/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1/generated_expansion.go b/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1/generated_expansion.go new file mode 100644 index 00000000000..b1f2b224d7e --- /dev/null +++ b/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1/generated_expansion.go @@ -0,0 +1,23 @@ +/* +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 v1 + +type VerticalPodAutoscalerExpansion interface{} + +type VerticalPodAutoscalerCheckpointExpansion interface{} diff --git a/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1/verticalpodautoscaler.go b/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1/verticalpodautoscaler.go new file mode 100644 index 00000000000..09a6642584b --- /dev/null +++ b/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1/verticalpodautoscaler.go @@ -0,0 +1,191 @@ +/* +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 v1 + +import ( + "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + v1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1" + scheme "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/clientset/versioned/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(*v1.VerticalPodAutoscaler) (*v1.VerticalPodAutoscaler, error) + Update(*v1.VerticalPodAutoscaler) (*v1.VerticalPodAutoscaler, error) + UpdateStatus(*v1.VerticalPodAutoscaler) (*v1.VerticalPodAutoscaler, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error + Get(name string, options metav1.GetOptions) (*v1.VerticalPodAutoscaler, error) + List(opts metav1.ListOptions) (*v1.VerticalPodAutoscalerList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.VerticalPodAutoscaler, err error) + VerticalPodAutoscalerExpansion +} + +// verticalPodAutoscalers implements VerticalPodAutoscalerInterface +type verticalPodAutoscalers struct { + client rest.Interface + ns string +} + +// newVerticalPodAutoscalers returns a VerticalPodAutoscalers +func newVerticalPodAutoscalers(c *AutoscalingV1Client, 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 metav1.GetOptions) (result *v1.VerticalPodAutoscaler, err error) { + result = &v1.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 metav1.ListOptions) (result *v1.VerticalPodAutoscalerList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.VerticalPodAutoscalerList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("verticalpodautoscalers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested verticalPodAutoscalers. +func (c *verticalPodAutoscalers) Watch(opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("verticalpodautoscalers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + 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 *v1.VerticalPodAutoscaler) (result *v1.VerticalPodAutoscaler, err error) { + result = &v1.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 *v1.VerticalPodAutoscaler) (result *v1.VerticalPodAutoscaler, err error) { + result = &v1.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 *v1.VerticalPodAutoscaler) (result *v1.VerticalPodAutoscaler, err error) { + result = &v1.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 *metav1.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 *metav1.DeleteOptions, listOptions metav1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("verticalpodautoscalers"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + 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 *v1.VerticalPodAutoscaler, err error) { + result = &v1.VerticalPodAutoscaler{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("verticalpodautoscalers"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1/verticalpodautoscalercheckpoint.go b/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1/verticalpodautoscalercheckpoint.go new file mode 100644 index 00000000000..09d2023751c --- /dev/null +++ b/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/autoscaling.k8s.io/v1/verticalpodautoscalercheckpoint.go @@ -0,0 +1,174 @@ +/* +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 v1 + +import ( + "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + v1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1" + scheme "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/clientset/versioned/scheme" + rest "k8s.io/client-go/rest" +) + +// VerticalPodAutoscalerCheckpointsGetter has a method to return a VerticalPodAutoscalerCheckpointInterface. +// A group's client should implement this interface. +type VerticalPodAutoscalerCheckpointsGetter interface { + VerticalPodAutoscalerCheckpoints(namespace string) VerticalPodAutoscalerCheckpointInterface +} + +// VerticalPodAutoscalerCheckpointInterface has methods to work with VerticalPodAutoscalerCheckpoint resources. +type VerticalPodAutoscalerCheckpointInterface interface { + Create(*v1.VerticalPodAutoscalerCheckpoint) (*v1.VerticalPodAutoscalerCheckpoint, error) + Update(*v1.VerticalPodAutoscalerCheckpoint) (*v1.VerticalPodAutoscalerCheckpoint, error) + Delete(name string, options *metav1.DeleteOptions) error + DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error + Get(name string, options metav1.GetOptions) (*v1.VerticalPodAutoscalerCheckpoint, error) + List(opts metav1.ListOptions) (*v1.VerticalPodAutoscalerCheckpointList, error) + Watch(opts metav1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.VerticalPodAutoscalerCheckpoint, err error) + VerticalPodAutoscalerCheckpointExpansion +} + +// verticalPodAutoscalerCheckpoints implements VerticalPodAutoscalerCheckpointInterface +type verticalPodAutoscalerCheckpoints struct { + client rest.Interface + ns string +} + +// newVerticalPodAutoscalerCheckpoints returns a VerticalPodAutoscalerCheckpoints +func newVerticalPodAutoscalerCheckpoints(c *AutoscalingV1Client, namespace string) *verticalPodAutoscalerCheckpoints { + return &verticalPodAutoscalerCheckpoints{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the verticalPodAutoscalerCheckpoint, and returns the corresponding verticalPodAutoscalerCheckpoint object, and an error if there is any. +func (c *verticalPodAutoscalerCheckpoints) Get(name string, options metav1.GetOptions) (result *v1.VerticalPodAutoscalerCheckpoint, err error) { + result = &v1.VerticalPodAutoscalerCheckpoint{} + err = c.client.Get(). + Namespace(c.ns). + Resource("verticalpodautoscalercheckpoints"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of VerticalPodAutoscalerCheckpoints that match those selectors. +func (c *verticalPodAutoscalerCheckpoints) List(opts metav1.ListOptions) (result *v1.VerticalPodAutoscalerCheckpointList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1.VerticalPodAutoscalerCheckpointList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("verticalpodautoscalercheckpoints"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested verticalPodAutoscalerCheckpoints. +func (c *verticalPodAutoscalerCheckpoints) Watch(opts metav1.ListOptions) (watch.Interface, error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("verticalpodautoscalercheckpoints"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch() +} + +// Create takes the representation of a verticalPodAutoscalerCheckpoint and creates it. Returns the server's representation of the verticalPodAutoscalerCheckpoint, and an error, if there is any. +func (c *verticalPodAutoscalerCheckpoints) Create(verticalPodAutoscalerCheckpoint *v1.VerticalPodAutoscalerCheckpoint) (result *v1.VerticalPodAutoscalerCheckpoint, err error) { + result = &v1.VerticalPodAutoscalerCheckpoint{} + err = c.client.Post(). + Namespace(c.ns). + Resource("verticalpodautoscalercheckpoints"). + Body(verticalPodAutoscalerCheckpoint). + Do(). + Into(result) + return +} + +// Update takes the representation of a verticalPodAutoscalerCheckpoint and updates it. Returns the server's representation of the verticalPodAutoscalerCheckpoint, and an error, if there is any. +func (c *verticalPodAutoscalerCheckpoints) Update(verticalPodAutoscalerCheckpoint *v1.VerticalPodAutoscalerCheckpoint) (result *v1.VerticalPodAutoscalerCheckpoint, err error) { + result = &v1.VerticalPodAutoscalerCheckpoint{} + err = c.client.Put(). + Namespace(c.ns). + Resource("verticalpodautoscalercheckpoints"). + Name(verticalPodAutoscalerCheckpoint.Name). + Body(verticalPodAutoscalerCheckpoint). + Do(). + Into(result) + return +} + +// Delete takes name of the verticalPodAutoscalerCheckpoint and deletes it. Returns an error if one occurs. +func (c *verticalPodAutoscalerCheckpoints) Delete(name string, options *metav1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("verticalpodautoscalercheckpoints"). + Name(name). + Body(options). + Do(). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *verticalPodAutoscalerCheckpoints) DeleteCollection(options *metav1.DeleteOptions, listOptions metav1.ListOptions) error { + var timeout time.Duration + if listOptions.TimeoutSeconds != nil { + timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Namespace(c.ns). + Resource("verticalpodautoscalercheckpoints"). + VersionedParams(&listOptions, scheme.ParameterCodec). + Timeout(timeout). + Body(options). + Do(). + Error() +} + +// Patch applies the patch and returns the patched verticalPodAutoscalerCheckpoint. +func (c *verticalPodAutoscalerCheckpoints) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1.VerticalPodAutoscalerCheckpoint, err error) { + result = &v1.VerticalPodAutoscalerCheckpoint{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("verticalpodautoscalercheckpoints"). + SubResource(subresources...). + Name(name). + Body(data). + Do(). + Into(result) + return +} diff --git a/vertical-pod-autoscaler/pkg/client/informers/externalversions/autoscaling.k8s.io/interface.go b/vertical-pod-autoscaler/pkg/client/informers/externalversions/autoscaling.k8s.io/interface.go index 3fa26d14138..4741d7142bc 100644 --- a/vertical-pod-autoscaler/pkg/client/informers/externalversions/autoscaling.k8s.io/interface.go +++ b/vertical-pod-autoscaler/pkg/client/informers/externalversions/autoscaling.k8s.io/interface.go @@ -19,6 +19,7 @@ limitations under the License. package autoscaling import ( + v1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/informers/externalversions/autoscaling.k8s.io/v1" v1beta1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/informers/externalversions/autoscaling.k8s.io/v1beta1" v1beta2 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/informers/externalversions/autoscaling.k8s.io/v1beta2" internalinterfaces "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/informers/externalversions/internalinterfaces" @@ -26,6 +27,8 @@ import ( // Interface provides access to each of this group's versions. type Interface interface { + // V1 provides access to shared informers for resources in V1. + V1() v1.Interface // V1beta2 provides access to shared informers for resources in V1beta2. V1beta2() v1beta2.Interface // V1beta1 provides access to shared informers for resources in V1beta1. @@ -43,6 +46,11 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList return &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} } +// V1 returns a new v1.Interface. +func (g *group) V1() v1.Interface { + return v1.New(g.factory, g.namespace, g.tweakListOptions) +} + // V1beta2 returns a new v1beta2.Interface. func (g *group) V1beta2() v1beta2.Interface { return v1beta2.New(g.factory, g.namespace, g.tweakListOptions) diff --git a/vertical-pod-autoscaler/pkg/client/informers/externalversions/autoscaling.k8s.io/v1/interface.go b/vertical-pod-autoscaler/pkg/client/informers/externalversions/autoscaling.k8s.io/v1/interface.go new file mode 100644 index 00000000000..5aede6a83f2 --- /dev/null +++ b/vertical-pod-autoscaler/pkg/client/informers/externalversions/autoscaling.k8s.io/v1/interface.go @@ -0,0 +1,52 @@ +/* +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 v1 + +import ( + internalinterfaces "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // VerticalPodAutoscalers returns a VerticalPodAutoscalerInformer. + VerticalPodAutoscalers() VerticalPodAutoscalerInformer + // VerticalPodAutoscalerCheckpoints returns a VerticalPodAutoscalerCheckpointInformer. + VerticalPodAutoscalerCheckpoints() VerticalPodAutoscalerCheckpointInformer +} + +type version struct { + factory internalinterfaces.SharedInformerFactory + namespace string + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// New returns a new Interface. +func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface { + return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// VerticalPodAutoscalers returns a VerticalPodAutoscalerInformer. +func (v *version) VerticalPodAutoscalers() VerticalPodAutoscalerInformer { + return &verticalPodAutoscalerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + +// VerticalPodAutoscalerCheckpoints returns a VerticalPodAutoscalerCheckpointInformer. +func (v *version) VerticalPodAutoscalerCheckpoints() VerticalPodAutoscalerCheckpointInformer { + return &verticalPodAutoscalerCheckpointInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} diff --git a/vertical-pod-autoscaler/pkg/client/informers/externalversions/autoscaling.k8s.io/v1/verticalpodautoscaler.go b/vertical-pod-autoscaler/pkg/client/informers/externalversions/autoscaling.k8s.io/v1/verticalpodautoscaler.go new file mode 100644 index 00000000000..618936c1c14 --- /dev/null +++ b/vertical-pod-autoscaler/pkg/client/informers/externalversions/autoscaling.k8s.io/v1/verticalpodautoscaler.go @@ -0,0 +1,89 @@ +/* +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 v1 + +import ( + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + autoscalingk8siov1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1" + versioned "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/clientset/versioned" + internalinterfaces "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/informers/externalversions/internalinterfaces" + v1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/listers/autoscaling.k8s.io/v1" + 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() v1.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 versioned.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 versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV1().VerticalPodAutoscalers(namespace).List(options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV1().VerticalPodAutoscalers(namespace).Watch(options) + }, + }, + &autoscalingk8siov1.VerticalPodAutoscaler{}, + resyncPeriod, + indexers, + ) +} + +func (f *verticalPodAutoscalerInformer) defaultInformer(client versioned.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(&autoscalingk8siov1.VerticalPodAutoscaler{}, f.defaultInformer) +} + +func (f *verticalPodAutoscalerInformer) Lister() v1.VerticalPodAutoscalerLister { + return v1.NewVerticalPodAutoscalerLister(f.Informer().GetIndexer()) +} diff --git a/vertical-pod-autoscaler/pkg/client/informers/externalversions/autoscaling.k8s.io/v1/verticalpodautoscalercheckpoint.go b/vertical-pod-autoscaler/pkg/client/informers/externalversions/autoscaling.k8s.io/v1/verticalpodautoscalercheckpoint.go new file mode 100644 index 00000000000..c9b0f89796c --- /dev/null +++ b/vertical-pod-autoscaler/pkg/client/informers/externalversions/autoscaling.k8s.io/v1/verticalpodautoscalercheckpoint.go @@ -0,0 +1,89 @@ +/* +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 v1 + +import ( + time "time" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + autoscalingk8siov1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1" + versioned "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/clientset/versioned" + internalinterfaces "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/informers/externalversions/internalinterfaces" + v1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/listers/autoscaling.k8s.io/v1" + cache "k8s.io/client-go/tools/cache" +) + +// VerticalPodAutoscalerCheckpointInformer provides access to a shared informer and lister for +// VerticalPodAutoscalerCheckpoints. +type VerticalPodAutoscalerCheckpointInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1.VerticalPodAutoscalerCheckpointLister +} + +type verticalPodAutoscalerCheckpointInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewVerticalPodAutoscalerCheckpointInformer constructs a new informer for VerticalPodAutoscalerCheckpoint 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 NewVerticalPodAutoscalerCheckpointInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredVerticalPodAutoscalerCheckpointInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredVerticalPodAutoscalerCheckpointInformer constructs a new informer for VerticalPodAutoscalerCheckpoint 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 NewFilteredVerticalPodAutoscalerCheckpointInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + &cache.ListWatch{ + ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV1().VerticalPodAutoscalerCheckpoints(namespace).List(options) + }, + WatchFunc: func(options metav1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV1().VerticalPodAutoscalerCheckpoints(namespace).Watch(options) + }, + }, + &autoscalingk8siov1.VerticalPodAutoscalerCheckpoint{}, + resyncPeriod, + indexers, + ) +} + +func (f *verticalPodAutoscalerCheckpointInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredVerticalPodAutoscalerCheckpointInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *verticalPodAutoscalerCheckpointInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&autoscalingk8siov1.VerticalPodAutoscalerCheckpoint{}, f.defaultInformer) +} + +func (f *verticalPodAutoscalerCheckpointInformer) Lister() v1.VerticalPodAutoscalerCheckpointLister { + return v1.NewVerticalPodAutoscalerCheckpointLister(f.Informer().GetIndexer()) +} diff --git a/vertical-pod-autoscaler/pkg/client/informers/externalversions/generic.go b/vertical-pod-autoscaler/pkg/client/informers/externalversions/generic.go index 0d8e437153b..dcecd4fe6dc 100644 --- a/vertical-pod-autoscaler/pkg/client/informers/externalversions/generic.go +++ b/vertical-pod-autoscaler/pkg/client/informers/externalversions/generic.go @@ -22,6 +22,7 @@ import ( "fmt" schema "k8s.io/apimachinery/pkg/runtime/schema" + v1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1" v1beta1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1beta1" v1beta2 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1beta2" v1alpha1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/poc.autoscaling.k8s.io/v1alpha1" @@ -54,7 +55,13 @@ func (f *genericInformer) Lister() cache.GenericLister { // TODO extend this to unknown resources with a client pool func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) { switch resource { - // Group=autoscaling.k8s.io, Version=v1beta1 + // Group=autoscaling.k8s.io, Version=v1 + case v1.SchemeGroupVersion.WithResource("verticalpodautoscalers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V1().VerticalPodAutoscalers().Informer()}, nil + case v1.SchemeGroupVersion.WithResource("verticalpodautoscalercheckpoints"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V1().VerticalPodAutoscalerCheckpoints().Informer()}, nil + + // Group=autoscaling.k8s.io, Version=v1beta1 case v1beta1.SchemeGroupVersion.WithResource("verticalpodautoscalers"): return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V1beta1().VerticalPodAutoscalers().Informer()}, nil case v1beta1.SchemeGroupVersion.WithResource("verticalpodautoscalercheckpoints"): diff --git a/vertical-pod-autoscaler/pkg/client/listers/autoscaling.k8s.io/v1/expansion_generated.go b/vertical-pod-autoscaler/pkg/client/listers/autoscaling.k8s.io/v1/expansion_generated.go new file mode 100644 index 00000000000..a72081fc5ad --- /dev/null +++ b/vertical-pod-autoscaler/pkg/client/listers/autoscaling.k8s.io/v1/expansion_generated.go @@ -0,0 +1,35 @@ +/* +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 v1 + +// VerticalPodAutoscalerListerExpansion allows custom methods to be added to +// VerticalPodAutoscalerLister. +type VerticalPodAutoscalerListerExpansion interface{} + +// VerticalPodAutoscalerNamespaceListerExpansion allows custom methods to be added to +// VerticalPodAutoscalerNamespaceLister. +type VerticalPodAutoscalerNamespaceListerExpansion interface{} + +// VerticalPodAutoscalerCheckpointListerExpansion allows custom methods to be added to +// VerticalPodAutoscalerCheckpointLister. +type VerticalPodAutoscalerCheckpointListerExpansion interface{} + +// VerticalPodAutoscalerCheckpointNamespaceListerExpansion allows custom methods to be added to +// VerticalPodAutoscalerCheckpointNamespaceLister. +type VerticalPodAutoscalerCheckpointNamespaceListerExpansion interface{} diff --git a/vertical-pod-autoscaler/pkg/client/listers/autoscaling.k8s.io/v1/verticalpodautoscaler.go b/vertical-pod-autoscaler/pkg/client/listers/autoscaling.k8s.io/v1/verticalpodautoscaler.go new file mode 100644 index 00000000000..fcfd735378a --- /dev/null +++ b/vertical-pod-autoscaler/pkg/client/listers/autoscaling.k8s.io/v1/verticalpodautoscaler.go @@ -0,0 +1,94 @@ +/* +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 v1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + v1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1" + "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 []*v1.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 []*v1.VerticalPodAutoscaler, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.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 []*v1.VerticalPodAutoscaler, err error) + // Get retrieves the VerticalPodAutoscaler from the indexer for a given namespace and name. + Get(name string) (*v1.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 []*v1.VerticalPodAutoscaler, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.VerticalPodAutoscaler)) + }) + return ret, err +} + +// Get retrieves the VerticalPodAutoscaler from the indexer for a given namespace and name. +func (s verticalPodAutoscalerNamespaceLister) Get(name string) (*v1.VerticalPodAutoscaler, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("verticalpodautoscaler"), name) + } + return obj.(*v1.VerticalPodAutoscaler), nil +} diff --git a/vertical-pod-autoscaler/pkg/client/listers/autoscaling.k8s.io/v1/verticalpodautoscalercheckpoint.go b/vertical-pod-autoscaler/pkg/client/listers/autoscaling.k8s.io/v1/verticalpodautoscalercheckpoint.go new file mode 100644 index 00000000000..947a4760b9b --- /dev/null +++ b/vertical-pod-autoscaler/pkg/client/listers/autoscaling.k8s.io/v1/verticalpodautoscalercheckpoint.go @@ -0,0 +1,94 @@ +/* +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 v1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + v1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1" + "k8s.io/client-go/tools/cache" +) + +// VerticalPodAutoscalerCheckpointLister helps list VerticalPodAutoscalerCheckpoints. +type VerticalPodAutoscalerCheckpointLister interface { + // List lists all VerticalPodAutoscalerCheckpoints in the indexer. + List(selector labels.Selector) (ret []*v1.VerticalPodAutoscalerCheckpoint, err error) + // VerticalPodAutoscalerCheckpoints returns an object that can list and get VerticalPodAutoscalerCheckpoints. + VerticalPodAutoscalerCheckpoints(namespace string) VerticalPodAutoscalerCheckpointNamespaceLister + VerticalPodAutoscalerCheckpointListerExpansion +} + +// verticalPodAutoscalerCheckpointLister implements the VerticalPodAutoscalerCheckpointLister interface. +type verticalPodAutoscalerCheckpointLister struct { + indexer cache.Indexer +} + +// NewVerticalPodAutoscalerCheckpointLister returns a new VerticalPodAutoscalerCheckpointLister. +func NewVerticalPodAutoscalerCheckpointLister(indexer cache.Indexer) VerticalPodAutoscalerCheckpointLister { + return &verticalPodAutoscalerCheckpointLister{indexer: indexer} +} + +// List lists all VerticalPodAutoscalerCheckpoints in the indexer. +func (s *verticalPodAutoscalerCheckpointLister) List(selector labels.Selector) (ret []*v1.VerticalPodAutoscalerCheckpoint, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1.VerticalPodAutoscalerCheckpoint)) + }) + return ret, err +} + +// VerticalPodAutoscalerCheckpoints returns an object that can list and get VerticalPodAutoscalerCheckpoints. +func (s *verticalPodAutoscalerCheckpointLister) VerticalPodAutoscalerCheckpoints(namespace string) VerticalPodAutoscalerCheckpointNamespaceLister { + return verticalPodAutoscalerCheckpointNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// VerticalPodAutoscalerCheckpointNamespaceLister helps list and get VerticalPodAutoscalerCheckpoints. +type VerticalPodAutoscalerCheckpointNamespaceLister interface { + // List lists all VerticalPodAutoscalerCheckpoints in the indexer for a given namespace. + List(selector labels.Selector) (ret []*v1.VerticalPodAutoscalerCheckpoint, err error) + // Get retrieves the VerticalPodAutoscalerCheckpoint from the indexer for a given namespace and name. + Get(name string) (*v1.VerticalPodAutoscalerCheckpoint, error) + VerticalPodAutoscalerCheckpointNamespaceListerExpansion +} + +// verticalPodAutoscalerCheckpointNamespaceLister implements the VerticalPodAutoscalerCheckpointNamespaceLister +// interface. +type verticalPodAutoscalerCheckpointNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all VerticalPodAutoscalerCheckpoints in the indexer for a given namespace. +func (s verticalPodAutoscalerCheckpointNamespaceLister) List(selector labels.Selector) (ret []*v1.VerticalPodAutoscalerCheckpoint, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1.VerticalPodAutoscalerCheckpoint)) + }) + return ret, err +} + +// Get retrieves the VerticalPodAutoscalerCheckpoint from the indexer for a given namespace and name. +func (s verticalPodAutoscalerCheckpointNamespaceLister) Get(name string) (*v1.VerticalPodAutoscalerCheckpoint, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1.Resource("verticalpodautoscalercheckpoint"), name) + } + return obj.(*v1.VerticalPodAutoscalerCheckpoint), nil +}