diff --git a/vertical-pod-autoscaler/api/vpa-crd.yaml b/vertical-pod-autoscaler/api/vpa-crd.yaml index c99789e836..da49fcd079 100644 --- a/vertical-pod-autoscaler/api/vpa-crd.yaml +++ b/vertical-pod-autoscaler/api/vpa-crd.yaml @@ -50,4 +50,18 @@ spec: type: object maxAllowed: type: object - +--- +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: verticalpodautoscalercheckpoints.poc.autoscaling.k8s.io +spec: + group: poc.autoscaling.k8s.io + version: v1alpha1 + scope: Namespaced + names: + plural: verticalpodautoscalercheckpoints + singular: verticalpodautoscalercheckpoint + kind: VerticalPodAutoscalerCheckpoint + shortNames: + - vpacheckpoint diff --git a/vertical-pod-autoscaler/pkg/apis/poc.autoscaling.k8s.io/v1alpha1/register.go b/vertical-pod-autoscaler/pkg/apis/poc.autoscaling.k8s.io/v1alpha1/register.go index e3ddc65d74..73be9d05b1 100644 --- a/vertical-pod-autoscaler/pkg/apis/poc.autoscaling.k8s.io/v1alpha1/register.go +++ b/vertical-pod-autoscaler/pkg/apis/poc.autoscaling.k8s.io/v1alpha1/register.go @@ -50,6 +50,8 @@ 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/poc.autoscaling.k8s.io/v1alpha1/types.go b/vertical-pod-autoscaler/pkg/apis/poc.autoscaling.k8s.io/v1alpha1/types.go index 348ff1db62..0a1fdaa879 100644 --- a/vertical-pod-autoscaler/pkg/apis/poc.autoscaling.k8s.io/v1alpha1/types.go +++ b/vertical-pod-autoscaler/pkg/apis/poc.autoscaling.k8s.io/v1alpha1/types.go @@ -207,3 +207,70 @@ type RecommendedContainerResources struct { // +optional MaxRecommended apiv1.ResourceList `json:"maxRecommended,omitempty" protobuf:"bytes,3,rep,name=maxRecommended,casttype=ResourceList,castkey=ResourceName"` } + +// +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"` +} + +// 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"` +} + +// HistogramCheckpoint contains data needed to reconstruct the histogram. +type HistogramCheckpoint struct { + // Name of the resource that this HistogramCheckpoint refers to. + Resource string `json:"resource,omitempty" protobuf:"bytes,1,opt,name=resource"` + + // Reference timestamp for samples collected within this histogram. + ReferenceTimestamp metav1.Time `json:"referenceTimestamp,omitempty" protobuf:"bytes,2,opt,name=referenceTimestamp"` + + // Map from bucket index to bucket weight. + BucketWeights map[int]uint32 `json:"bucketWeights,omitempty" protobuf:"bytes,3,opt,name=bucketWeights"` + + // Sum of samples to be used as denominator for weights from BucketWeights. + TotalWeight float64 `json:"totalWeight,omitempty" protobuf:"bytes,4,opt,name=totalWeight"` +} diff --git a/vertical-pod-autoscaler/pkg/apis/poc.autoscaling.k8s.io/v1alpha1/zz_generated.deepcopy.go b/vertical-pod-autoscaler/pkg/apis/poc.autoscaling.k8s.io/v1alpha1/zz_generated.deepcopy.go index 00b0168fd7..95bb2b68e1 100644 --- a/vertical-pod-autoscaler/pkg/apis/poc.autoscaling.k8s.io/v1alpha1/zz_generated.deepcopy.go +++ b/vertical-pod-autoscaler/pkg/apis/poc.autoscaling.k8s.io/v1alpha1/zz_generated.deepcopy.go @@ -56,6 +56,30 @@ func (in *ContainerResourcePolicy) DeepCopy() *ContainerResourcePolicy { 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 @@ -184,6 +208,104 @@ func (in *VerticalPodAutoscaler) DeepCopyObject() runtime.Object { } } +// 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 + } else { + 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 + } else { + 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) + 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 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 6b7b131ab0..7f22fa9864 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 @@ -41,7 +41,15 @@ func NewSimpleClientset(objects ...runtime.Object) *Clientset { fakePtr := testing.Fake{} fakePtr.AddReactor("*", "*", testing.ObjectReaction(o)) - fakePtr.AddWatchReactor("*", testing.DefaultWatchReactor(watch.NewFake(), nil)) + fakePtr.AddWatchReactor("*", func(action testing.Action) (handled bool, ret watch.Interface, err error) { + gvr := action.GetResource() + ns := action.GetNamespace() + watch, err := o.Watch(gvr, ns) + if err != nil { + return false, nil, err + } + return true, watch, nil + }) return &Clientset{fakePtr, &fakediscovery.FakeDiscovery{Fake: &fakePtr}} } 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 f13074b299..3af43eb9f6 100644 --- a/vertical-pod-autoscaler/pkg/client/clientset/versioned/fake/register.go +++ b/vertical-pod-autoscaler/pkg/client/clientset/versioned/fake/register.go @@ -38,7 +38,7 @@ func init() { // // import ( // "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kuberentes/scheme" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" // ) // @@ -49,5 +49,4 @@ func init() { // correctly. func AddToScheme(scheme *runtime.Scheme) { pocv1alpha1.AddToScheme(scheme) - } 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 dd10bc31c0..94b7af20e0 100644 --- a/vertical-pod-autoscaler/pkg/client/clientset/versioned/scheme/register.go +++ b/vertical-pod-autoscaler/pkg/client/clientset/versioned/scheme/register.go @@ -38,7 +38,7 @@ func init() { // // import ( // "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kuberentes/scheme" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" // aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" // ) // @@ -49,5 +49,4 @@ func init() { // correctly. func AddToScheme(scheme *runtime.Scheme) { pocv1alpha1.AddToScheme(scheme) - } diff --git a/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/poc.autoscaling.k8s.io/v1alpha1/fake/fake_poc.autoscaling.k8s.io_client.go b/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/poc.autoscaling.k8s.io/v1alpha1/fake/fake_poc.autoscaling.k8s.io_client.go index aee24d9486..46e97683d6 100644 --- a/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/poc.autoscaling.k8s.io/v1alpha1/fake/fake_poc.autoscaling.k8s.io_client.go +++ b/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/poc.autoscaling.k8s.io/v1alpha1/fake/fake_poc.autoscaling.k8s.io_client.go @@ -30,6 +30,10 @@ func (c *FakePocV1alpha1) VerticalPodAutoscalers(namespace string) v1alpha1.Vert return &FakeVerticalPodAutoscalers{c, namespace} } +func (c *FakePocV1alpha1) VerticalPodAutoscalerCheckpoints(namespace string) v1alpha1.VerticalPodAutoscalerCheckpointInterface { + return &FakeVerticalPodAutoscalerCheckpoints{c, namespace} +} + // RESTClient returns a RESTClient that is used to communicate // with API server by this client implementation. func (c *FakePocV1alpha1) RESTClient() rest.Interface { diff --git a/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/poc.autoscaling.k8s.io/v1alpha1/fake/fake_verticalpodautoscalercheckpoint.go b/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/poc.autoscaling.k8s.io/v1alpha1/fake/fake_verticalpodautoscalercheckpoint.go new file mode 100644 index 0000000000..4bbd8e39f5 --- /dev/null +++ b/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/poc.autoscaling.k8s.io/v1alpha1/fake/fake_verticalpodautoscalercheckpoint.go @@ -0,0 +1,126 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package 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" + v1alpha1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/poc.autoscaling.k8s.io/v1alpha1" + testing "k8s.io/client-go/testing" +) + +// FakeVerticalPodAutoscalerCheckpoints implements VerticalPodAutoscalerCheckpointInterface +type FakeVerticalPodAutoscalerCheckpoints struct { + Fake *FakePocV1alpha1 + ns string +} + +var verticalpodautoscalercheckpointsResource = schema.GroupVersionResource{Group: "poc.autoscaling.k8s.io", Version: "v1alpha1", Resource: "verticalpodautoscalercheckpoints"} + +var verticalpodautoscalercheckpointsKind = schema.GroupVersionKind{Group: "poc.autoscaling.k8s.io", Version: "v1alpha1", 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 *v1alpha1.VerticalPodAutoscalerCheckpoint, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(verticalpodautoscalercheckpointsResource, c.ns, name), &v1alpha1.VerticalPodAutoscalerCheckpoint{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.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 *v1alpha1.VerticalPodAutoscalerCheckpointList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(verticalpodautoscalercheckpointsResource, verticalpodautoscalercheckpointsKind, c.ns, opts), &v1alpha1.VerticalPodAutoscalerCheckpointList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.VerticalPodAutoscalerCheckpointList{} + for _, item := range obj.(*v1alpha1.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 *v1alpha1.VerticalPodAutoscalerCheckpoint) (result *v1alpha1.VerticalPodAutoscalerCheckpoint, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(verticalpodautoscalercheckpointsResource, c.ns, verticalPodAutoscalerCheckpoint), &v1alpha1.VerticalPodAutoscalerCheckpoint{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.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 *v1alpha1.VerticalPodAutoscalerCheckpoint) (result *v1alpha1.VerticalPodAutoscalerCheckpoint, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(verticalpodautoscalercheckpointsResource, c.ns, verticalPodAutoscalerCheckpoint), &v1alpha1.VerticalPodAutoscalerCheckpoint{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.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), &v1alpha1.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, &v1alpha1.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 *v1alpha1.VerticalPodAutoscalerCheckpoint, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(verticalpodautoscalercheckpointsResource, c.ns, name, data, subresources...), &v1alpha1.VerticalPodAutoscalerCheckpoint{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VerticalPodAutoscalerCheckpoint), err +} diff --git a/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/poc.autoscaling.k8s.io/v1alpha1/generated_expansion.go b/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/poc.autoscaling.k8s.io/v1alpha1/generated_expansion.go index 3d05ca5518..27f6f1a94b 100644 --- a/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/poc.autoscaling.k8s.io/v1alpha1/generated_expansion.go +++ b/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/poc.autoscaling.k8s.io/v1alpha1/generated_expansion.go @@ -17,3 +17,5 @@ limitations under the License. package v1alpha1 type VerticalPodAutoscalerExpansion interface{} + +type VerticalPodAutoscalerCheckpointExpansion interface{} diff --git a/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/poc.autoscaling.k8s.io/v1alpha1/poc.autoscaling.k8s.io_client.go b/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/poc.autoscaling.k8s.io/v1alpha1/poc.autoscaling.k8s.io_client.go index f2d63d5b7c..6e43e45b22 100644 --- a/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/poc.autoscaling.k8s.io/v1alpha1/poc.autoscaling.k8s.io_client.go +++ b/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/poc.autoscaling.k8s.io/v1alpha1/poc.autoscaling.k8s.io_client.go @@ -26,6 +26,7 @@ import ( type PocV1alpha1Interface interface { RESTClient() rest.Interface VerticalPodAutoscalersGetter + VerticalPodAutoscalerCheckpointsGetter } // PocV1alpha1Client is used to interact with features provided by the poc.autoscaling.k8s.io group. @@ -37,6 +38,10 @@ func (c *PocV1alpha1Client) VerticalPodAutoscalers(namespace string) VerticalPod return newVerticalPodAutoscalers(c, namespace) } +func (c *PocV1alpha1Client) VerticalPodAutoscalerCheckpoints(namespace string) VerticalPodAutoscalerCheckpointInterface { + return newVerticalPodAutoscalerCheckpoints(c, namespace) +} + // NewForConfig creates a new PocV1alpha1Client for the given config. func NewForConfig(c *rest.Config) (*PocV1alpha1Client, error) { config := *c diff --git a/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/poc.autoscaling.k8s.io/v1alpha1/verticalpodautoscalercheckpoint.go b/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/poc.autoscaling.k8s.io/v1alpha1/verticalpodautoscalercheckpoint.go new file mode 100644 index 0000000000..5b953d4caf --- /dev/null +++ b/vertical-pod-autoscaler/pkg/client/clientset/versioned/typed/poc.autoscaling.k8s.io/v1alpha1/verticalpodautoscalercheckpoint.go @@ -0,0 +1,155 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + v1alpha1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/poc.autoscaling.k8s.io/v1alpha1" + 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(*v1alpha1.VerticalPodAutoscalerCheckpoint) (*v1alpha1.VerticalPodAutoscalerCheckpoint, error) + Update(*v1alpha1.VerticalPodAutoscalerCheckpoint) (*v1alpha1.VerticalPodAutoscalerCheckpoint, error) + Delete(name string, options *v1.DeleteOptions) error + DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error + Get(name string, options v1.GetOptions) (*v1alpha1.VerticalPodAutoscalerCheckpoint, error) + List(opts v1.ListOptions) (*v1alpha1.VerticalPodAutoscalerCheckpointList, error) + Watch(opts v1.ListOptions) (watch.Interface, error) + Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1alpha1.VerticalPodAutoscalerCheckpoint, err error) + VerticalPodAutoscalerCheckpointExpansion +} + +// verticalPodAutoscalerCheckpoints implements VerticalPodAutoscalerCheckpointInterface +type verticalPodAutoscalerCheckpoints struct { + client rest.Interface + ns string +} + +// newVerticalPodAutoscalerCheckpoints returns a VerticalPodAutoscalerCheckpoints +func newVerticalPodAutoscalerCheckpoints(c *PocV1alpha1Client, 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 v1.GetOptions) (result *v1alpha1.VerticalPodAutoscalerCheckpoint, err error) { + result = &v1alpha1.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 v1.ListOptions) (result *v1alpha1.VerticalPodAutoscalerCheckpointList, err error) { + result = &v1alpha1.VerticalPodAutoscalerCheckpointList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("verticalpodautoscalercheckpoints"). + VersionedParams(&opts, scheme.ParameterCodec). + Do(). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested verticalPodAutoscalerCheckpoints. +func (c *verticalPodAutoscalerCheckpoints) Watch(opts v1.ListOptions) (watch.Interface, error) { + opts.Watch = true + return c.client.Get(). + Namespace(c.ns). + Resource("verticalpodautoscalercheckpoints"). + VersionedParams(&opts, scheme.ParameterCodec). + 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 *v1alpha1.VerticalPodAutoscalerCheckpoint) (result *v1alpha1.VerticalPodAutoscalerCheckpoint, err error) { + result = &v1alpha1.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 *v1alpha1.VerticalPodAutoscalerCheckpoint) (result *v1alpha1.VerticalPodAutoscalerCheckpoint, err error) { + result = &v1alpha1.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 *v1.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 *v1.DeleteOptions, listOptions v1.ListOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("verticalpodautoscalercheckpoints"). + VersionedParams(&listOptions, scheme.ParameterCodec). + 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 *v1alpha1.VerticalPodAutoscalerCheckpoint, err error) { + result = &v1alpha1.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/generic.go b/vertical-pod-autoscaler/pkg/client/informers/externalversions/generic.go index a0f9786fc5..eda689b881 100644 --- a/vertical-pod-autoscaler/pkg/client/informers/externalversions/generic.go +++ b/vertical-pod-autoscaler/pkg/client/informers/externalversions/generic.go @@ -55,6 +55,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource // Group=poc.autoscaling.k8s.io, Version=v1alpha1 case v1alpha1.SchemeGroupVersion.WithResource("verticalpodautoscalers"): return &genericInformer{resource: resource.GroupResource(), informer: f.Poc().V1alpha1().VerticalPodAutoscalers().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("verticalpodautoscalercheckpoints"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Poc().V1alpha1().VerticalPodAutoscalerCheckpoints().Informer()}, nil } diff --git a/vertical-pod-autoscaler/pkg/client/informers/externalversions/poc.autoscaling.k8s.io/v1alpha1/interface.go b/vertical-pod-autoscaler/pkg/client/informers/externalversions/poc.autoscaling.k8s.io/v1alpha1/interface.go index 01d3c21cd6..ee8dc88573 100644 --- a/vertical-pod-autoscaler/pkg/client/informers/externalversions/poc.autoscaling.k8s.io/v1alpha1/interface.go +++ b/vertical-pod-autoscaler/pkg/client/informers/externalversions/poc.autoscaling.k8s.io/v1alpha1/interface.go @@ -26,6 +26,8 @@ import ( type Interface interface { // VerticalPodAutoscalers returns a VerticalPodAutoscalerInformer. VerticalPodAutoscalers() VerticalPodAutoscalerInformer + // VerticalPodAutoscalerCheckpoints returns a VerticalPodAutoscalerCheckpointInformer. + VerticalPodAutoscalerCheckpoints() VerticalPodAutoscalerCheckpointInformer } type version struct { @@ -43,3 +45,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList 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/poc.autoscaling.k8s.io/v1alpha1/verticalpodautoscalercheckpoint.go b/vertical-pod-autoscaler/pkg/client/informers/externalversions/poc.autoscaling.k8s.io/v1alpha1/verticalpodautoscalercheckpoint.go new file mode 100644 index 0000000000..69cc81223f --- /dev/null +++ b/vertical-pod-autoscaler/pkg/client/informers/externalversions/poc.autoscaling.k8s.io/v1alpha1/verticalpodautoscalercheckpoint.go @@ -0,0 +1,89 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// This file was automatically generated by informer-gen + +package v1alpha1 + +import ( + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + poc_autoscaling_k8s_io_v1alpha1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/poc.autoscaling.k8s.io/v1alpha1" + versioned "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/clientset/versioned" + internalinterfaces "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/client/listers/poc.autoscaling.k8s.io/v1alpha1" + 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() v1alpha1.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 v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.PocV1alpha1().VerticalPodAutoscalerCheckpoints(namespace).List(options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.PocV1alpha1().VerticalPodAutoscalerCheckpoints(namespace).Watch(options) + }, + }, + &poc_autoscaling_k8s_io_v1alpha1.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(&poc_autoscaling_k8s_io_v1alpha1.VerticalPodAutoscalerCheckpoint{}, f.defaultInformer) +} + +func (f *verticalPodAutoscalerCheckpointInformer) Lister() v1alpha1.VerticalPodAutoscalerCheckpointLister { + return v1alpha1.NewVerticalPodAutoscalerCheckpointLister(f.Informer().GetIndexer()) +} diff --git a/vertical-pod-autoscaler/pkg/client/listers/poc.autoscaling.k8s.io/v1alpha1/expansion_generated.go b/vertical-pod-autoscaler/pkg/client/listers/poc.autoscaling.k8s.io/v1alpha1/expansion_generated.go index 6cc604f123..f3aa5508fb 100644 --- a/vertical-pod-autoscaler/pkg/client/listers/poc.autoscaling.k8s.io/v1alpha1/expansion_generated.go +++ b/vertical-pod-autoscaler/pkg/client/listers/poc.autoscaling.k8s.io/v1alpha1/expansion_generated.go @@ -25,3 +25,11 @@ 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/poc.autoscaling.k8s.io/v1alpha1/verticalpodautoscalercheckpoint.go b/vertical-pod-autoscaler/pkg/client/listers/poc.autoscaling.k8s.io/v1alpha1/verticalpodautoscalercheckpoint.go new file mode 100644 index 0000000000..3df36ec509 --- /dev/null +++ b/vertical-pod-autoscaler/pkg/client/listers/poc.autoscaling.k8s.io/v1alpha1/verticalpodautoscalercheckpoint.go @@ -0,0 +1,94 @@ +/* +Copyright 2018 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// This file was automatically generated by lister-gen + +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + v1alpha1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/poc.autoscaling.k8s.io/v1alpha1" + "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 []*v1alpha1.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 []*v1alpha1.VerticalPodAutoscalerCheckpoint, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.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 []*v1alpha1.VerticalPodAutoscalerCheckpoint, err error) + // Get retrieves the VerticalPodAutoscalerCheckpoint from the indexer for a given namespace and name. + Get(name string) (*v1alpha1.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 []*v1alpha1.VerticalPodAutoscalerCheckpoint, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.VerticalPodAutoscalerCheckpoint)) + }) + return ret, err +} + +// Get retrieves the VerticalPodAutoscalerCheckpoint from the indexer for a given namespace and name. +func (s verticalPodAutoscalerCheckpointNamespaceLister) Get(name string) (*v1alpha1.VerticalPodAutoscalerCheckpoint, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("verticalpodautoscalercheckpoint"), name) + } + return obj.(*v1alpha1.VerticalPodAutoscalerCheckpoint), nil +}