diff --git a/apis/autoscaling/v1alpha1/kafka_helpers.go b/apis/autoscaling/v1alpha1/kafka_helpers.go new file mode 100644 index 0000000000..8599f274ab --- /dev/null +++ b/apis/autoscaling/v1alpha1/kafka_helpers.go @@ -0,0 +1,67 @@ +/* +Copyright AppsCode Inc. and Contributors + +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 ( + "fmt" + + "kubedb.dev/apimachinery/apis" + "kubedb.dev/apimachinery/apis/autoscaling" + "kubedb.dev/apimachinery/crds" + + "kmodules.xyz/client-go/apiextensions" +) + +func (_ *KafkaAutoscaler) CustomResourceDefinition() *apiextensions.CustomResourceDefinition { + return crds.MustCustomResourceDefinition(SchemeGroupVersion.WithResource(ResourcePluralKafkaAutoscaler)) +} + +var _ apis.ResourceInfo = &KafkaAutoscaler{} + +func (k *KafkaAutoscaler) ResourceFQN() string { + return fmt.Sprintf("%s.%s", ResourcePluralKafkaAutoscaler, autoscaling.GroupName) +} + +func (k *KafkaAutoscaler) ResourceShortCode() string { + return ResourceCodeKafkaAutoscaler +} + +func (k *KafkaAutoscaler) ResourceKind() string { + return ResourceKindKafkaAutoscaler +} + +func (k *KafkaAutoscaler) ResourceSingular() string { + return ResourceSingularKafkaAutoscaler +} + +func (k *KafkaAutoscaler) ResourcePlural() string { + return ResourcePluralKafkaAutoscaler +} + +func (k *KafkaAutoscaler) ValidateSpecs() error { + return nil +} + +var _ StatusAccessor = &KafkaAutoscaler{} + +func (k *KafkaAutoscaler) GetStatus() AutoscalerStatus { + return k.Status +} + +func (k *KafkaAutoscaler) SetStatus(s AutoscalerStatus) { + k.Status = s +} diff --git a/apis/autoscaling/v1alpha1/kafka_types.go b/apis/autoscaling/v1alpha1/kafka_types.go new file mode 100644 index 0000000000..08c53d78f0 --- /dev/null +++ b/apis/autoscaling/v1alpha1/kafka_types.go @@ -0,0 +1,104 @@ +/* +Copyright AppsCode Inc. and Contributors + +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 ( + opsapi "kubedb.dev/apimachinery/apis/ops/v1alpha1" + + core "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + ResourceCodeKafkaAutoscaler = "kfscaler" + ResourceKindKafkaAutoscaler = "KafkaAutoscaler" + ResourceSingularKafkaAutoscaler = "kafkaautoscaler" + ResourcePluralKafkaAutoscaler = "kafkaautoscalers" +) + +// KafkaAutoscaler is the configuration for a kafka +// autoscaler, which automatically manages pod resources based on historical and +// real time resource utilization. + +// +genclient +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=kafkaautoscalers,singular=kafkaautoscaler,shortName=kfscaler,categories={datastore,kubedb,appscode} +// +kubebuilder:subresource:status +type KafkaAutoscaler 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"` + + // Specification of the behavior of the autoscaler. + // More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status. + Spec KafkaAutoscalerSpec `json:"spec"` + + // Current information about the autoscaler. + // +optional + Status AutoscalerStatus `json:"status,omitempty"` +} + +// KafkaAutoscalerSpec is the specification of the behavior of the autoscaler. +type KafkaAutoscalerSpec struct { + DatabaseRef *core.LocalObjectReference `json:"databaseRef"` + + // This field will be used to control the behaviour of ops-manager + OpsRequestOptions *KafkaOpsRequestOptions `json:"opsRequestOptions,omitempty"` + + Compute *KafkaComputeAutoscalerSpec `json:"compute,omitempty"` + Storage *KafkaStorageAutoscalerSpec `json:"storage,omitempty"` +} + +type KafkaComputeAutoscalerSpec struct { + // +optional + NodeTopology *NodeTopology `json:"nodeTopology,omitempty"` + + Node *ComputeAutoscalerSpec `json:"node,omitempty"` + Broker *ComputeAutoscalerSpec `json:"broker,omitempty"` + Controller *ComputeAutoscalerSpec `json:"controller,omitempty"` +} + +type KafkaStorageAutoscalerSpec struct { + Node *StorageAutoscalerSpec `json:"node,omitempty"` + Broker *StorageAutoscalerSpec `json:"broker,omitempty"` + Controller *StorageAutoscalerSpec `json:"controller,omitempty"` +} + +type KafkaOpsRequestOptions struct { + // Timeout for each step of the ops request in second. If a step doesn't finish within the specified timeout, the ops request will result in failure. + Timeout *metav1.Duration `json:"timeout,omitempty"` + + // ApplyOption is to control the execution of OpsRequest depending on the database state. + // +kubebuilder:default="IfReady" + Apply opsapi.ApplyOption `json:"apply,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// KafkaAutoscalerList is a list of KafkaAutoscaler objects. +type KafkaAutoscalerList struct { + metav1.TypeMeta `json:",inline"` + // metadata is the standard list metadata. + // +optional + metav1.ListMeta `json:"metadata"` + + // items is the list of kafka autoscaler objects. + Items []KafkaAutoscaler `json:"items"` +} diff --git a/apis/autoscaling/v1alpha1/kafka_webhook.go b/apis/autoscaling/v1alpha1/kafka_webhook.go new file mode 100644 index 0000000000..7d9de6a245 --- /dev/null +++ b/apis/autoscaling/v1alpha1/kafka_webhook.go @@ -0,0 +1,153 @@ +/* +Copyright AppsCode Inc. and Contributors + +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 ( + "context" + "errors" + "fmt" + + dbapi "kubedb.dev/apimachinery/apis/kubedb/v1alpha2" + opsapi "kubedb.dev/apimachinery/apis/ops/v1alpha1" + + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/types" + logf "sigs.k8s.io/controller-runtime/pkg/log" + "sigs.k8s.io/controller-runtime/pkg/webhook" + "sigs.k8s.io/controller-runtime/pkg/webhook/admission" +) + +// log is for logging in this package. +var kafkaLog = logf.Log.WithName("kafka-autoscaler") + +var _ webhook.Defaulter = &KafkaAutoscaler{} + +// Default implements webhook.CustomDefaulter so a webhook will be registered for the type +func (k *KafkaAutoscaler) Default() { + kafkaLog.Info("defaulting", "name", k.Name) + k.setDefaults() +} + +func (k *KafkaAutoscaler) setDefaults() { + var db dbapi.Kafka + err := DefaultClient.Get(context.TODO(), types.NamespacedName{ + Name: k.Spec.DatabaseRef.Name, + Namespace: k.Namespace, + }, &db) + if err != nil { + _ = fmt.Errorf("can't get Kafka %s/%s \n", k.Namespace, k.Spec.DatabaseRef.Name) + return + } + + k.setOpsReqOptsDefaults() + + if k.Spec.Storage != nil { + if db.Spec.Topology != nil { + setDefaultStorageValues(k.Spec.Storage.Broker) + setDefaultStorageValues(k.Spec.Storage.Controller) + } else { + setDefaultStorageValues(k.Spec.Storage.Node) + } + } + + if k.Spec.Compute != nil { + if db.Spec.Topology != nil { + setDefaultComputeValues(k.Spec.Compute.Broker) + setDefaultComputeValues(k.Spec.Compute.Controller) + } else { + setDefaultComputeValues(k.Spec.Compute.Node) + } + } +} + +func (k *KafkaAutoscaler) setOpsReqOptsDefaults() { + if k.Spec.OpsRequestOptions == nil { + k.Spec.OpsRequestOptions = &KafkaOpsRequestOptions{} + } + // Timeout is defaulted to 600s in ops-manager retries.go (to retry 120 times with 5sec pause between each) + // OplogMaxLagSeconds & ObjectsCountDiffPercentage are defaults to 0 + if k.Spec.OpsRequestOptions.Apply == "" { + k.Spec.OpsRequestOptions.Apply = opsapi.ApplyOptionIfReady + } +} + +var _ webhook.Validator = &KafkaAutoscaler{} + +// ValidateCreate implements webhook.Validator so a webhook will be registered for the type +func (k *KafkaAutoscaler) ValidateCreate() (admission.Warnings, error) { + kafkaLog.Info("validate create", "name", k.Name) + return nil, k.validate() +} + +// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type +func (k *KafkaAutoscaler) ValidateUpdate(oldObj runtime.Object) (admission.Warnings, error) { + kafkaLog.Info("validate create", "name", k.Name) + return nil, k.validate() +} + +func (_ *KafkaAutoscaler) ValidateDelete() (admission.Warnings, error) { + return nil, nil +} + +func (k *KafkaAutoscaler) validate() error { + if k.Spec.DatabaseRef == nil { + return errors.New("databaseRef can't be empty") + } + var kf dbapi.Kafka + err := DefaultClient.Get(context.TODO(), types.NamespacedName{ + Name: k.Spec.DatabaseRef.Name, + Namespace: k.Namespace, + }, &kf) + if err != nil { + _ = fmt.Errorf("can't get Kafka %s/%s \n", k.Namespace, k.Spec.DatabaseRef.Name) + return err + } + + if k.Spec.Compute != nil { + cm := k.Spec.Compute + if kf.Spec.Topology != nil { + if cm.Node != nil { + return errors.New("Spec.Compute.Node is invalid for kafka with topology") + } + } else { + if cm.Broker != nil { + return errors.New("Spec.Compute.Broker is invalid for combined kafka") + } + if cm.Controller != nil { + return errors.New("Spec.Compute.Controller is invalid for combined kafka") + } + } + } + + if k.Spec.Storage != nil { + st := k.Spec.Storage + if kf.Spec.Topology != nil { + if st.Node != nil { + return errors.New("Spec.Storage.Node is invalid for kafka with topology") + } + } else { + if st.Broker != nil { + return errors.New("Spec.Storage.Broker is invalid for combined kafka") + } + if st.Controller != nil { + return errors.New("Spec.Storage.Controller is invalid for combined kafka") + } + } + } + + return nil +} diff --git a/apis/autoscaling/v1alpha1/openapi_generated.go b/apis/autoscaling/v1alpha1/openapi_generated.go index 36f8d1713b..415922335f 100644 --- a/apis/autoscaling/v1alpha1/openapi_generated.go +++ b/apis/autoscaling/v1alpha1/openapi_generated.go @@ -475,6 +475,12 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.EtcdScalingPolicy": schema_apimachinery_apis_autoscaling_v1alpha1_EtcdScalingPolicy(ref), "kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.EtcdScalingRules": schema_apimachinery_apis_autoscaling_v1alpha1_EtcdScalingRules(ref), "kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.HistogramCheckpoint": schema_apimachinery_apis_autoscaling_v1alpha1_HistogramCheckpoint(ref), + "kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.KafkaAutoscaler": schema_apimachinery_apis_autoscaling_v1alpha1_KafkaAutoscaler(ref), + "kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.KafkaAutoscalerList": schema_apimachinery_apis_autoscaling_v1alpha1_KafkaAutoscalerList(ref), + "kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.KafkaAutoscalerSpec": schema_apimachinery_apis_autoscaling_v1alpha1_KafkaAutoscalerSpec(ref), + "kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.KafkaComputeAutoscalerSpec": schema_apimachinery_apis_autoscaling_v1alpha1_KafkaComputeAutoscalerSpec(ref), + "kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.KafkaOpsRequestOptions": schema_apimachinery_apis_autoscaling_v1alpha1_KafkaOpsRequestOptions(ref), + "kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.KafkaStorageAutoscalerSpec": schema_apimachinery_apis_autoscaling_v1alpha1_KafkaStorageAutoscalerSpec(ref), "kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.MariaDBAutoscaler": schema_apimachinery_apis_autoscaling_v1alpha1_MariaDBAutoscaler(ref), "kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.MariaDBAutoscalerList": schema_apimachinery_apis_autoscaling_v1alpha1_MariaDBAutoscalerList(ref), "kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.MariaDBAutoscalerSpec": schema_apimachinery_apis_autoscaling_v1alpha1_MariaDBAutoscalerSpec(ref), @@ -23695,6 +23701,234 @@ func schema_apimachinery_apis_autoscaling_v1alpha1_HistogramCheckpoint(ref commo } } +func schema_apimachinery_apis_autoscaling_v1alpha1_KafkaAutoscaler(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "Standard object metadata. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#metadata", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Description: "Specification of the behavior of the autoscaler. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#spec-and-status.", + Default: map[string]interface{}{}, + Ref: ref("kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.KafkaAutoscalerSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Description: "Current information about the autoscaler.", + Default: map[string]interface{}{}, + Ref: ref("kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.AutoscalerStatus"), + }, + }, + }, + Required: []string{"spec"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.AutoscalerStatus", "kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.KafkaAutoscalerSpec"}, + } +} + +func schema_apimachinery_apis_autoscaling_v1alpha1_KafkaAutoscalerList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "KafkaAutoscalerList is a list of KafkaAutoscaler objects.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "metadata": { + SchemaProps: spec.SchemaProps{ + Description: "metadata is the standard list metadata.", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Description: "items is the list of kafka autoscaler objects.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.KafkaAutoscaler"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.KafkaAutoscaler"}, + } +} + +func schema_apimachinery_apis_autoscaling_v1alpha1_KafkaAutoscalerSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "KafkaAutoscalerSpec is the specification of the behavior of the autoscaler.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "databaseRef": { + SchemaProps: spec.SchemaProps{ + Ref: ref("k8s.io/api/core/v1.LocalObjectReference"), + }, + }, + "opsRequestOptions": { + SchemaProps: spec.SchemaProps{ + Description: "This field will be used to control the behaviour of ops-manager", + Ref: ref("kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.KafkaOpsRequestOptions"), + }, + }, + "compute": { + SchemaProps: spec.SchemaProps{ + Ref: ref("kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.KafkaComputeAutoscalerSpec"), + }, + }, + "storage": { + SchemaProps: spec.SchemaProps{ + Ref: ref("kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.KafkaStorageAutoscalerSpec"), + }, + }, + }, + Required: []string{"databaseRef"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.LocalObjectReference", "kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.KafkaComputeAutoscalerSpec", "kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.KafkaOpsRequestOptions", "kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.KafkaStorageAutoscalerSpec"}, + } +} + +func schema_apimachinery_apis_autoscaling_v1alpha1_KafkaComputeAutoscalerSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "nodeTopology": { + SchemaProps: spec.SchemaProps{ + Ref: ref("kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.NodeTopology"), + }, + }, + "node": { + SchemaProps: spec.SchemaProps{ + Ref: ref("kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.ComputeAutoscalerSpec"), + }, + }, + "broker": { + SchemaProps: spec.SchemaProps{ + Ref: ref("kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.ComputeAutoscalerSpec"), + }, + }, + "controller": { + SchemaProps: spec.SchemaProps{ + Ref: ref("kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.ComputeAutoscalerSpec"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.ComputeAutoscalerSpec", "kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.NodeTopology"}, + } +} + +func schema_apimachinery_apis_autoscaling_v1alpha1_KafkaOpsRequestOptions(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "timeout": { + SchemaProps: spec.SchemaProps{ + Description: "Timeout for each step of the ops request in second. If a step doesn't finish within the specified timeout, the ops request will result in failure.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"), + }, + }, + "apply": { + SchemaProps: spec.SchemaProps{ + Description: "ApplyOption is to control the execution of OpsRequest depending on the database state.", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.Duration"}, + } +} + +func schema_apimachinery_apis_autoscaling_v1alpha1_KafkaStorageAutoscalerSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "node": { + SchemaProps: spec.SchemaProps{ + Ref: ref("kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.StorageAutoscalerSpec"), + }, + }, + "broker": { + SchemaProps: spec.SchemaProps{ + Ref: ref("kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.StorageAutoscalerSpec"), + }, + }, + "controller": { + SchemaProps: spec.SchemaProps{ + Ref: ref("kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.StorageAutoscalerSpec"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "kubedb.dev/apimachinery/apis/autoscaling/v1alpha1.StorageAutoscalerSpec"}, + } +} + func schema_apimachinery_apis_autoscaling_v1alpha1_MariaDBAutoscaler(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/apis/autoscaling/v1alpha1/register.go b/apis/autoscaling/v1alpha1/register.go index 349ad04956..2152e700a7 100644 --- a/apis/autoscaling/v1alpha1/register.go +++ b/apis/autoscaling/v1alpha1/register.go @@ -58,6 +58,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &ElasticsearchAutoscalerList{}, &EtcdAutoscaler{}, &EtcdAutoscalerList{}, + &KafkaAutoscaler{}, + &KafkaAutoscalerList{}, &MariaDBAutoscaler{}, &MariaDBAutoscalerList{}, &MemcachedAutoscaler{}, diff --git a/apis/autoscaling/v1alpha1/zz_generated.deepcopy.go b/apis/autoscaling/v1alpha1/zz_generated.deepcopy.go index d10859f5bd..20a0336357 100644 --- a/apis/autoscaling/v1alpha1/zz_generated.deepcopy.go +++ b/apis/autoscaling/v1alpha1/zz_generated.deepcopy.go @@ -675,6 +675,191 @@ func (in *HistogramCheckpoint) DeepCopy() *HistogramCheckpoint { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KafkaAutoscaler) DeepCopyInto(out *KafkaAutoscaler) { + *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 KafkaAutoscaler. +func (in *KafkaAutoscaler) DeepCopy() *KafkaAutoscaler { + if in == nil { + return nil + } + out := new(KafkaAutoscaler) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KafkaAutoscaler) 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 *KafkaAutoscalerList) DeepCopyInto(out *KafkaAutoscalerList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]KafkaAutoscaler, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KafkaAutoscalerList. +func (in *KafkaAutoscalerList) DeepCopy() *KafkaAutoscalerList { + if in == nil { + return nil + } + out := new(KafkaAutoscalerList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *KafkaAutoscalerList) 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 *KafkaAutoscalerSpec) DeepCopyInto(out *KafkaAutoscalerSpec) { + *out = *in + if in.DatabaseRef != nil { + in, out := &in.DatabaseRef, &out.DatabaseRef + *out = new(corev1.LocalObjectReference) + **out = **in + } + if in.OpsRequestOptions != nil { + in, out := &in.OpsRequestOptions, &out.OpsRequestOptions + *out = new(KafkaOpsRequestOptions) + (*in).DeepCopyInto(*out) + } + if in.Compute != nil { + in, out := &in.Compute, &out.Compute + *out = new(KafkaComputeAutoscalerSpec) + (*in).DeepCopyInto(*out) + } + if in.Storage != nil { + in, out := &in.Storage, &out.Storage + *out = new(KafkaStorageAutoscalerSpec) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KafkaAutoscalerSpec. +func (in *KafkaAutoscalerSpec) DeepCopy() *KafkaAutoscalerSpec { + if in == nil { + return nil + } + out := new(KafkaAutoscalerSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KafkaComputeAutoscalerSpec) DeepCopyInto(out *KafkaComputeAutoscalerSpec) { + *out = *in + if in.NodeTopology != nil { + in, out := &in.NodeTopology, &out.NodeTopology + *out = new(NodeTopology) + (*in).DeepCopyInto(*out) + } + if in.Node != nil { + in, out := &in.Node, &out.Node + *out = new(ComputeAutoscalerSpec) + (*in).DeepCopyInto(*out) + } + if in.Broker != nil { + in, out := &in.Broker, &out.Broker + *out = new(ComputeAutoscalerSpec) + (*in).DeepCopyInto(*out) + } + if in.Controller != nil { + in, out := &in.Controller, &out.Controller + *out = new(ComputeAutoscalerSpec) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KafkaComputeAutoscalerSpec. +func (in *KafkaComputeAutoscalerSpec) DeepCopy() *KafkaComputeAutoscalerSpec { + if in == nil { + return nil + } + out := new(KafkaComputeAutoscalerSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KafkaOpsRequestOptions) DeepCopyInto(out *KafkaOpsRequestOptions) { + *out = *in + if in.Timeout != nil { + in, out := &in.Timeout, &out.Timeout + *out = new(metav1.Duration) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KafkaOpsRequestOptions. +func (in *KafkaOpsRequestOptions) DeepCopy() *KafkaOpsRequestOptions { + if in == nil { + return nil + } + out := new(KafkaOpsRequestOptions) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KafkaStorageAutoscalerSpec) DeepCopyInto(out *KafkaStorageAutoscalerSpec) { + *out = *in + if in.Node != nil { + in, out := &in.Node, &out.Node + *out = new(StorageAutoscalerSpec) + **out = **in + } + if in.Broker != nil { + in, out := &in.Broker, &out.Broker + *out = new(StorageAutoscalerSpec) + **out = **in + } + if in.Controller != nil { + in, out := &in.Controller, &out.Controller + *out = new(StorageAutoscalerSpec) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KafkaStorageAutoscalerSpec. +func (in *KafkaStorageAutoscalerSpec) DeepCopy() *KafkaStorageAutoscalerSpec { + if in == nil { + return nil + } + out := new(KafkaStorageAutoscalerSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MariaDBAutoscaler) DeepCopyInto(out *MariaDBAutoscaler) { *out = *in diff --git a/client/clientset/versioned/typed/autoscaling/v1alpha1/autoscaling_client.go b/client/clientset/versioned/typed/autoscaling/v1alpha1/autoscaling_client.go index c21edf1363..14ef33def0 100644 --- a/client/clientset/versioned/typed/autoscaling/v1alpha1/autoscaling_client.go +++ b/client/clientset/versioned/typed/autoscaling/v1alpha1/autoscaling_client.go @@ -31,6 +31,7 @@ type AutoscalingV1alpha1Interface interface { RESTClient() rest.Interface ElasticsearchAutoscalersGetter EtcdAutoscalersGetter + KafkaAutoscalersGetter MariaDBAutoscalersGetter MemcachedAutoscalersGetter MongoDBAutoscalersGetter @@ -56,6 +57,10 @@ func (c *AutoscalingV1alpha1Client) EtcdAutoscalers(namespace string) EtcdAutosc return newEtcdAutoscalers(c, namespace) } +func (c *AutoscalingV1alpha1Client) KafkaAutoscalers(namespace string) KafkaAutoscalerInterface { + return newKafkaAutoscalers(c, namespace) +} + func (c *AutoscalingV1alpha1Client) MariaDBAutoscalers(namespace string) MariaDBAutoscalerInterface { return newMariaDBAutoscalers(c, namespace) } diff --git a/client/clientset/versioned/typed/autoscaling/v1alpha1/fake/fake_autoscaling_client.go b/client/clientset/versioned/typed/autoscaling/v1alpha1/fake/fake_autoscaling_client.go index 437dbe06ae..2ffcccec37 100644 --- a/client/clientset/versioned/typed/autoscaling/v1alpha1/fake/fake_autoscaling_client.go +++ b/client/clientset/versioned/typed/autoscaling/v1alpha1/fake/fake_autoscaling_client.go @@ -37,6 +37,10 @@ func (c *FakeAutoscalingV1alpha1) EtcdAutoscalers(namespace string) v1alpha1.Etc return &FakeEtcdAutoscalers{c, namespace} } +func (c *FakeAutoscalingV1alpha1) KafkaAutoscalers(namespace string) v1alpha1.KafkaAutoscalerInterface { + return &FakeKafkaAutoscalers{c, namespace} +} + func (c *FakeAutoscalingV1alpha1) MariaDBAutoscalers(namespace string) v1alpha1.MariaDBAutoscalerInterface { return &FakeMariaDBAutoscalers{c, namespace} } diff --git a/client/clientset/versioned/typed/autoscaling/v1alpha1/fake/fake_kafkaautoscaler.go b/client/clientset/versioned/typed/autoscaling/v1alpha1/fake/fake_kafkaautoscaler.go new file mode 100644 index 0000000000..8c78f38c70 --- /dev/null +++ b/client/clientset/versioned/typed/autoscaling/v1alpha1/fake/fake_kafkaautoscaler.go @@ -0,0 +1,142 @@ +/* +Copyright AppsCode Inc. and Contributors + +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" + + v1alpha1 "kubedb.dev/apimachinery/apis/autoscaling/v1alpha1" + + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + labels "k8s.io/apimachinery/pkg/labels" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + testing "k8s.io/client-go/testing" +) + +// FakeKafkaAutoscalers implements KafkaAutoscalerInterface +type FakeKafkaAutoscalers struct { + Fake *FakeAutoscalingV1alpha1 + ns string +} + +var kafkaautoscalersResource = v1alpha1.SchemeGroupVersion.WithResource("kafkaautoscalers") + +var kafkaautoscalersKind = v1alpha1.SchemeGroupVersion.WithKind("KafkaAutoscaler") + +// Get takes name of the kafkaAutoscaler, and returns the corresponding kafkaAutoscaler object, and an error if there is any. +func (c *FakeKafkaAutoscalers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.KafkaAutoscaler, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(kafkaautoscalersResource, c.ns, name), &v1alpha1.KafkaAutoscaler{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.KafkaAutoscaler), err +} + +// List takes label and field selectors, and returns the list of KafkaAutoscalers that match those selectors. +func (c *FakeKafkaAutoscalers) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.KafkaAutoscalerList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(kafkaautoscalersResource, kafkaautoscalersKind, c.ns, opts), &v1alpha1.KafkaAutoscalerList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.KafkaAutoscalerList{ListMeta: obj.(*v1alpha1.KafkaAutoscalerList).ListMeta} + for _, item := range obj.(*v1alpha1.KafkaAutoscalerList).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 kafkaAutoscalers. +func (c *FakeKafkaAutoscalers) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(kafkaautoscalersResource, c.ns, opts)) + +} + +// Create takes the representation of a kafkaAutoscaler and creates it. Returns the server's representation of the kafkaAutoscaler, and an error, if there is any. +func (c *FakeKafkaAutoscalers) Create(ctx context.Context, kafkaAutoscaler *v1alpha1.KafkaAutoscaler, opts v1.CreateOptions) (result *v1alpha1.KafkaAutoscaler, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(kafkaautoscalersResource, c.ns, kafkaAutoscaler), &v1alpha1.KafkaAutoscaler{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.KafkaAutoscaler), err +} + +// Update takes the representation of a kafkaAutoscaler and updates it. Returns the server's representation of the kafkaAutoscaler, and an error, if there is any. +func (c *FakeKafkaAutoscalers) Update(ctx context.Context, kafkaAutoscaler *v1alpha1.KafkaAutoscaler, opts v1.UpdateOptions) (result *v1alpha1.KafkaAutoscaler, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(kafkaautoscalersResource, c.ns, kafkaAutoscaler), &v1alpha1.KafkaAutoscaler{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.KafkaAutoscaler), 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 *FakeKafkaAutoscalers) UpdateStatus(ctx context.Context, kafkaAutoscaler *v1alpha1.KafkaAutoscaler, opts v1.UpdateOptions) (*v1alpha1.KafkaAutoscaler, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(kafkaautoscalersResource, "status", c.ns, kafkaAutoscaler), &v1alpha1.KafkaAutoscaler{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.KafkaAutoscaler), err +} + +// Delete takes name of the kafkaAutoscaler and deletes it. Returns an error if one occurs. +func (c *FakeKafkaAutoscalers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(kafkaautoscalersResource, c.ns, name, opts), &v1alpha1.KafkaAutoscaler{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeKafkaAutoscalers) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(kafkaautoscalersResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.KafkaAutoscalerList{}) + return err +} + +// Patch applies the patch and returns the patched kafkaAutoscaler. +func (c *FakeKafkaAutoscalers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.KafkaAutoscaler, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(kafkaautoscalersResource, c.ns, name, pt, data, subresources...), &v1alpha1.KafkaAutoscaler{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.KafkaAutoscaler), err +} diff --git a/client/clientset/versioned/typed/autoscaling/v1alpha1/generated_expansion.go b/client/clientset/versioned/typed/autoscaling/v1alpha1/generated_expansion.go index 4f67968e7e..3506ea30a5 100644 --- a/client/clientset/versioned/typed/autoscaling/v1alpha1/generated_expansion.go +++ b/client/clientset/versioned/typed/autoscaling/v1alpha1/generated_expansion.go @@ -22,6 +22,8 @@ type ElasticsearchAutoscalerExpansion interface{} type EtcdAutoscalerExpansion interface{} +type KafkaAutoscalerExpansion interface{} + type MariaDBAutoscalerExpansion interface{} type MemcachedAutoscalerExpansion interface{} diff --git a/client/clientset/versioned/typed/autoscaling/v1alpha1/kafkaautoscaler.go b/client/clientset/versioned/typed/autoscaling/v1alpha1/kafkaautoscaler.go new file mode 100644 index 0000000000..ba4f617701 --- /dev/null +++ b/client/clientset/versioned/typed/autoscaling/v1alpha1/kafkaautoscaler.go @@ -0,0 +1,196 @@ +/* +Copyright AppsCode Inc. and Contributors + +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" + + v1alpha1 "kubedb.dev/apimachinery/apis/autoscaling/v1alpha1" + scheme "kubedb.dev/apimachinery/client/clientset/versioned/scheme" + + 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" +) + +// KafkaAutoscalersGetter has a method to return a KafkaAutoscalerInterface. +// A group's client should implement this interface. +type KafkaAutoscalersGetter interface { + KafkaAutoscalers(namespace string) KafkaAutoscalerInterface +} + +// KafkaAutoscalerInterface has methods to work with KafkaAutoscaler resources. +type KafkaAutoscalerInterface interface { + Create(ctx context.Context, kafkaAutoscaler *v1alpha1.KafkaAutoscaler, opts v1.CreateOptions) (*v1alpha1.KafkaAutoscaler, error) + Update(ctx context.Context, kafkaAutoscaler *v1alpha1.KafkaAutoscaler, opts v1.UpdateOptions) (*v1alpha1.KafkaAutoscaler, error) + UpdateStatus(ctx context.Context, kafkaAutoscaler *v1alpha1.KafkaAutoscaler, opts v1.UpdateOptions) (*v1alpha1.KafkaAutoscaler, 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.KafkaAutoscaler, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.KafkaAutoscalerList, 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.KafkaAutoscaler, err error) + KafkaAutoscalerExpansion +} + +// kafkaAutoscalers implements KafkaAutoscalerInterface +type kafkaAutoscalers struct { + client rest.Interface + ns string +} + +// newKafkaAutoscalers returns a KafkaAutoscalers +func newKafkaAutoscalers(c *AutoscalingV1alpha1Client, namespace string) *kafkaAutoscalers { + return &kafkaAutoscalers{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the kafkaAutoscaler, and returns the corresponding kafkaAutoscaler object, and an error if there is any. +func (c *kafkaAutoscalers) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.KafkaAutoscaler, err error) { + result = &v1alpha1.KafkaAutoscaler{} + err = c.client.Get(). + Namespace(c.ns). + Resource("kafkaautoscalers"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of KafkaAutoscalers that match those selectors. +func (c *kafkaAutoscalers) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.KafkaAutoscalerList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.KafkaAutoscalerList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("kafkaautoscalers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested kafkaAutoscalers. +func (c *kafkaAutoscalers) 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(). + Namespace(c.ns). + Resource("kafkaautoscalers"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a kafkaAutoscaler and creates it. Returns the server's representation of the kafkaAutoscaler, and an error, if there is any. +func (c *kafkaAutoscalers) Create(ctx context.Context, kafkaAutoscaler *v1alpha1.KafkaAutoscaler, opts v1.CreateOptions) (result *v1alpha1.KafkaAutoscaler, err error) { + result = &v1alpha1.KafkaAutoscaler{} + err = c.client.Post(). + Namespace(c.ns). + Resource("kafkaautoscalers"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(kafkaAutoscaler). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a kafkaAutoscaler and updates it. Returns the server's representation of the kafkaAutoscaler, and an error, if there is any. +func (c *kafkaAutoscalers) Update(ctx context.Context, kafkaAutoscaler *v1alpha1.KafkaAutoscaler, opts v1.UpdateOptions) (result *v1alpha1.KafkaAutoscaler, err error) { + result = &v1alpha1.KafkaAutoscaler{} + err = c.client.Put(). + Namespace(c.ns). + Resource("kafkaautoscalers"). + Name(kafkaAutoscaler.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(kafkaAutoscaler). + 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 *kafkaAutoscalers) UpdateStatus(ctx context.Context, kafkaAutoscaler *v1alpha1.KafkaAutoscaler, opts v1.UpdateOptions) (result *v1alpha1.KafkaAutoscaler, err error) { + result = &v1alpha1.KafkaAutoscaler{} + err = c.client.Put(). + Namespace(c.ns). + Resource("kafkaautoscalers"). + Name(kafkaAutoscaler.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(kafkaAutoscaler). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the kafkaAutoscaler and deletes it. Returns an error if one occurs. +func (c *kafkaAutoscalers) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("kafkaautoscalers"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *kafkaAutoscalers) 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(). + Namespace(c.ns). + Resource("kafkaautoscalers"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched kafkaAutoscaler. +func (c *kafkaAutoscalers) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.KafkaAutoscaler, err error) { + result = &v1alpha1.KafkaAutoscaler{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("kafkaautoscalers"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/client/informers/externalversions/autoscaling/v1alpha1/interface.go b/client/informers/externalversions/autoscaling/v1alpha1/interface.go index 0f48aca2ad..3933febdae 100644 --- a/client/informers/externalversions/autoscaling/v1alpha1/interface.go +++ b/client/informers/externalversions/autoscaling/v1alpha1/interface.go @@ -28,6 +28,8 @@ type Interface interface { ElasticsearchAutoscalers() ElasticsearchAutoscalerInformer // EtcdAutoscalers returns a EtcdAutoscalerInformer. EtcdAutoscalers() EtcdAutoscalerInformer + // KafkaAutoscalers returns a KafkaAutoscalerInformer. + KafkaAutoscalers() KafkaAutoscalerInformer // MariaDBAutoscalers returns a MariaDBAutoscalerInformer. MariaDBAutoscalers() MariaDBAutoscalerInformer // MemcachedAutoscalers returns a MemcachedAutoscalerInformer. @@ -71,6 +73,11 @@ func (v *version) EtcdAutoscalers() EtcdAutoscalerInformer { return &etcdAutoscalerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } +// KafkaAutoscalers returns a KafkaAutoscalerInformer. +func (v *version) KafkaAutoscalers() KafkaAutoscalerInformer { + return &kafkaAutoscalerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + // MariaDBAutoscalers returns a MariaDBAutoscalerInformer. func (v *version) MariaDBAutoscalers() MariaDBAutoscalerInformer { return &mariaDBAutoscalerInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/client/informers/externalversions/autoscaling/v1alpha1/kafkaautoscaler.go b/client/informers/externalversions/autoscaling/v1alpha1/kafkaautoscaler.go new file mode 100644 index 0000000000..13329aa88f --- /dev/null +++ b/client/informers/externalversions/autoscaling/v1alpha1/kafkaautoscaler.go @@ -0,0 +1,91 @@ +/* +Copyright AppsCode Inc. and Contributors + +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" + + autoscalingv1alpha1 "kubedb.dev/apimachinery/apis/autoscaling/v1alpha1" + versioned "kubedb.dev/apimachinery/client/clientset/versioned" + internalinterfaces "kubedb.dev/apimachinery/client/informers/externalversions/internalinterfaces" + v1alpha1 "kubedb.dev/apimachinery/client/listers/autoscaling/v1alpha1" + + 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" +) + +// KafkaAutoscalerInformer provides access to a shared informer and lister for +// KafkaAutoscalers. +type KafkaAutoscalerInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.KafkaAutoscalerLister +} + +type kafkaAutoscalerInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewKafkaAutoscalerInformer constructs a new informer for KafkaAutoscaler 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 NewKafkaAutoscalerInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredKafkaAutoscalerInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredKafkaAutoscalerInformer constructs a new informer for KafkaAutoscaler 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 NewFilteredKafkaAutoscalerInformer(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.AutoscalingV1alpha1().KafkaAutoscalers(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.AutoscalingV1alpha1().KafkaAutoscalers(namespace).Watch(context.TODO(), options) + }, + }, + &autoscalingv1alpha1.KafkaAutoscaler{}, + resyncPeriod, + indexers, + ) +} + +func (f *kafkaAutoscalerInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredKafkaAutoscalerInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *kafkaAutoscalerInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&autoscalingv1alpha1.KafkaAutoscaler{}, f.defaultInformer) +} + +func (f *kafkaAutoscalerInformer) Lister() v1alpha1.KafkaAutoscalerLister { + return v1alpha1.NewKafkaAutoscalerLister(f.Informer().GetIndexer()) +} diff --git a/client/informers/externalversions/generic.go b/client/informers/externalversions/generic.go index 738809b5c4..09abf7050a 100644 --- a/client/informers/externalversions/generic.go +++ b/client/informers/externalversions/generic.go @@ -74,6 +74,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V1alpha1().ElasticsearchAutoscalers().Informer()}, nil case autoscalingv1alpha1.SchemeGroupVersion.WithResource("etcdautoscalers"): return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V1alpha1().EtcdAutoscalers().Informer()}, nil + case autoscalingv1alpha1.SchemeGroupVersion.WithResource("kafkaautoscalers"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V1alpha1().KafkaAutoscalers().Informer()}, nil case autoscalingv1alpha1.SchemeGroupVersion.WithResource("mariadbautoscalers"): return &genericInformer{resource: resource.GroupResource(), informer: f.Autoscaling().V1alpha1().MariaDBAutoscalers().Informer()}, nil case autoscalingv1alpha1.SchemeGroupVersion.WithResource("memcachedautoscalers"): diff --git a/client/listers/autoscaling/v1alpha1/expansion_generated.go b/client/listers/autoscaling/v1alpha1/expansion_generated.go index 940259e79b..48dd542ac0 100644 --- a/client/listers/autoscaling/v1alpha1/expansion_generated.go +++ b/client/listers/autoscaling/v1alpha1/expansion_generated.go @@ -34,6 +34,14 @@ type EtcdAutoscalerListerExpansion interface{} // EtcdAutoscalerNamespaceLister. type EtcdAutoscalerNamespaceListerExpansion interface{} +// KafkaAutoscalerListerExpansion allows custom methods to be added to +// KafkaAutoscalerLister. +type KafkaAutoscalerListerExpansion interface{} + +// KafkaAutoscalerNamespaceListerExpansion allows custom methods to be added to +// KafkaAutoscalerNamespaceLister. +type KafkaAutoscalerNamespaceListerExpansion interface{} + // MariaDBAutoscalerListerExpansion allows custom methods to be added to // MariaDBAutoscalerLister. type MariaDBAutoscalerListerExpansion interface{} diff --git a/client/listers/autoscaling/v1alpha1/kafkaautoscaler.go b/client/listers/autoscaling/v1alpha1/kafkaautoscaler.go new file mode 100644 index 0000000000..5c6417e0ec --- /dev/null +++ b/client/listers/autoscaling/v1alpha1/kafkaautoscaler.go @@ -0,0 +1,100 @@ +/* +Copyright AppsCode Inc. and Contributors + +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 ( + v1alpha1 "kubedb.dev/apimachinery/apis/autoscaling/v1alpha1" + + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// KafkaAutoscalerLister helps list KafkaAutoscalers. +// All objects returned here must be treated as read-only. +type KafkaAutoscalerLister interface { + // List lists all KafkaAutoscalers in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.KafkaAutoscaler, err error) + // KafkaAutoscalers returns an object that can list and get KafkaAutoscalers. + KafkaAutoscalers(namespace string) KafkaAutoscalerNamespaceLister + KafkaAutoscalerListerExpansion +} + +// kafkaAutoscalerLister implements the KafkaAutoscalerLister interface. +type kafkaAutoscalerLister struct { + indexer cache.Indexer +} + +// NewKafkaAutoscalerLister returns a new KafkaAutoscalerLister. +func NewKafkaAutoscalerLister(indexer cache.Indexer) KafkaAutoscalerLister { + return &kafkaAutoscalerLister{indexer: indexer} +} + +// List lists all KafkaAutoscalers in the indexer. +func (s *kafkaAutoscalerLister) List(selector labels.Selector) (ret []*v1alpha1.KafkaAutoscaler, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.KafkaAutoscaler)) + }) + return ret, err +} + +// KafkaAutoscalers returns an object that can list and get KafkaAutoscalers. +func (s *kafkaAutoscalerLister) KafkaAutoscalers(namespace string) KafkaAutoscalerNamespaceLister { + return kafkaAutoscalerNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// KafkaAutoscalerNamespaceLister helps list and get KafkaAutoscalers. +// All objects returned here must be treated as read-only. +type KafkaAutoscalerNamespaceLister interface { + // List lists all KafkaAutoscalers in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.KafkaAutoscaler, err error) + // Get retrieves the KafkaAutoscaler from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.KafkaAutoscaler, error) + KafkaAutoscalerNamespaceListerExpansion +} + +// kafkaAutoscalerNamespaceLister implements the KafkaAutoscalerNamespaceLister +// interface. +type kafkaAutoscalerNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all KafkaAutoscalers in the indexer for a given namespace. +func (s kafkaAutoscalerNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.KafkaAutoscaler, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.KafkaAutoscaler)) + }) + return ret, err +} + +// Get retrieves the KafkaAutoscaler from the indexer for a given namespace and name. +func (s kafkaAutoscalerNamespaceLister) Get(name string) (*v1alpha1.KafkaAutoscaler, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("kafkaautoscaler"), name) + } + return obj.(*v1alpha1.KafkaAutoscaler), nil +} diff --git a/crds/autoscaling.kubedb.com_kafkaautoscalers.yaml b/crds/autoscaling.kubedb.com_kafkaautoscalers.yaml new file mode 100644 index 0000000000..8a712dee20 --- /dev/null +++ b/crds/autoscaling.kubedb.com_kafkaautoscalers.yaml @@ -0,0 +1,450 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + creationTimestamp: null + labels: + app.kubernetes.io/name: kubedb + name: kafkaautoscalers.autoscaling.kubedb.com +spec: + group: autoscaling.kubedb.com + names: + categories: + - datastore + - kubedb + - appscode + kind: KafkaAutoscaler + listKind: KafkaAutoscalerList + plural: kafkaautoscalers + shortNames: + - kfscaler + singular: kafkaautoscaler + scope: Namespaced + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + properties: + apiVersion: + type: string + kind: + type: string + metadata: + type: object + spec: + properties: + compute: + properties: + broker: + properties: + containerControlledValues: + enum: + - RequestsAndLimits + - RequestsOnly + type: string + controlledResources: + items: + type: string + type: array + inMemoryStorage: + properties: + scalingFactorPercentage: + format: int32 + type: integer + usageThresholdPercentage: + format: int32 + type: integer + type: object + maxAllowed: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + minAllowed: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + podLifeTimeThreshold: + type: string + resourceDiffPercentage: + format: int32 + type: integer + trigger: + type: string + type: object + controller: + properties: + containerControlledValues: + enum: + - RequestsAndLimits + - RequestsOnly + type: string + controlledResources: + items: + type: string + type: array + inMemoryStorage: + properties: + scalingFactorPercentage: + format: int32 + type: integer + usageThresholdPercentage: + format: int32 + type: integer + type: object + maxAllowed: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + minAllowed: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + podLifeTimeThreshold: + type: string + resourceDiffPercentage: + format: int32 + type: integer + trigger: + type: string + type: object + node: + properties: + containerControlledValues: + enum: + - RequestsAndLimits + - RequestsOnly + type: string + controlledResources: + items: + type: string + type: array + inMemoryStorage: + properties: + scalingFactorPercentage: + format: int32 + type: integer + usageThresholdPercentage: + format: int32 + type: integer + type: object + maxAllowed: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + minAllowed: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + podLifeTimeThreshold: + type: string + resourceDiffPercentage: + format: int32 + type: integer + trigger: + type: string + type: object + nodeTopology: + properties: + name: + type: string + scaleDownDiffPercentage: + default: 25 + format: int32 + type: integer + scaleUpDiffPercentage: + default: 15 + format: int32 + type: integer + type: object + type: object + databaseRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + opsRequestOptions: + properties: + apply: + default: IfReady + enum: + - IfReady + - Always + type: string + timeout: + type: string + type: object + storage: + properties: + broker: + properties: + expansionMode: + enum: + - Offline + - Online + type: string + scalingThreshold: + format: int32 + type: integer + trigger: + type: string + usageThreshold: + format: int32 + type: integer + required: + - expansionMode + type: object + controller: + properties: + expansionMode: + enum: + - Offline + - Online + type: string + scalingThreshold: + format: int32 + type: integer + trigger: + type: string + usageThreshold: + format: int32 + type: integer + required: + - expansionMode + type: object + node: + properties: + expansionMode: + enum: + - Offline + - Online + type: string + scalingThreshold: + format: int32 + type: integer + trigger: + type: string + usageThreshold: + format: int32 + type: integer + required: + - expansionMode + type: object + type: object + required: + - databaseRef + type: object + status: + properties: + checkpoints: + items: + properties: + cpuHistogram: + properties: + bucketWeights: + items: + properties: + index: + type: integer + weight: + format: int32 + type: integer + required: + - index + - weight + type: object + type: array + x-kubernetes-preserve-unknown-fields: true + referenceTimestamp: + format: date-time + nullable: true + type: string + totalWeight: + format: double + type: number + type: object + firstSampleStart: + format: date-time + nullable: true + type: string + lastSampleStart: + format: date-time + nullable: true + type: string + lastUpdateTime: + format: date-time + nullable: true + type: string + memoryHistogram: + properties: + bucketWeights: + items: + properties: + index: + type: integer + weight: + format: int32 + type: integer + required: + - index + - weight + type: object + type: array + x-kubernetes-preserve-unknown-fields: true + referenceTimestamp: + format: date-time + nullable: true + type: string + totalWeight: + format: double + type: number + type: object + ref: + properties: + containerName: + type: string + vpaObjectName: + type: string + type: object + totalSamplesCount: + type: integer + version: + type: string + type: object + type: array + conditions: + items: + properties: + lastTransitionTime: + format: date-time + type: string + message: + type: string + observedGeneration: + format: int64 + type: integer + reason: + type: string + severity: + type: string + status: + type: string + type: + type: string + required: + - lastTransitionTime + - status + - type + type: object + type: array + observedGeneration: + format: int64 + type: integer + phase: + enum: + - InProgress + - Current + - Terminating + - Failed + type: string + vpas: + items: + properties: + conditions: + items: + properties: + lastTransitionTime: + format: date-time + type: string + message: + type: string + reason: + type: string + status: + type: string + type: + type: string + required: + - status + - type + type: object + type: array + recommendation: + properties: + containerRecommendations: + items: + properties: + containerName: + type: string + lowerBound: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + target: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + uncappedTarget: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + upperBound: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + required: + - target + type: object + type: array + type: object + vpaName: + type: string + type: object + type: array + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} diff --git a/pkg/openapi/lib.go b/pkg/openapi/lib.go index ff79c2259f..dd6550279e 100644 --- a/pkg/openapi/lib.go +++ b/pkg/openapi/lib.go @@ -30,6 +30,7 @@ func ConfigureOpenAPI(scheme *runtime.Scheme, serverConfig *genericapiserver.Rec "/apis/mutators.autoscaling.kubedb.com/v1alpha1", "/apis/mutators.autoscaling.kubedb.com/v1alpha1/elasticsearchautoscalerwebhooks", + "/apis/mutators.autoscaling.kubedb.com/v1alpha1/kafkaautoscalerwebhooks", "/apis/mutators.autoscaling.kubedb.com/v1alpha1/mariadbautoscalerwebhooks", "/apis/mutators.autoscaling.kubedb.com/v1alpha1/mongodbautoscalerwebhooks", "/apis/mutators.autoscaling.kubedb.com/v1alpha1/mysqlautoscalerwebhooks", @@ -81,6 +82,7 @@ func ConfigureOpenAPI(scheme *runtime.Scheme, serverConfig *genericapiserver.Rec "/apis/validators.autoscaling.kubedb.com/v1alpha1", "/apis/validators.autoscaling.kubedb.com/v1alpha1/elasticsearchautoscalerwebhooks", + "/apis/validators.autoscaling.kubedb.com/v1alpha1/kafkaautoscalerwebhooks", "/apis/validators.autoscaling.kubedb.com/v1alpha1/mariadbautoscalerwebhooks", "/apis/validators.autoscaling.kubedb.com/v1alpha1/mongodbautoscalerwebhooks", "/apis/validators.autoscaling.kubedb.com/v1alpha1/mysqlautoscalerwebhooks",