diff --git a/pkg/apis/autoscaling/v1alpha1/doc.go b/pkg/apis/autoscaling/v1alpha1/doc.go new file mode 100644 index 00000000..158f758e --- /dev/null +++ b/pkg/apis/autoscaling/v1alpha1/doc.go @@ -0,0 +1,21 @@ +/* +Copyright 2021 The Volcano 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 contains API Schema definitions for the batch v1alpha1 API group +// +kubebuilder:object:generate=true +// +groupName=autoscaling.volcano.sh +// +k8s:deepcopy-gen=package +package v1alpha1 diff --git a/pkg/apis/autoscaling/v1alpha1/labels.go b/pkg/apis/autoscaling/v1alpha1/labels.go new file mode 100644 index 00000000..7f28108d --- /dev/null +++ b/pkg/apis/autoscaling/v1alpha1/labels.go @@ -0,0 +1,17 @@ +/* +Copyright 2017 The Volcano 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 diff --git a/pkg/apis/autoscaling/v1alpha1/register.go b/pkg/apis/autoscaling/v1alpha1/register.go new file mode 100644 index 00000000..1f4ebcc0 --- /dev/null +++ b/pkg/apis/autoscaling/v1alpha1/register.go @@ -0,0 +1,52 @@ +/* +Copyright 2017 The Volcano 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 ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" +) + +var ( + // SchemeBuilder points to a list of functions added to Scheme. + SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) + // AddToScheme applies all the stored functions to the scheme. + AddToScheme = SchemeBuilder.AddToScheme +) + +// GroupName is the group name used in this package. +const GroupName = "autoscaling.volcano.sh" + +// SchemeGroupVersion is the group version used to register these objects. +var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1alpha1"} + +// Resource takes an unqualified resource and returns a Group-qualified GroupResource. +func Resource(resource string) schema.GroupResource { + return SchemeGroupVersion.WithResource(resource).GroupResource() +} + +// addKnownTypes adds the set of types defined in this package to the supplied scheme. +func addKnownTypes(scheme *runtime.Scheme) error { + scheme.AddKnownTypes(SchemeGroupVersion, + &VerticalQueueAutoscaler{}, + &VerticalQueueAutoscalerList{}, + ) + + metav1.AddToGroupVersion(scheme, SchemeGroupVersion) + return nil +} diff --git a/pkg/apis/autoscaling/v1alpha1/vqa.go b/pkg/apis/autoscaling/v1alpha1/vqa.go new file mode 100644 index 00000000..1c1e9123 --- /dev/null +++ b/pkg/apis/autoscaling/v1alpha1/vqa.go @@ -0,0 +1,209 @@ +/* +Copyright 2018 The Volcano 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 ( + v2 "k8s.io/api/autoscaling/v2" + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type VerticalQueueAutoscalerType string +type StepType string +type Condition string + +const ( + ResourceVQARatio corev1.ResourceName = "ratio" + VerticalQueueAutoscalerTidalType VerticalQueueAutoscalerType = "tidal" + VerticalQueueAutoscalerMetricsType VerticalQueueAutoscalerType = "metrics" + EquivalentStepType StepType = "equivalent" + EquiratioStepType StepType = "equiratio" + AndCondition Condition = "and" + OrCondition Condition = "or" +) + +// +genclient +// +genclient:nonNamespaced +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=verticalqueueautoscalers,shortName=vqa;vqas,scope=Cluster +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="Last Scale",type=date,JSONPath=`.status.lastScaleTime` +// +kubebuilder:printcolumn:name="Last Successful",type=date,JSONPath=`.status.lastScaleSuccessTime` +// +kubebuilder:printcolumn:name="AGE",type=date,JSONPath=`.metadata.creationTimestamp` +// +kubebuilder:printcolumn:name="QUEUE",type=string,priority=1,JSONPath=`.spec.queue` + +// VerticalQueueAutoscaler defines the volcano vertical queue autoscaler. +type VerticalQueueAutoscaler struct { + metav1.TypeMeta `json:",inline"` + + // +optional + metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"` + + // Specification of the desired behavior of the volcano verticalqueueautoscaler, including tidal and metrics + // +optional + Spec VQASpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"` + + // Current status of the volcano verticalqueueautoscaler + // +optional + Status VQAStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"` +} + +// VQASpec describes how the VerticalQueueAutoscaler will look like and actually behavior. +type VQASpec struct { + + //Specifies the queue that will be used in the scheduler, "default" queue is used this leaves empty. + Queue string `json:"queue,omitempty" protobuf:"bytes,1,opt,name=queue"` + + // Type is the behavior type of VQA. + //+kubebuilder:validation:Enum=tidal;metrics + Type VerticalQueueAutoscalerType `json:"type,omitempty" protobuf:"bytes,2,opt,name=type"` + + // TidalSpec define tidal autoscaling configuration + // +optional + TidalSpec TidalSpec `json:"tidalSpec,omitempty" protobuf:"bytes,3,opt,name=tidalSpec"` + + // TidalSpec define metrics autoscaling configuration + // +optional + MetricSpec []MetricSpec `json:"metricSpec,omitempty" protobuf:"bytes,4,opt,name=metricSpec"` +} + +type VQAStatus struct { + // LastScaleTime is the last time the VerticalQueueAutoscaler scaled the capacity of queue, + // +optional + LastScaleTime *metav1.Time `json:"lastScaleTime,omitempty" protobuf:"bytes,1,opt,name=lastScaleTime"` + + // LastScaleSuccessTime is the last time the VerticalQueueAutoscaler scaled the capacity of queue Successful, + // +optional + LastScaleSuccessTime *metav1.Time `json:"lastScaleSuccessTime,omitempty" protobuf:"bytes,2,opt,name=lastScaleSuccessTime"` +} + +type TidalSpec struct { + // StartingDeadlineSeconds Optional deadline in seconds for starting the job if it misses scheduled + // time for any reason. Missed jobs executions will be counted as failed ones. + // +optional + StartingDeadlineSeconds *int64 `json:"startingDeadlineSeconds,omitempty" protobuf:"varint,1,opt,name=startingDeadlineSeconds"` + + // Tidal define arrays of tidal configuration + Tidal []Tidal `json:"tidal,omitempty" protobuf:"bytes,2,opt,name=tidal"` +} + +type Tidal struct { + // Schedule The schedule in Cron format, see https://en.wikipedia.org/wiki/Cron + Schedule string `json:"schedule,omitempty" protobuf:"bytes,1,opt,name=schedule"` + // Weight queue.spec.weight + Weight int32 `json:"weight,omitempty" protobuf:"bytes,2,opt,name=weight"` + // Capability queue.spec.capability + Capability corev1.ResourceList `json:"capability,omitempty" protobuf:"bytes,3,opt,name=capability"` + // Guarantee queue.spec.guarantee.resource + Guarantee corev1.ResourceList `json:"guarantee,omitempty" protobuf:"bytes,4,opt,name=guarantee"` +} + +type MetricSpec struct { + // ScaleBehavior define scale behavior of metrics type + ScaleBehavior ScaleBehavior `json:"scaleBehavior,omitempty" protobuf:"bytes,1,opt,name=scaleBehavior"` + // ResourceLimit resources limit of queue + ResourceLimit ResourceLimit `json:"resourceLimit,omitempty" protobuf:"bytes,2,opt,name=resourceLimit"` + MetricRules MetricRules `json:"metricRules,omitempty" protobuf:"bytes,3,opt,name=metricRules"` +} + +type ScaleBehavior struct { + // StepType scale step type + //+kubebuilder:validation:Enum=Delete;Orphan + StepType StepType `json:"stepType,omitempty" protobuf:"bytes,1,opt,name=stepType"` + // StepRatio ratio of scale step + StepRatio resource.Quantity `json:"stepRatio,omitempty" protobuf:"bytes,2,opt,name=stepRatio"` + // StepResources resources of scale step + StepResources StepResources `json:"stepResources,omitempty" protobuf:"bytes,3,opt,name=stepResources"` +} + +type StepResources struct { + // Weight queue.spec.weight, it's a increment + Weight int32 `json:"weight,omitempty" protobuf:"bytes,1,opt,name=weight"` + // Capability queue.spec.capability, it's a increment + Capability corev1.ResourceList `json:"capability,omitempty" protobuf:"bytes,2,opt,name=capability"` + // Guarantee queue.spec.guarantee.resource, it's a increment + Guarantee corev1.ResourceList `json:"guarantee,omitempty" protobuf:"bytes,3,opt,name=guarantee"` +} + +type ScaleLimit struct { + // WeightLimit limit of queue.spec.weight + WeightLimit WeightLimit `json:"weightLimit,omitempty" protobuf:"bytes,1,opt,name=weightLimit"` + // CapacityLimit limit of queue.spec.capability + CapacityLimit ResourceLimit `json:"capacityLimit,omitempty" protobuf:"bytes,2,opt,name=capacityLimit"` + // GuaranteeLimit limit of queue.spec.guarantee.resource + GuaranteeLimit ResourceLimit `json:"guaratneeLimit,omitempty" protobuf:"bytes,3,opt,name=guaratneeLimit"` +} + +type WeightLimit struct { + // Min minimum of queue.spec.weight + Min int32 `json:"min,omitempty" protobuf:"bytes,1,opt,name=min"` + // Max maximum of queue.spec.weight + Max int32 `json:"max,omitempty" protobuf:"bytes,2,opt,name=max"` +} + +type ResourceLimit struct { + // Min minimum of queue.spec.capacity or guarantee + Min corev1.ResourceList `json:"min,omitempty" protobuf:"bytes,1,opt,name=min"` + // Max maximum of queue.spec.capacity or guarantee + Max corev1.ResourceList `json:"max,omitempty" protobuf:"bytes,2,opt,name=max"` +} + +type MetricRules struct { + // ScaleUp rule of scale up + ScaleUp ScaleRule `json:"scaleUp,omitempty" protobuf:"bytes,1,opt,name=scaleUp"` + // ScaleUp rule of scale down + ScaleDown ScaleRule `json:"scaleDown,omitempty" protobuf:"bytes,2,opt,name=scaleDown"` +} + +type ScaleRule struct { + // StabilizationWindowSeconds is the number of seconds for which past recommendations should be + // considered while scaling up or scaling down. + // StabilizationWindowSeconds must be greater than or equal to zero and less than or equal to 3600 (one hour). + // If not set, use the default values: + // - For scale up: 0 (i.e. no stabilization is done). + // - For scale down: 300 (i.e. the stabilization window is 300 seconds long). + // +optional + StabilizationWindowSeconds *int32 `json:"stabilizationWindowSeconds,omitempty" protobuf:"bytes,1,opt,name=stabilizationWindowSeconds"` + Condition Condition `json:"condition,omitempty" protobuf:"bytes,2,opt,name=condition"` + MetricSources []MetricSource `json:"metricSources,omitempty" protobuf:"bytes,3,opt,name=metricSources"` +} + +type MetricSource struct { + // PeriodSeconds specifies the window of time for which the policy should hold true. + // PeriodSeconds must be greater than zero and less than or equal to 1800 (30 min). + PeriodSeconds int32 `json:"periodSeconds,omitempty" protobuf:"bytes,1,opt,name=periodSeconds"` + // Metric identifies the target metric by name and selector + Metric v2.MetricIdentifier `json:"metric,omitempty" protobuf:"bytes,2,opt,name=metric"` + // Target specifies the target value for the given metric + Target v2.MetricTarget `json:"target,omitempty" protobuf:"bytes,3,opt,name=target"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// VerticalQueueAutoscalerList is a collection of vertical queue autoscaler. +type VerticalQueueAutoscalerList struct { + metav1.TypeMeta + // Standard list metadata + // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata + // +optional + metav1.ListMeta + + // items is the list of VerticalQueueAutoscaler + Items []VerticalQueueAutoscaler +} diff --git a/pkg/apis/autoscaling/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/autoscaling/v1alpha1/zz_generated.deepcopy.go new file mode 100644 index 00000000..0348c50f --- /dev/null +++ b/pkg/apis/autoscaling/v1alpha1/zz_generated.deepcopy.go @@ -0,0 +1,389 @@ +//go:build !ignore_autogenerated +// +build !ignore_autogenerated + +/* +Copyright 2021 The Volcano 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 v1alpha1 + +import ( + v1 "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 *MetricRules) DeepCopyInto(out *MetricRules) { + *out = *in + in.ScaleUp.DeepCopyInto(&out.ScaleUp) + in.ScaleDown.DeepCopyInto(&out.ScaleDown) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricRules. +func (in *MetricRules) DeepCopy() *MetricRules { + if in == nil { + return nil + } + out := new(MetricRules) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MetricSource) DeepCopyInto(out *MetricSource) { + *out = *in + in.Metric.DeepCopyInto(&out.Metric) + in.Target.DeepCopyInto(&out.Target) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricSource. +func (in *MetricSource) DeepCopy() *MetricSource { + if in == nil { + return nil + } + out := new(MetricSource) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MetricSpec) DeepCopyInto(out *MetricSpec) { + *out = *in + in.ScaleBehavior.DeepCopyInto(&out.ScaleBehavior) + in.ResourceLimit.DeepCopyInto(&out.ResourceLimit) + in.MetricRules.DeepCopyInto(&out.MetricRules) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetricSpec. +func (in *MetricSpec) DeepCopy() *MetricSpec { + if in == nil { + return nil + } + out := new(MetricSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ResourceLimit) DeepCopyInto(out *ResourceLimit) { + *out = *in + if in.Min != nil { + in, out := &in.Min, &out.Min + *out = make(v1.ResourceList, len(*in)) + for key, val := range *in { + (*out)[key] = val.DeepCopy() + } + } + if in.Max != nil { + in, out := &in.Max, &out.Max + *out = make(v1.ResourceList, len(*in)) + for key, val := range *in { + (*out)[key] = val.DeepCopy() + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceLimit. +func (in *ResourceLimit) DeepCopy() *ResourceLimit { + if in == nil { + return nil + } + out := new(ResourceLimit) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ScaleBehavior) DeepCopyInto(out *ScaleBehavior) { + *out = *in + out.StepRatio = in.StepRatio.DeepCopy() + in.StepResources.DeepCopyInto(&out.StepResources) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScaleBehavior. +func (in *ScaleBehavior) DeepCopy() *ScaleBehavior { + if in == nil { + return nil + } + out := new(ScaleBehavior) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ScaleLimit) DeepCopyInto(out *ScaleLimit) { + *out = *in + out.WeightLimit = in.WeightLimit + in.CapacityLimit.DeepCopyInto(&out.CapacityLimit) + in.GuaranteeLimit.DeepCopyInto(&out.GuaranteeLimit) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScaleLimit. +func (in *ScaleLimit) DeepCopy() *ScaleLimit { + if in == nil { + return nil + } + out := new(ScaleLimit) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *ScaleRule) DeepCopyInto(out *ScaleRule) { + *out = *in + if in.StabilizationWindowSeconds != nil { + in, out := &in.StabilizationWindowSeconds, &out.StabilizationWindowSeconds + *out = new(int32) + **out = **in + } + if in.MetricSources != nil { + in, out := &in.MetricSources, &out.MetricSources + *out = make([]MetricSource, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ScaleRule. +func (in *ScaleRule) DeepCopy() *ScaleRule { + if in == nil { + return nil + } + out := new(ScaleRule) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *StepResources) DeepCopyInto(out *StepResources) { + *out = *in + if in.Capability != nil { + in, out := &in.Capability, &out.Capability + *out = make(v1.ResourceList, len(*in)) + for key, val := range *in { + (*out)[key] = val.DeepCopy() + } + } + if in.Guarantee != nil { + in, out := &in.Guarantee, &out.Guarantee + *out = make(v1.ResourceList, len(*in)) + for key, val := range *in { + (*out)[key] = val.DeepCopy() + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StepResources. +func (in *StepResources) DeepCopy() *StepResources { + if in == nil { + return nil + } + out := new(StepResources) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Tidal) DeepCopyInto(out *Tidal) { + *out = *in + if in.Capability != nil { + in, out := &in.Capability, &out.Capability + *out = make(v1.ResourceList, len(*in)) + for key, val := range *in { + (*out)[key] = val.DeepCopy() + } + } + if in.Guarantee != nil { + in, out := &in.Guarantee, &out.Guarantee + *out = make(v1.ResourceList, len(*in)) + for key, val := range *in { + (*out)[key] = val.DeepCopy() + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Tidal. +func (in *Tidal) DeepCopy() *Tidal { + if in == nil { + return nil + } + out := new(Tidal) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TidalSpec) DeepCopyInto(out *TidalSpec) { + *out = *in + if in.StartingDeadlineSeconds != nil { + in, out := &in.StartingDeadlineSeconds, &out.StartingDeadlineSeconds + *out = new(int64) + **out = **in + } + if in.Tidal != nil { + in, out := &in.Tidal, &out.Tidal + *out = make([]Tidal, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TidalSpec. +func (in *TidalSpec) DeepCopy() *TidalSpec { + if in == nil { + return nil + } + out := new(TidalSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VQASpec) DeepCopyInto(out *VQASpec) { + *out = *in + in.TidalSpec.DeepCopyInto(&out.TidalSpec) + if in.MetricSpec != nil { + in, out := &in.MetricSpec, &out.MetricSpec + *out = make([]MetricSpec, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VQASpec. +func (in *VQASpec) DeepCopy() *VQASpec { + if in == nil { + return nil + } + out := new(VQASpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VQAStatus) DeepCopyInto(out *VQAStatus) { + *out = *in + if in.LastScaleTime != nil { + in, out := &in.LastScaleTime, &out.LastScaleTime + *out = (*in).DeepCopy() + } + if in.LastScaleSuccessTime != nil { + in, out := &in.LastScaleSuccessTime, &out.LastScaleSuccessTime + *out = (*in).DeepCopy() + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VQAStatus. +func (in *VQAStatus) DeepCopy() *VQAStatus { + if in == nil { + return nil + } + out := new(VQAStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *VerticalQueueAutoscaler) DeepCopyInto(out *VerticalQueueAutoscaler) { + *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 VerticalQueueAutoscaler. +func (in *VerticalQueueAutoscaler) DeepCopy() *VerticalQueueAutoscaler { + if in == nil { + return nil + } + out := new(VerticalQueueAutoscaler) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VerticalQueueAutoscaler) 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 *VerticalQueueAutoscalerList) DeepCopyInto(out *VerticalQueueAutoscalerList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]VerticalQueueAutoscaler, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new VerticalQueueAutoscalerList. +func (in *VerticalQueueAutoscalerList) DeepCopy() *VerticalQueueAutoscalerList { + if in == nil { + return nil + } + out := new(VerticalQueueAutoscalerList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *VerticalQueueAutoscalerList) 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 *WeightLimit) DeepCopyInto(out *WeightLimit) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WeightLimit. +func (in *WeightLimit) DeepCopy() *WeightLimit { + if in == nil { + return nil + } + out := new(WeightLimit) + in.DeepCopyInto(out) + return out +} diff --git a/pkg/client/clientset/versioned/clientset.go b/pkg/client/clientset/versioned/clientset.go index 9aa2c31c..bbdb32cb 100644 --- a/pkg/client/clientset/versioned/clientset.go +++ b/pkg/client/clientset/versioned/clientset.go @@ -24,6 +24,7 @@ import ( discovery "k8s.io/client-go/discovery" rest "k8s.io/client-go/rest" flowcontrol "k8s.io/client-go/util/flowcontrol" + autoscalingv1alpha1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1" batchv1alpha1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/batch/v1alpha1" busv1alpha1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/bus/v1alpha1" flowv1alpha1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/flow/v1alpha1" @@ -33,6 +34,7 @@ import ( type Interface interface { Discovery() discovery.DiscoveryInterface + AutoscalingV1alpha1() autoscalingv1alpha1.AutoscalingV1alpha1Interface BatchV1alpha1() batchv1alpha1.BatchV1alpha1Interface BusV1alpha1() busv1alpha1.BusV1alpha1Interface FlowV1alpha1() flowv1alpha1.FlowV1alpha1Interface @@ -44,11 +46,17 @@ type Interface interface { // version included in a Clientset. type Clientset struct { *discovery.DiscoveryClient - batchV1alpha1 *batchv1alpha1.BatchV1alpha1Client - busV1alpha1 *busv1alpha1.BusV1alpha1Client - flowV1alpha1 *flowv1alpha1.FlowV1alpha1Client - nodeinfoV1alpha1 *nodeinfov1alpha1.NodeinfoV1alpha1Client - schedulingV1beta1 *schedulingv1beta1.SchedulingV1beta1Client + autoscalingV1alpha1 *autoscalingv1alpha1.AutoscalingV1alpha1Client + batchV1alpha1 *batchv1alpha1.BatchV1alpha1Client + busV1alpha1 *busv1alpha1.BusV1alpha1Client + flowV1alpha1 *flowv1alpha1.FlowV1alpha1Client + nodeinfoV1alpha1 *nodeinfov1alpha1.NodeinfoV1alpha1Client + schedulingV1beta1 *schedulingv1beta1.SchedulingV1beta1Client +} + +// AutoscalingV1alpha1 retrieves the AutoscalingV1alpha1Client +func (c *Clientset) AutoscalingV1alpha1() autoscalingv1alpha1.AutoscalingV1alpha1Interface { + return c.autoscalingV1alpha1 } // BatchV1alpha1 retrieves the BatchV1alpha1Client @@ -116,6 +124,10 @@ func NewForConfigAndClient(c *rest.Config, httpClient *http.Client) (*Clientset, var cs Clientset var err error + cs.autoscalingV1alpha1, err = autoscalingv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) + if err != nil { + return nil, err + } cs.batchV1alpha1, err = batchv1alpha1.NewForConfigAndClient(&configShallowCopy, httpClient) if err != nil { return nil, err @@ -157,6 +169,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.autoscalingV1alpha1 = autoscalingv1alpha1.New(c) cs.batchV1alpha1 = batchv1alpha1.New(c) cs.busV1alpha1 = busv1alpha1.New(c) cs.flowV1alpha1 = flowv1alpha1.New(c) diff --git a/pkg/client/clientset/versioned/fake/clientset_generated.go b/pkg/client/clientset/versioned/fake/clientset_generated.go index 87a67dbe..7ccdb47e 100644 --- a/pkg/client/clientset/versioned/fake/clientset_generated.go +++ b/pkg/client/clientset/versioned/fake/clientset_generated.go @@ -24,6 +24,8 @@ import ( fakediscovery "k8s.io/client-go/discovery/fake" "k8s.io/client-go/testing" clientset "volcano.sh/apis/pkg/client/clientset/versioned" + autoscalingv1alpha1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1" + fakeautoscalingv1alpha1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/fake" batchv1alpha1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/batch/v1alpha1" fakebatchv1alpha1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/batch/v1alpha1/fake" busv1alpha1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/bus/v1alpha1" @@ -86,6 +88,11 @@ var ( _ testing.FakeClient = &Clientset{} ) +// AutoscalingV1alpha1 retrieves the AutoscalingV1alpha1Client +func (c *Clientset) AutoscalingV1alpha1() autoscalingv1alpha1.AutoscalingV1alpha1Interface { + return &fakeautoscalingv1alpha1.FakeAutoscalingV1alpha1{Fake: &c.Fake} +} + // BatchV1alpha1 retrieves the BatchV1alpha1Client func (c *Clientset) BatchV1alpha1() batchv1alpha1.BatchV1alpha1Interface { return &fakebatchv1alpha1.FakeBatchV1alpha1{Fake: &c.Fake} diff --git a/pkg/client/clientset/versioned/fake/register.go b/pkg/client/clientset/versioned/fake/register.go index 8a5ae87a..9e18ca6c 100644 --- a/pkg/client/clientset/versioned/fake/register.go +++ b/pkg/client/clientset/versioned/fake/register.go @@ -23,6 +23,7 @@ import ( schema "k8s.io/apimachinery/pkg/runtime/schema" serializer "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" + autoscalingv1alpha1 "volcano.sh/apis/pkg/apis/autoscaling/v1alpha1" batchv1alpha1 "volcano.sh/apis/pkg/apis/batch/v1alpha1" busv1alpha1 "volcano.sh/apis/pkg/apis/bus/v1alpha1" flowv1alpha1 "volcano.sh/apis/pkg/apis/flow/v1alpha1" @@ -34,6 +35,7 @@ var scheme = runtime.NewScheme() var codecs = serializer.NewCodecFactory(scheme) var localSchemeBuilder = runtime.SchemeBuilder{ + autoscalingv1alpha1.AddToScheme, batchv1alpha1.AddToScheme, busv1alpha1.AddToScheme, flowv1alpha1.AddToScheme, @@ -44,14 +46,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{ // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) // -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. diff --git a/pkg/client/clientset/versioned/scheme/register.go b/pkg/client/clientset/versioned/scheme/register.go index d90320b6..58b278ea 100644 --- a/pkg/client/clientset/versioned/scheme/register.go +++ b/pkg/client/clientset/versioned/scheme/register.go @@ -23,6 +23,7 @@ import ( schema "k8s.io/apimachinery/pkg/runtime/schema" serializer "k8s.io/apimachinery/pkg/runtime/serializer" utilruntime "k8s.io/apimachinery/pkg/util/runtime" + autoscalingv1alpha1 "volcano.sh/apis/pkg/apis/autoscaling/v1alpha1" batchv1alpha1 "volcano.sh/apis/pkg/apis/batch/v1alpha1" busv1alpha1 "volcano.sh/apis/pkg/apis/bus/v1alpha1" flowv1alpha1 "volcano.sh/apis/pkg/apis/flow/v1alpha1" @@ -34,6 +35,7 @@ var Scheme = runtime.NewScheme() var Codecs = serializer.NewCodecFactory(Scheme) var ParameterCodec = runtime.NewParameterCodec(Scheme) var localSchemeBuilder = runtime.SchemeBuilder{ + autoscalingv1alpha1.AddToScheme, batchv1alpha1.AddToScheme, busv1alpha1.AddToScheme, flowv1alpha1.AddToScheme, @@ -44,14 +46,14 @@ var localSchemeBuilder = runtime.SchemeBuilder{ // AddToScheme adds all types of this clientset into the given scheme. This allows composition // of clientsets, like in: // -// import ( -// "k8s.io/client-go/kubernetes" -// clientsetscheme "k8s.io/client-go/kubernetes/scheme" -// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" -// ) +// import ( +// "k8s.io/client-go/kubernetes" +// clientsetscheme "k8s.io/client-go/kubernetes/scheme" +// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme" +// ) // -// kclientset, _ := kubernetes.NewForConfig(c) -// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) +// kclientset, _ := kubernetes.NewForConfig(c) +// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme) // // After this, RawExtensions in Kubernetes types will serialize kube-aggregator types // correctly. diff --git a/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/autoscaling_client.go b/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/autoscaling_client.go new file mode 100644 index 00000000..0464afb4 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/autoscaling_client.go @@ -0,0 +1,106 @@ +/* +Copyright 2021 The Volcano 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 v1alpha1 + +import ( + "net/http" + + rest "k8s.io/client-go/rest" + v1alpha1 "volcano.sh/apis/pkg/apis/autoscaling/v1alpha1" + "volcano.sh/apis/pkg/client/clientset/versioned/scheme" +) + +type AutoscalingV1alpha1Interface interface { + RESTClient() rest.Interface + VerticalQueueAutoscalersGetter +} + +// AutoscalingV1alpha1Client is used to interact with features provided by the autoscaling.volcano.sh group. +type AutoscalingV1alpha1Client struct { + restClient rest.Interface +} + +func (c *AutoscalingV1alpha1Client) VerticalQueueAutoscalers() VerticalQueueAutoscalerInterface { + return newVerticalQueueAutoscalers(c) +} + +// NewForConfig creates a new AutoscalingV1alpha1Client for the given config. +// NewForConfig is equivalent to NewForConfigAndClient(c, httpClient), +// where httpClient was generated with rest.HTTPClientFor(c). +func NewForConfig(c *rest.Config) (*AutoscalingV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + httpClient, err := rest.HTTPClientFor(&config) + if err != nil { + return nil, err + } + return NewForConfigAndClient(&config, httpClient) +} + +// NewForConfigAndClient creates a new AutoscalingV1alpha1Client for the given config and http client. +// Note the http client provided takes precedence over the configured transport values. +func NewForConfigAndClient(c *rest.Config, h *http.Client) (*AutoscalingV1alpha1Client, error) { + config := *c + if err := setConfigDefaults(&config); err != nil { + return nil, err + } + client, err := rest.RESTClientForConfigAndClient(&config, h) + if err != nil { + return nil, err + } + return &AutoscalingV1alpha1Client{client}, nil +} + +// NewForConfigOrDie creates a new AutoscalingV1alpha1Client for the given config and +// panics if there is an error in the config. +func NewForConfigOrDie(c *rest.Config) *AutoscalingV1alpha1Client { + client, err := NewForConfig(c) + if err != nil { + panic(err) + } + return client +} + +// New creates a new AutoscalingV1alpha1Client for the given RESTClient. +func New(c rest.Interface) *AutoscalingV1alpha1Client { + return &AutoscalingV1alpha1Client{c} +} + +func setConfigDefaults(config *rest.Config) error { + gv := v1alpha1.SchemeGroupVersion + config.GroupVersion = &gv + config.APIPath = "/apis" + config.NegotiatedSerializer = scheme.Codecs.WithoutConversion() + + 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 *AutoscalingV1alpha1Client) RESTClient() rest.Interface { + if c == nil { + return nil + } + return c.restClient +} diff --git a/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/doc.go b/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/doc.go new file mode 100644 index 00000000..e49de87c --- /dev/null +++ b/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2021 The Volcano 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 v1alpha1 diff --git a/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/fake/doc.go b/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/fake/doc.go new file mode 100644 index 00000000..3bc0494e --- /dev/null +++ b/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/fake/doc.go @@ -0,0 +1,19 @@ +/* +Copyright 2021 The Volcano 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/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/fake/fake_autoscaling_client.go b/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/fake/fake_autoscaling_client.go new file mode 100644 index 00000000..09f679bf --- /dev/null +++ b/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/fake/fake_autoscaling_client.go @@ -0,0 +1,39 @@ +/* +Copyright 2021 The Volcano 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 ( + rest "k8s.io/client-go/rest" + testing "k8s.io/client-go/testing" + v1alpha1 "volcano.sh/apis/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1" +) + +type FakeAutoscalingV1alpha1 struct { + *testing.Fake +} + +func (c *FakeAutoscalingV1alpha1) VerticalQueueAutoscalers() v1alpha1.VerticalQueueAutoscalerInterface { + return &FakeVerticalQueueAutoscalers{c} +} + +// RESTClient returns a RESTClient that is used to communicate +// with API server by this client implementation. +func (c *FakeAutoscalingV1alpha1) RESTClient() rest.Interface { + var ret *rest.RESTClient + return ret +} diff --git a/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/fake/fake_verticalqueueautoscaler.go b/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/fake/fake_verticalqueueautoscaler.go new file mode 100644 index 00000000..ce154a64 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/fake/fake_verticalqueueautoscaler.go @@ -0,0 +1,132 @@ +/* +Copyright 2021 The Volcano 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 ( + "context" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + schema "k8s.io/apimachinery/pkg/runtime/schema" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" + v1alpha1 "volcano.sh/apis/pkg/apis/autoscaling/v1alpha1" +) + +// FakeVerticalQueueAutoscalers implements VerticalQueueAutoscalerInterface +type FakeVerticalQueueAutoscalers struct { + Fake *FakeAutoscalingV1alpha1 +} + +var verticalqueueautoscalersResource = schema.GroupVersionResource{Group: "autoscaling.volcano.sh", Version: "v1alpha1", Resource: "verticalqueueautoscalers"} + +var verticalqueueautoscalersKind = schema.GroupVersionKind{Group: "autoscaling.volcano.sh", Version: "v1alpha1", Kind: "VerticalQueueAutoscaler"} + +// Get takes name of the verticalQueueAutoscaler, and returns the corresponding verticalQueueAutoscaler object, and an error if there is any. +func (c *FakeVerticalQueueAutoscalers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VerticalQueueAutoscaler, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(verticalqueueautoscalersResource, name), &v1alpha1.VerticalQueueAutoscaler{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VerticalQueueAutoscaler), err +} + +// List takes label and field selectors, and returns the list of VerticalQueueAutoscalers that match those selectors. +func (c *FakeVerticalQueueAutoscalers) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VerticalQueueAutoscalerList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(verticalqueueautoscalersResource, verticalqueueautoscalersKind, opts), &v1alpha1.VerticalQueueAutoscalerList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.VerticalQueueAutoscalerList{ListMeta: obj.(*v1alpha1.VerticalQueueAutoscalerList).ListMeta} + for _, item := range obj.(*v1alpha1.VerticalQueueAutoscalerList).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 verticalQueueAutoscalers. +func (c *FakeVerticalQueueAutoscalers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(verticalqueueautoscalersResource, opts)) +} + +// Create takes the representation of a verticalQueueAutoscaler and creates it. Returns the server's representation of the verticalQueueAutoscaler, and an error, if there is any. +func (c *FakeVerticalQueueAutoscalers) Create(ctx context.Context, verticalQueueAutoscaler *v1alpha1.VerticalQueueAutoscaler, opts v1.CreateOptions) (result *v1alpha1.VerticalQueueAutoscaler, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(verticalqueueautoscalersResource, verticalQueueAutoscaler), &v1alpha1.VerticalQueueAutoscaler{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VerticalQueueAutoscaler), err +} + +// Update takes the representation of a verticalQueueAutoscaler and updates it. Returns the server's representation of the verticalQueueAutoscaler, and an error, if there is any. +func (c *FakeVerticalQueueAutoscalers) Update(ctx context.Context, verticalQueueAutoscaler *v1alpha1.VerticalQueueAutoscaler, opts v1.UpdateOptions) (result *v1alpha1.VerticalQueueAutoscaler, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(verticalqueueautoscalersResource, verticalQueueAutoscaler), &v1alpha1.VerticalQueueAutoscaler{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VerticalQueueAutoscaler), 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 *FakeVerticalQueueAutoscalers) UpdateStatus(ctx context.Context, verticalQueueAutoscaler *v1alpha1.VerticalQueueAutoscaler, opts v1.UpdateOptions) (*v1alpha1.VerticalQueueAutoscaler, error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateSubresourceAction(verticalqueueautoscalersResource, "status", verticalQueueAutoscaler), &v1alpha1.VerticalQueueAutoscaler{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VerticalQueueAutoscaler), err +} + +// Delete takes name of the verticalQueueAutoscaler and deletes it. Returns an error if one occurs. +func (c *FakeVerticalQueueAutoscalers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(verticalqueueautoscalersResource, name, opts), &v1alpha1.VerticalQueueAutoscaler{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeVerticalQueueAutoscalers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(verticalqueueautoscalersResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.VerticalQueueAutoscalerList{}) + return err +} + +// Patch applies the patch and returns the patched verticalQueueAutoscaler. +func (c *FakeVerticalQueueAutoscalers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VerticalQueueAutoscaler, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(verticalqueueautoscalersResource, name, pt, data, subresources...), &v1alpha1.VerticalQueueAutoscaler{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.VerticalQueueAutoscaler), err +} diff --git a/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/generated_expansion.go b/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/generated_expansion.go new file mode 100644 index 00000000..fe88ef95 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/generated_expansion.go @@ -0,0 +1,20 @@ +/* +Copyright 2021 The Volcano 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 v1alpha1 + +type VerticalQueueAutoscalerExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/verticalqueueautoscaler.go b/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/verticalqueueautoscaler.go new file mode 100644 index 00000000..528c93f1 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/autoscaling/v1alpha1/verticalqueueautoscaler.go @@ -0,0 +1,183 @@ +/* +Copyright 2021 The Volcano 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 v1alpha1 + +import ( + "context" + "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + rest "k8s.io/client-go/rest" + v1alpha1 "volcano.sh/apis/pkg/apis/autoscaling/v1alpha1" + scheme "volcano.sh/apis/pkg/client/clientset/versioned/scheme" +) + +// VerticalQueueAutoscalersGetter has a method to return a VerticalQueueAutoscalerInterface. +// A group's client should implement this interface. +type VerticalQueueAutoscalersGetter interface { + VerticalQueueAutoscalers() VerticalQueueAutoscalerInterface +} + +// VerticalQueueAutoscalerInterface has methods to work with VerticalQueueAutoscaler resources. +type VerticalQueueAutoscalerInterface interface { + Create(ctx context.Context, verticalQueueAutoscaler *v1alpha1.VerticalQueueAutoscaler, opts v1.CreateOptions) (*v1alpha1.VerticalQueueAutoscaler, error) + Update(ctx context.Context, verticalQueueAutoscaler *v1alpha1.VerticalQueueAutoscaler, opts v1.UpdateOptions) (*v1alpha1.VerticalQueueAutoscaler, error) + UpdateStatus(ctx context.Context, verticalQueueAutoscaler *v1alpha1.VerticalQueueAutoscaler, opts v1.UpdateOptions) (*v1alpha1.VerticalQueueAutoscaler, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*v1alpha1.VerticalQueueAutoscaler, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.VerticalQueueAutoscalerList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VerticalQueueAutoscaler, err error) + VerticalQueueAutoscalerExpansion +} + +// verticalQueueAutoscalers implements VerticalQueueAutoscalerInterface +type verticalQueueAutoscalers struct { + client rest.Interface +} + +// newVerticalQueueAutoscalers returns a VerticalQueueAutoscalers +func newVerticalQueueAutoscalers(c *AutoscalingV1alpha1Client) *verticalQueueAutoscalers { + return &verticalQueueAutoscalers{ + client: c.RESTClient(), + } +} + +// Get takes name of the verticalQueueAutoscaler, and returns the corresponding verticalQueueAutoscaler object, and an error if there is any. +func (c *verticalQueueAutoscalers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.VerticalQueueAutoscaler, err error) { + result = &v1alpha1.VerticalQueueAutoscaler{} + err = c.client.Get(). + Resource("verticalqueueautoscalers"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of VerticalQueueAutoscalers that match those selectors. +func (c *verticalQueueAutoscalers) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.VerticalQueueAutoscalerList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.VerticalQueueAutoscalerList{} + err = c.client.Get(). + Resource("verticalqueueautoscalers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested verticalQueueAutoscalers. +func (c *verticalQueueAutoscalers) Watch(ctx context.Context, opts v1.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(). + Resource("verticalqueueautoscalers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a verticalQueueAutoscaler and creates it. Returns the server's representation of the verticalQueueAutoscaler, and an error, if there is any. +func (c *verticalQueueAutoscalers) Create(ctx context.Context, verticalQueueAutoscaler *v1alpha1.VerticalQueueAutoscaler, opts v1.CreateOptions) (result *v1alpha1.VerticalQueueAutoscaler, err error) { + result = &v1alpha1.VerticalQueueAutoscaler{} + err = c.client.Post(). + Resource("verticalqueueautoscalers"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(verticalQueueAutoscaler). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a verticalQueueAutoscaler and updates it. Returns the server's representation of the verticalQueueAutoscaler, and an error, if there is any. +func (c *verticalQueueAutoscalers) Update(ctx context.Context, verticalQueueAutoscaler *v1alpha1.VerticalQueueAutoscaler, opts v1.UpdateOptions) (result *v1alpha1.VerticalQueueAutoscaler, err error) { + result = &v1alpha1.VerticalQueueAutoscaler{} + err = c.client.Put(). + Resource("verticalqueueautoscalers"). + Name(verticalQueueAutoscaler.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(verticalQueueAutoscaler). + Do(ctx). + 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 *verticalQueueAutoscalers) UpdateStatus(ctx context.Context, verticalQueueAutoscaler *v1alpha1.VerticalQueueAutoscaler, opts v1.UpdateOptions) (result *v1alpha1.VerticalQueueAutoscaler, err error) { + result = &v1alpha1.VerticalQueueAutoscaler{} + err = c.client.Put(). + Resource("verticalqueueautoscalers"). + Name(verticalQueueAutoscaler.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(verticalQueueAutoscaler). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the verticalQueueAutoscaler and deletes it. Returns an error if one occurs. +func (c *verticalQueueAutoscalers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("verticalqueueautoscalers"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *verticalQueueAutoscalers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + var timeout time.Duration + if listOpts.TimeoutSeconds != nil { + timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second + } + return c.client.Delete(). + Resource("verticalqueueautoscalers"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched verticalQueueAutoscaler. +func (c *verticalQueueAutoscalers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.VerticalQueueAutoscaler, err error) { + result = &v1alpha1.VerticalQueueAutoscaler{} + err = c.client.Patch(pt). + Resource("verticalqueueautoscalers"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/pkg/client/informers/externalversions/autoscaling/interface.go b/pkg/client/informers/externalversions/autoscaling/interface.go new file mode 100644 index 00000000..759b1dde --- /dev/null +++ b/pkg/client/informers/externalversions/autoscaling/interface.go @@ -0,0 +1,45 @@ +/* +Copyright 2021 The Volcano 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 autoscaling + +import ( + v1alpha1 "volcano.sh/apis/pkg/client/informers/externalversions/autoscaling/v1alpha1" + internalinterfaces "volcano.sh/apis/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to each of this group's versions. +type Interface interface { + // V1alpha1 provides access to shared informers for resources in V1alpha1. + V1alpha1() v1alpha1.Interface +} + +type group 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 &group{factory: f, namespace: namespace, tweakListOptions: tweakListOptions} +} + +// V1alpha1 returns a new v1alpha1.Interface. +func (g *group) V1alpha1() v1alpha1.Interface { + return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions) +} diff --git a/pkg/client/informers/externalversions/autoscaling/v1alpha1/interface.go b/pkg/client/informers/externalversions/autoscaling/v1alpha1/interface.go new file mode 100644 index 00000000..771ee7ae --- /dev/null +++ b/pkg/client/informers/externalversions/autoscaling/v1alpha1/interface.go @@ -0,0 +1,44 @@ +/* +Copyright 2021 The Volcano 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 v1alpha1 + +import ( + internalinterfaces "volcano.sh/apis/pkg/client/informers/externalversions/internalinterfaces" +) + +// Interface provides access to all the informers in this group version. +type Interface interface { + // VerticalQueueAutoscalers returns a VerticalQueueAutoscalerInformer. + VerticalQueueAutoscalers() VerticalQueueAutoscalerInformer +} + +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} +} + +// VerticalQueueAutoscalers returns a VerticalQueueAutoscalerInformer. +func (v *version) VerticalQueueAutoscalers() VerticalQueueAutoscalerInformer { + return &verticalQueueAutoscalerInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} diff --git a/pkg/client/informers/externalversions/autoscaling/v1alpha1/verticalqueueautoscaler.go b/pkg/client/informers/externalversions/autoscaling/v1alpha1/verticalqueueautoscaler.go new file mode 100644 index 00000000..f33b8224 --- /dev/null +++ b/pkg/client/informers/externalversions/autoscaling/v1alpha1/verticalqueueautoscaler.go @@ -0,0 +1,88 @@ +/* +Copyright 2021 The Volcano 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 v1alpha1 + +import ( + "context" + time "time" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" + autoscalingv1alpha1 "volcano.sh/apis/pkg/apis/autoscaling/v1alpha1" + versioned "volcano.sh/apis/pkg/client/clientset/versioned" + internalinterfaces "volcano.sh/apis/pkg/client/informers/externalversions/internalinterfaces" + v1alpha1 "volcano.sh/apis/pkg/client/listers/autoscaling/v1alpha1" +) + +// VerticalQueueAutoscalerInformer provides access to a shared informer and lister for +// VerticalQueueAutoscalers. +type VerticalQueueAutoscalerInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.VerticalQueueAutoscalerLister +} + +type verticalQueueAutoscalerInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewVerticalQueueAutoscalerInformer constructs a new informer for VerticalQueueAutoscaler 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 NewVerticalQueueAutoscalerInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredVerticalQueueAutoscalerInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredVerticalQueueAutoscalerInformer constructs a new informer for VerticalQueueAutoscaler 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 NewFilteredVerticalQueueAutoscalerInformer(client versioned.Interface, 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.AutoscalingV1alpha1().VerticalQueueAutoscalers().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV1alpha1().VerticalQueueAutoscalers().Watch(context.TODO(), options) + }, + }, + &autoscalingv1alpha1.VerticalQueueAutoscaler{}, + resyncPeriod, + indexers, + ) +} + +func (f *verticalQueueAutoscalerInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredVerticalQueueAutoscalerInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *verticalQueueAutoscalerInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&autoscalingv1alpha1.VerticalQueueAutoscaler{}, f.defaultInformer) +} + +func (f *verticalQueueAutoscalerInformer) Lister() v1alpha1.VerticalQueueAutoscalerLister { + return v1alpha1.NewVerticalQueueAutoscalerLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/informers/externalversions/factory.go b/pkg/client/informers/externalversions/factory.go index 05dc6a0a..7ffbe1c4 100644 --- a/pkg/client/informers/externalversions/factory.go +++ b/pkg/client/informers/externalversions/factory.go @@ -27,6 +27,7 @@ import ( schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" versioned "volcano.sh/apis/pkg/client/clientset/versioned" + autoscaling "volcano.sh/apis/pkg/client/informers/externalversions/autoscaling" batch "volcano.sh/apis/pkg/client/informers/externalversions/batch" bus "volcano.sh/apis/pkg/client/informers/externalversions/bus" flow "volcano.sh/apis/pkg/client/informers/externalversions/flow" @@ -175,6 +176,7 @@ type SharedInformerFactory interface { ForResource(resource schema.GroupVersionResource) (GenericInformer, error) WaitForCacheSync(stopCh <-chan struct{}) map[reflect.Type]bool + Autoscaling() autoscaling.Interface Batch() batch.Interface Bus() bus.Interface Flow() flow.Interface @@ -182,6 +184,10 @@ type SharedInformerFactory interface { Scheduling() scheduling.Interface } +func (f *sharedInformerFactory) Autoscaling() autoscaling.Interface { + return autoscaling.New(f, f.namespace, f.tweakListOptions) +} + func (f *sharedInformerFactory) Batch() batch.Interface { return batch.New(f, f.namespace, f.tweakListOptions) } diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 1021deb1..1fecbaa2 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -22,7 +22,8 @@ import ( schema "k8s.io/apimachinery/pkg/runtime/schema" cache "k8s.io/client-go/tools/cache" - v1alpha1 "volcano.sh/apis/pkg/apis/batch/v1alpha1" + v1alpha1 "volcano.sh/apis/pkg/apis/autoscaling/v1alpha1" + batchv1alpha1 "volcano.sh/apis/pkg/apis/batch/v1alpha1" busv1alpha1 "volcano.sh/apis/pkg/apis/bus/v1alpha1" flowv1alpha1 "volcano.sh/apis/pkg/apis/flow/v1alpha1" nodeinfov1alpha1 "volcano.sh/apis/pkg/apis/nodeinfo/v1alpha1" @@ -55,8 +56,12 @@ 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=batch.volcano.sh, Version=v1alpha1 - case v1alpha1.SchemeGroupVersion.WithResource("jobs"): + // Group=autoscaling.volcano.sh, Version=v1alpha1 + case v1alpha1.SchemeGroupVersion.WithResource("verticalqueueautoscalers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V1alpha1().VerticalQueueAutoscalers().Informer()}, nil + + // Group=batch.volcano.sh, Version=v1alpha1 + case batchv1alpha1.SchemeGroupVersion.WithResource("jobs"): return &genericInformer{resource: resource.GroupResource(), informer: f.Batch().V1alpha1().Jobs().Informer()}, nil // Group=bus.volcano.sh, Version=v1alpha1 diff --git a/pkg/client/listers/autoscaling/v1alpha1/expansion_generated.go b/pkg/client/listers/autoscaling/v1alpha1/expansion_generated.go new file mode 100644 index 00000000..4dcfe27f --- /dev/null +++ b/pkg/client/listers/autoscaling/v1alpha1/expansion_generated.go @@ -0,0 +1,22 @@ +/* +Copyright 2021 The Volcano 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 v1alpha1 + +// VerticalQueueAutoscalerListerExpansion allows custom methods to be added to +// VerticalQueueAutoscalerLister. +type VerticalQueueAutoscalerListerExpansion interface{} diff --git a/pkg/client/listers/autoscaling/v1alpha1/verticalqueueautoscaler.go b/pkg/client/listers/autoscaling/v1alpha1/verticalqueueautoscaler.go new file mode 100644 index 00000000..3af5d49c --- /dev/null +++ b/pkg/client/listers/autoscaling/v1alpha1/verticalqueueautoscaler.go @@ -0,0 +1,67 @@ +/* +Copyright 2021 The Volcano 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 v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" + v1alpha1 "volcano.sh/apis/pkg/apis/autoscaling/v1alpha1" +) + +// VerticalQueueAutoscalerLister helps list VerticalQueueAutoscalers. +// All objects returned here must be treated as read-only. +type VerticalQueueAutoscalerLister interface { + // List lists all VerticalQueueAutoscalers in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.VerticalQueueAutoscaler, err error) + // Get retrieves the VerticalQueueAutoscaler from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.VerticalQueueAutoscaler, error) + VerticalQueueAutoscalerListerExpansion +} + +// verticalQueueAutoscalerLister implements the VerticalQueueAutoscalerLister interface. +type verticalQueueAutoscalerLister struct { + indexer cache.Indexer +} + +// NewVerticalQueueAutoscalerLister returns a new VerticalQueueAutoscalerLister. +func NewVerticalQueueAutoscalerLister(indexer cache.Indexer) VerticalQueueAutoscalerLister { + return &verticalQueueAutoscalerLister{indexer: indexer} +} + +// List lists all VerticalQueueAutoscalers in the indexer. +func (s *verticalQueueAutoscalerLister) List(selector labels.Selector) (ret []*v1alpha1.VerticalQueueAutoscaler, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.VerticalQueueAutoscaler)) + }) + return ret, err +} + +// Get retrieves the VerticalQueueAutoscaler from the index for a given name. +func (s *verticalQueueAutoscalerLister) Get(name string) (*v1alpha1.VerticalQueueAutoscaler, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("verticalqueueautoscaler"), name) + } + return obj.(*v1alpha1.VerticalQueueAutoscaler), nil +}