diff --git a/apis/catalog/v1alpha1/ferretdb_version_helpers.go b/apis/catalog/v1alpha1/ferretdb_version_helpers.go new file mode 100644 index 0000000000..0818b2c524 --- /dev/null +++ b/apis/catalog/v1alpha1/ferretdb_version_helpers.go @@ -0,0 +1,63 @@ +/* +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/catalog" + "kubedb.dev/apimachinery/crds" + + "kmodules.xyz/client-go/apiextensions" +) + +func (f FerretDBVersion) CustomResourceDefinition() *apiextensions.CustomResourceDefinition { + return crds.MustCustomResourceDefinition(SchemeGroupVersion.WithResource(ResourcePluralFerretDBVersion)) +} + +var _ apis.ResourceInfo = &FerretDBVersion{} + +func (f FerretDBVersion) ResourceFQN() string { + return fmt.Sprintf("%s.%s", ResourcePluralFerretDBVersion, catalog.GroupName) +} + +func (f FerretDBVersion) ResourceShortCode() string { + return ResourceCodeFerretDBVersion +} + +func (f FerretDBVersion) ResourceKind() string { + return ResourceKindFerretDBVersion +} + +func (f FerretDBVersion) ResourceSingular() string { + return ResourceSingularFerretDBVersion +} + +func (f FerretDBVersion) ResourcePlural() string { + return ResourcePluralFerretDBVersion +} + +func (f FerretDBVersion) ValidateSpecs() error { + if f.Spec.Version == "" || + f.Spec.DB.Image == "" { + return fmt.Errorf(`atleast one of the following specs is not set for ferretdbVersion "%v": +spec.version, +spec.db.image`, f.Name) + } + return nil +} diff --git a/apis/catalog/v1alpha1/ferretdb_version_types.go b/apis/catalog/v1alpha1/ferretdb_version_types.go new file mode 100644 index 0000000000..4a40e46290 --- /dev/null +++ b/apis/catalog/v1alpha1/ferretdb_version_types.go @@ -0,0 +1,79 @@ +/* +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 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + +const ( + ResourceCodeFerretDBVersion = "frversion" + ResourceKindFerretDBVersion = "FerretDBVersion" + ResourceSingularFerretDBVersion = "ferretdbversion" + ResourcePluralFerretDBVersion = "ferretdbversions" +) + +// +genclient +// +genclient:nonNamespaced +// +genclient:skipVerbs=updateStatus +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=ferretdbversions,singular=ferretdbversion,scope=Cluster,shortName=drversion,categories={datastore,kubedb,appscode} +// +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".spec.version" +// +kubebuilder:printcolumn:name="DB_IMAGE",type="string",JSONPath=".spec.db.image" +// +kubebuilder:printcolumn:name="Deprecated",type="boolean",JSONPath=".spec.deprecated" +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +type FerretDBVersion struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec FerretDBVersionSpec `json:"spec,omitempty"` +} + +// FerretDBVersionSpec defines the desired state of FerretDBVersion +type FerretDBVersionSpec struct { + // Version + Version string `json:"version"` + + // Database Image + DB FerretDBVersionDatabase `json:"db"` + + // Deprecated versions usable but regarded as obsolete and best avoided, typically due to having been superseded. + // +optional + Deprecated bool `json:"deprecated,omitempty"` + + // update constraints + // +optional + UpdateConstraints UpdateConstraints `json:"updateConstraints,omitempty"` + + // SecurityContext is for the additional security information for the FerretDB container + // +optional + SecurityContext SecurityContext `json:"securityContext"` +} + +// FerretDBVersionDatabase is the FerretDB Database image +type FerretDBVersionDatabase struct { + Image string `json:"image"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// FerretDBVersionList contains a list of FerretDBVersion +type FerretDBVersionList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []FerretDBVersion `json:"items,omitempty"` +} diff --git a/apis/catalog/v1alpha1/openapi_generated.go b/apis/catalog/v1alpha1/openapi_generated.go index c526ac86b8..e668e0d268 100644 --- a/apis/catalog/v1alpha1/openapi_generated.go +++ b/apis/catalog/v1alpha1/openapi_generated.go @@ -481,6 +481,10 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kubedb.dev/apimachinery/apis/catalog/v1alpha1.EtcdVersionExporter": schema_apimachinery_apis_catalog_v1alpha1_EtcdVersionExporter(ref), "kubedb.dev/apimachinery/apis/catalog/v1alpha1.EtcdVersionList": schema_apimachinery_apis_catalog_v1alpha1_EtcdVersionList(ref), "kubedb.dev/apimachinery/apis/catalog/v1alpha1.EtcdVersionSpec": schema_apimachinery_apis_catalog_v1alpha1_EtcdVersionSpec(ref), + "kubedb.dev/apimachinery/apis/catalog/v1alpha1.FerretDBVersion": schema_apimachinery_apis_catalog_v1alpha1_FerretDBVersion(ref), + "kubedb.dev/apimachinery/apis/catalog/v1alpha1.FerretDBVersionDatabase": schema_apimachinery_apis_catalog_v1alpha1_FerretDBVersionDatabase(ref), + "kubedb.dev/apimachinery/apis/catalog/v1alpha1.FerretDBVersionList": schema_apimachinery_apis_catalog_v1alpha1_FerretDBVersionList(ref), + "kubedb.dev/apimachinery/apis/catalog/v1alpha1.FerretDBVersionSpec": schema_apimachinery_apis_catalog_v1alpha1_FerretDBVersionSpec(ref), "kubedb.dev/apimachinery/apis/catalog/v1alpha1.GitSyncer": schema_apimachinery_apis_catalog_v1alpha1_GitSyncer(ref), "kubedb.dev/apimachinery/apis/catalog/v1alpha1.KafkaConnectorVersion": schema_apimachinery_apis_catalog_v1alpha1_KafkaConnectorVersion(ref), "kubedb.dev/apimachinery/apis/catalog/v1alpha1.KafkaConnectorVersionList": schema_apimachinery_apis_catalog_v1alpha1_KafkaConnectorVersionList(ref), @@ -23660,6 +23664,167 @@ func schema_apimachinery_apis_catalog_v1alpha1_EtcdVersionSpec(ref common.Refere } } +func schema_apimachinery_apis_catalog_v1alpha1_FerretDBVersion(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{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kubedb.dev/apimachinery/apis/catalog/v1alpha1.FerretDBVersionSpec"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "kubedb.dev/apimachinery/apis/catalog/v1alpha1.FerretDBVersionSpec"}, + } +} + +func schema_apimachinery_apis_catalog_v1alpha1_FerretDBVersionDatabase(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "FerretDBVersionDatabase is the FerretDB Database image", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "image": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"image"}, + }, + }, + } +} + +func schema_apimachinery_apis_catalog_v1alpha1_FerretDBVersionList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "FerretDBVersionList contains a list of FerretDBVersion", + 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{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kubedb.dev/apimachinery/apis/catalog/v1alpha1.FerretDBVersion"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "kubedb.dev/apimachinery/apis/catalog/v1alpha1.FerretDBVersion"}, + } +} + +func schema_apimachinery_apis_catalog_v1alpha1_FerretDBVersionSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "FerretDBVersionSpec defines the desired state of FerretDBVersion", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "version": { + SchemaProps: spec.SchemaProps{ + Description: "Version", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "db": { + SchemaProps: spec.SchemaProps{ + Description: "Database Image", + Default: map[string]interface{}{}, + Ref: ref("kubedb.dev/apimachinery/apis/catalog/v1alpha1.FerretDBVersionDatabase"), + }, + }, + "deprecated": { + SchemaProps: spec.SchemaProps{ + Description: "Deprecated versions usable but regarded as obsolete and best avoided, typically due to having been superseded.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "updateConstraints": { + SchemaProps: spec.SchemaProps{ + Description: "update constraints", + Default: map[string]interface{}{}, + Ref: ref("kubedb.dev/apimachinery/apis/catalog/v1alpha1.UpdateConstraints"), + }, + }, + "securityContext": { + SchemaProps: spec.SchemaProps{ + Description: "SecurityContext is for the additional security information for the FerretDB container", + Default: map[string]interface{}{}, + Ref: ref("kubedb.dev/apimachinery/apis/catalog/v1alpha1.SecurityContext"), + }, + }, + }, + Required: []string{"version", "db"}, + }, + }, + Dependencies: []string{ + "kubedb.dev/apimachinery/apis/catalog/v1alpha1.FerretDBVersionDatabase", "kubedb.dev/apimachinery/apis/catalog/v1alpha1.SecurityContext", "kubedb.dev/apimachinery/apis/catalog/v1alpha1.UpdateConstraints"}, + } +} + func schema_apimachinery_apis_catalog_v1alpha1_GitSyncer(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/apis/catalog/v1alpha1/register.go b/apis/catalog/v1alpha1/register.go index 0820e14a2b..3e7b29e064 100644 --- a/apis/catalog/v1alpha1/register.go +++ b/apis/catalog/v1alpha1/register.go @@ -60,6 +60,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &ElasticsearchVersionList{}, &EtcdVersion{}, &EtcdVersionList{}, + &FerretDBVersion{}, + &FerretDBVersionList{}, &KafkaVersion{}, &KafkaVersionList{}, &KafkaConnectorVersion{}, diff --git a/apis/catalog/v1alpha1/zz_generated.deepcopy.go b/apis/catalog/v1alpha1/zz_generated.deepcopy.go index 4293dd78e3..594258c92b 100644 --- a/apis/catalog/v1alpha1/zz_generated.deepcopy.go +++ b/apis/catalog/v1alpha1/zz_generated.deepcopy.go @@ -554,6 +554,101 @@ func (in *EtcdVersionSpec) DeepCopy() *EtcdVersionSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FerretDBVersion) DeepCopyInto(out *FerretDBVersion) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FerretDBVersion. +func (in *FerretDBVersion) DeepCopy() *FerretDBVersion { + if in == nil { + return nil + } + out := new(FerretDBVersion) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FerretDBVersion) 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 *FerretDBVersionDatabase) DeepCopyInto(out *FerretDBVersionDatabase) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FerretDBVersionDatabase. +func (in *FerretDBVersionDatabase) DeepCopy() *FerretDBVersionDatabase { + if in == nil { + return nil + } + out := new(FerretDBVersionDatabase) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FerretDBVersionList) DeepCopyInto(out *FerretDBVersionList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]FerretDBVersion, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FerretDBVersionList. +func (in *FerretDBVersionList) DeepCopy() *FerretDBVersionList { + if in == nil { + return nil + } + out := new(FerretDBVersionList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FerretDBVersionList) 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 *FerretDBVersionSpec) DeepCopyInto(out *FerretDBVersionSpec) { + *out = *in + out.DB = in.DB + in.UpdateConstraints.DeepCopyInto(&out.UpdateConstraints) + in.SecurityContext.DeepCopyInto(&out.SecurityContext) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FerretDBVersionSpec. +func (in *FerretDBVersionSpec) DeepCopy() *FerretDBVersionSpec { + if in == nil { + return nil + } + out := new(FerretDBVersionSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GitSyncer) DeepCopyInto(out *GitSyncer) { *out = *in diff --git a/apis/kubedb/v1alpha2/constants.go b/apis/kubedb/v1alpha2/constants.go index 3182ff3ebc..3800e604b0 100644 --- a/apis/kubedb/v1alpha2/constants.go +++ b/apis/kubedb/v1alpha2/constants.go @@ -1022,6 +1022,32 @@ const ( RabbitMQTempConfigDir = "/tmp/config/" ) +// =========================== FerretDB Constants ============================ +const ( + + // envs + EnvFerretDBUser = "FERRETDB_PG_USER" + EnvFerretDBPassword = "FERRETDB_PG_PASSWORD" + EnvFerretDBHandler = "FERRETDB_HANDLER" + EnvFerretDBPgURL = "FERRETDB_POSTGRESQL_URL" + EnvFerretDBTLSPort = "FERRETDB_LISTEN_TLS" + EnvFerretDBCAPath = "FERRETDB_LISTEN_TLS_CA_FILE" + EnvFerretDBCertPath = "FERRETDB_LISTEN_TLS_CERT_FILE" + EnvFerretDBKeyPath = "FERRETDB_LISTEN_TLS_KEY_FILE" + + FerretDBContainerName = "ferretdb" + FerretDBMainImage = "ghcr.io/ferretdb/ferretdb" + FerretDBUser = "postgres" + + FerretDBServerPath = "/etc/certs/server" + + FerretDBDefaultPort = 27017 + FerretDBMetricsPort = 8080 + FerretDBTLSPort = 27018 + + FerretDBMetricsPath = "/debug/metrics" +) + // Resource kind related constants const ( ResourceKindStatefulSet = "StatefulSet" diff --git a/apis/kubedb/v1alpha2/ferretdb_helpers.go b/apis/kubedb/v1alpha2/ferretdb_helpers.go new file mode 100644 index 0000000000..092470977f --- /dev/null +++ b/apis/kubedb/v1alpha2/ferretdb_helpers.go @@ -0,0 +1,290 @@ +/* +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 v1alpha2 + +import ( + "fmt" + + "kubedb.dev/apimachinery/apis" + "kubedb.dev/apimachinery/apis/kubedb" + "kubedb.dev/apimachinery/crds" + + "github.com/fatih/structs" + v1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" + "gomodules.xyz/pointer" + core "k8s.io/api/core/v1" + meta "k8s.io/apimachinery/pkg/apis/meta/v1" + kmapi "kmodules.xyz/client-go/api/v1" + "kmodules.xyz/client-go/apiextensions" + coreutil "kmodules.xyz/client-go/core/v1" + meta_util "kmodules.xyz/client-go/meta" + appcat "kmodules.xyz/custom-resources/apis/appcatalog/v1alpha1" + mona "kmodules.xyz/monitoring-agent-api/api/v1" + ofst "kmodules.xyz/offshoot-api/api/v2" +) + +func (f *FerretDB) CustomResourceDefinition() *apiextensions.CustomResourceDefinition { + return crds.MustCustomResourceDefinition(SchemeGroupVersion.WithResource(ResourcePluralFerretDB)) +} + +func (f *FerretDB) ResourcePlural() string { + return ResourcePluralFerretDB +} + +func (f *FerretDB) ResourceFQN() string { + return fmt.Sprintf("%s.%s", f.ResourcePlural(), "kubedb.com") +} + +func (f *FerretDB) ServiceName() string { + return f.Name +} + +type FerretDBApp struct { + *FerretDB +} + +func (f FerretDBApp) Name() string { + return f.FerretDB.Name +} + +func (f FerretDBApp) Type() appcat.AppType { + return appcat.AppType(fmt.Sprintf("%s/%s", kubedb.GroupName, ResourceSingularFerretDB)) +} + +func (f *FerretDB) AppBindingMeta() appcat.AppBindingMeta { + return &FerretDBApp{f} +} + +func (f *FerretDB) OffshootName() string { + return f.Name +} + +func (f *FerretDB) OffshootSelectors() map[string]string { + selector := map[string]string{ + meta_util.NameLabelKey: f.ResourceFQN(), + meta_util.InstanceLabelKey: f.Name, + meta_util.ManagedByLabelKey: "kubedb.com", + } + return selector +} + +func (f *FerretDB) PodControllerLabels(podControllerLabels map[string]string, extraLabels ...map[string]string) map[string]string { + return f.offshootLabels(meta_util.OverwriteKeys(f.OffshootSelectors(), extraLabels...), podControllerLabels) +} + +func (f *FerretDB) OffshootLabels() map[string]string { + return f.offshootLabels(f.OffshootSelectors(), nil) +} + +func (f *FerretDB) offshootLabels(selector, override map[string]string) map[string]string { + selector[meta_util.ComponentLabelKey] = ComponentDatabase + return meta_util.FilterKeys("kubedb.com", selector, meta_util.OverwriteKeys(nil, f.Labels, override)) +} + +func (f *FerretDB) GetAuthSecretName() string { + if f.Spec.AuthSecret != nil && f.Spec.AuthSecret.Name != "" { + return f.Spec.AuthSecret.Name + } + return meta_util.NameWithSuffix(f.PgBackendName(), "auth") +} + +// AsOwner returns owner reference to resources +func (f *FerretDB) AsOwner() *meta.OwnerReference { + return meta.NewControllerRef(f, SchemeGroupVersion.WithKind(f.ResourceKind())) +} + +func (f *FerretDB) ResourceKind() string { + return ResourceKindFerretDB +} + +func (f *FerretDB) PgBackendName() string { + return f.OffshootName() + "-pg-backend" +} + +func (f *FerretDB) PodLabels(podTemplateLabels map[string]string, extraLabels ...map[string]string) map[string]string { + return f.offshootLabels(meta_util.OverwriteKeys(f.OffshootSelectors(), extraLabels...), podTemplateLabels) +} + +func (f *FerretDB) CertificateName(alias FerretDBCertificateAlias) string { + return meta_util.NameWithSuffix(f.Name, fmt.Sprintf("%s-cert", string(alias))) +} + +func (f *FerretDB) GetCertSecretName(alias FerretDBCertificateAlias) string { + name, ok := kmapi.GetCertificateSecretName(f.Spec.TLS.Certificates, string(alias)) + if ok { + return name + } + + return f.CertificateName(alias) +} + +func (f *FerretDB) SetHealthCheckerDefaults() { + if f.Spec.HealthChecker.PeriodSeconds == nil { + f.Spec.HealthChecker.PeriodSeconds = pointer.Int32P(10) + } + if f.Spec.HealthChecker.TimeoutSeconds == nil { + f.Spec.HealthChecker.TimeoutSeconds = pointer.Int32P(10) + } + if f.Spec.HealthChecker.FailureThreshold == nil { + f.Spec.HealthChecker.FailureThreshold = pointer.Int32P(2) + } +} + +func (f *FerretDB) SetDefaults() { + if f == nil { + return + } + if f.Spec.StorageType == "" { + f.Spec.StorageType = StorageTypeDurable + } + + if f.Spec.TerminationPolicy == "" { + f.Spec.TerminationPolicy = TerminationPolicyDelete + } + + if f.Spec.SSLMode == "" { + f.Spec.SSLMode = SSLModeDisabled + } + + if f.Spec.Replicas == nil { + f.Spec.Replicas = pointer.Int32P(1) + } + + if f.Spec.PodTemplate == nil { + f.Spec.PodTemplate = &ofst.PodTemplateSpec{} + } + + dbContainer := coreutil.GetContainerByName(f.Spec.PodTemplate.Spec.Containers, FerretDBContainerName) + if dbContainer == nil { + dbContainer = &core.Container{ + Name: FerretDBContainerName, + } + f.Spec.PodTemplate.Spec.Containers = append(f.Spec.PodTemplate.Spec.Containers, *dbContainer) + } + if structs.IsZero(dbContainer.Resources) { + apis.SetDefaultResourceLimits(&dbContainer.Resources, DefaultResources) + } + + if f.Spec.Backend.LinkedDB == "" { + if f.Spec.Backend.ExternallyManaged { + f.Spec.Backend.LinkedDB = "postgres" + } else { + f.Spec.Backend.LinkedDB = "ferretdb" + } + } + if f.Spec.Monitor != nil && f.Spec.Monitor.Prometheus.Exporter.Port == 0 { + // 56790 is default port for Prometheus operator. + f.Spec.Monitor.Prometheus.Exporter.Port = 56790 + } + defaultVersion := "13.13" + if !f.Spec.Backend.ExternallyManaged && f.Spec.Backend.Postgres == nil { + f.Spec.Backend.Postgres = &PostgresRef{ + Version: &defaultVersion, + } + } + f.SetTLSDefaults() + f.SetHealthCheckerDefaults() +} + +func (f *FerretDB) SetTLSDefaults() { + if f.Spec.TLS == nil || f.Spec.TLS.IssuerRef == nil { + return + } + + defaultServerOrg := []string{KubeDBOrganization} + defaultServerOrgUnit := []string{string(FerretDBServerCert)} + + _, cert := kmapi.GetCertificate(f.Spec.TLS.Certificates, string(FerretDBServerCert)) + if cert != nil && cert.Subject != nil { + if cert.Subject.Organizations != nil { + defaultServerOrg = cert.Subject.Organizations + } + if cert.Subject.OrganizationalUnits != nil { + defaultServerOrgUnit = cert.Subject.OrganizationalUnits + } + } + f.Spec.TLS.Certificates = kmapi.SetMissingSpecForCertificate(f.Spec.TLS.Certificates, kmapi.CertificateSpec{ + Alias: string(FerretDBServerCert), + SecretName: f.GetCertSecretName(FerretDBServerCert), + Subject: &kmapi.X509Subject{ + Organizations: defaultServerOrg, + OrganizationalUnits: defaultServerOrgUnit, + }, + }) + + // Client-cert + defaultClientOrg := []string{KubeDBOrganization} + defaultClientOrgUnit := []string{string(FerretDBClientCert)} + _, cert = kmapi.GetCertificate(f.Spec.TLS.Certificates, string(FerretDBClientCert)) + if cert != nil && cert.Subject != nil { + if cert.Subject.Organizations != nil { + defaultClientOrg = cert.Subject.Organizations + } + if cert.Subject.OrganizationalUnits != nil { + defaultClientOrgUnit = cert.Subject.OrganizationalUnits + } + } + f.Spec.TLS.Certificates = kmapi.SetMissingSpecForCertificate(f.Spec.TLS.Certificates, kmapi.CertificateSpec{ + Alias: string(FerretDBClientCert), + SecretName: f.GetCertSecretName(FerretDBClientCert), + Subject: &kmapi.X509Subject{ + Organizations: defaultClientOrg, + OrganizationalUnits: defaultClientOrgUnit, + }, + }) +} + +type FerretDBStatsService struct { + *FerretDB +} + +func (fs FerretDBStatsService) ServiceMonitorName() string { + return fs.OffshootName() + "-stats" +} + +func (fs FerretDBStatsService) ServiceMonitorAdditionalLabels() map[string]string { + return fs.OffshootLabels() +} + +func (fs FerretDBStatsService) Path() string { + return FerretDBMetricsPath +} + +func (fs FerretDBStatsService) Scheme() string { + return "" +} + +func (fs FerretDBStatsService) TLSConfig() *v1.TLSConfig { + return nil +} + +func (fs FerretDBStatsService) ServiceName() string { + return fs.OffshootName() + "-stats" +} + +func (f *FerretDB) StatsService() mona.StatsAccessor { + return &FerretDBStatsService{f} +} + +func (f *FerretDB) ServiceLabels(alias ServiceAlias, extraLabels ...map[string]string) map[string]string { + svcTemplate := GetServiceTemplate(f.Spec.ServiceTemplates, alias) + return f.offshootLabels(meta_util.OverwriteKeys(f.OffshootSelectors(), extraLabels...), svcTemplate.Labels) +} + +func (f *FerretDB) StatsServiceLabels() map[string]string { + return f.ServiceLabels(StatsServiceAlias, map[string]string{LabelRole: RoleStats}) +} diff --git a/apis/kubedb/v1alpha2/ferretdb_types.go b/apis/kubedb/v1alpha2/ferretdb_types.go new file mode 100644 index 0000000000..8999ca08ab --- /dev/null +++ b/apis/kubedb/v1alpha2/ferretdb_types.go @@ -0,0 +1,164 @@ +/* +Copyright 2023. + +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 v1alpha2 + +import ( + core "k8s.io/api/core/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + kmapi "kmodules.xyz/client-go/api/v1" + mona "kmodules.xyz/monitoring-agent-api/api/v1" + ofst "kmodules.xyz/offshoot-api/api/v2" +) + +const ( + ResourceCodeFerretDB = "fr" + ResourceKindFerretDB = "FerretDB" + ResourceSingularFerretDB = "ferretdb" + ResourcePluralFerretDB = "ferretdbs" +) + +// +genclient +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:shortName=fr,scope=Namespaced +// +kubebuilder:printcolumn:name="Namespace",type="string",JSONPath=".metadata.namespace" +// +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".spec.version" +// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase" +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +type FerretDB struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec FerretDBSpec `json:"spec,omitempty"` + Status FerretDBStatus `json:"status,omitempty"` +} + +type FerretDBSpec struct { + // Version of FerretDB to be deployed. + Version string `json:"version"` + + // Number of instances to deploy for a FerretDB database. + Replicas *int32 `json:"replicas,omitempty"` + + // Database authentication secret + // +optional + AuthSecret *SecretReference `json:"authSecret,omitempty"` + + // See more options: https://docs.ferretdb.io/security/tls-connections/ + // +optional + SSLMode SSLMode `json:"sslMode,omitempty"` + + // PodTemplate is an optional configuration for pods used to expose database + // +optional + PodTemplate *ofst.PodTemplateSpec `json:"podTemplate,omitempty"` + + // ServiceTemplates is an optional configuration for services used to expose database + // +optional + ServiceTemplates []NamedServiceTemplateSpec `json:"serviceTemplates,omitempty"` + + // TLS contains tls configurations for client and server. + // +optional + TLS *kmapi.TLSConfig `json:"tls,omitempty"` + + // Indicates that the database is halted and all offshoot Kubernetes resources except PVCs are deleted. + // +optional + Halted bool `json:"halted,omitempty"` + + // StorageType can be durable (default) or ephemeral for KubeDB Backend + // +optional + StorageType StorageType `json:"storageType,omitempty"` + + // Storage to specify how storage shall be used for KubeDB Backend. + Storage *core.PersistentVolumeClaimSpec `json:"storage,omitempty"` + + // TerminationPolicy controls the delete operation for database and KubeDB Backend + // +optional + TerminationPolicy TerminationPolicy `json:"terminationPolicy,omitempty"` + + // HealthChecker defines attributes of the health checker + // +optional + // +kubebuilder:default={periodSeconds: 10, timeoutSeconds: 10, failureThreshold: 1} + HealthChecker kmapi.HealthCheckSpec `json:"healthChecker"` + + // Monitor is used monitor database instance and KubeDB Backend + // +optional + Monitor *mona.AgentSpec `json:"monitor,omitempty"` + + Backend *Backend `json:"backend"` +} + +type FerretDBStatus struct { + // Specifies the current phase of the database + // +optional + Phase DatabasePhase `json:"phase,omitempty"` + // observedGeneration is the most recent generation observed for this resource. It corresponds to the + // resource's generation, which is updated on mutation by the API Server. + // +optional + ObservedGeneration int64 `json:"observedGeneration,omitempty"` + // Conditions applied to the database, such as approval or denial. + // +optional + Conditions []kmapi.Condition `json:"conditions,omitempty"` +} + +// +kubebuilder:validation:Enum=server;client; +type FerretDBCertificateAlias string + +const ( + FerretDBServerCert FerretDBCertificateAlias = "server" + FerretDBClientCert FerretDBCertificateAlias = "client" +) + +type Backend struct { + // +optional + Postgres *PostgresRef `json:"postgres,omitempty"` + // A DB inside backend specifically made for ferretdb + // +optional + LinkedDB string `json:"linkedDB,omitempty"` + ExternallyManaged bool `json:"externallyManaged,omitempty"` +} + +type PostgresRef struct { + // Postgres URL address + // +optional + URL *string `json:"url,omitempty"` + // Service information for Postgres + // +optional + Service *PostgresServiceRef `json:"service,omitempty"` + // Which versions pg will be used as backend of ferretdb + // +optional + Version *string `json:"version"` +} + +type PostgresServiceRef struct { + Name string `json:"name"` + Namespace string `json:"namespace"` + // PgPort is used because the service referred to the + // pg pod can have any port between 1 and 65535, inclusive + // but targetPort is fixed to 5432 + PgPort string `json:"pgPort"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +type FerretDBList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []FerretDB `json:"items"` +} diff --git a/apis/kubedb/v1alpha2/ferretdb_webhook.go b/apis/kubedb/v1alpha2/ferretdb_webhook.go new file mode 100644 index 0000000000..bb604added --- /dev/null +++ b/apis/kubedb/v1alpha2/ferretdb_webhook.go @@ -0,0 +1,232 @@ +/* +Copyright 2023. + +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 v1alpha2 + +import ( + "context" + "errors" + "fmt" + + "kubedb.dev/apimachinery/apis/catalog/v1alpha1" + + "gomodules.xyz/x/arrays" + core "k8s.io/api/core/v1" + apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/util/validation/field" + ctrl "sigs.k8s.io/controller-runtime" + 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 ferretdblog = logf.Log.WithName("ferretdb-resource") + +func (f *FerretDB) SetupWebhookWithManager(mgr ctrl.Manager) error { + return ctrl.NewWebhookManagedBy(mgr). + For(f). + Complete() +} + +//+kubebuilder:webhook:path=/mutate-kubedb-com-v1alpha2-ferretdb,mutating=true,failurePolicy=fail,sideEffects=None,groups=kubedb.com,resources=ferretdbs,verbs=create;update,versions=v1alpha2,name=mferretdb.kb.io,admissionReviewVersions=v1 + +var _ webhook.Defaulter = &FerretDB{} + +// Default implements webhook.Defaulter so a webhook will be registered for the type +func (f *FerretDB) Default() { + if f == nil { + return + } + ferretdblog.Info("default", "name", f.Name) + f.SetDefaults() +} + +//+kubebuilder:webhook:path=/validate-kubedb-com-v1alpha2-ferretdb,mutating=false,failurePolicy=fail,sideEffects=None,groups=kubedb.com,resources=ferretdbs,verbs=create;update;delete,versions=v1alpha2,name=vferretdb.kb.io,admissionReviewVersions=v1 + +var _ webhook.Validator = &FerretDB{} + +// ValidateCreate implements webhook.Validator so a webhook will be registered for the type +func (f *FerretDB) ValidateCreate() (admission.Warnings, error) { + ferretdblog.Info("validate create", "name", f.Name) + + allErr := f.ValidateCreateOrUpdate() + if len(allErr) == 0 { + return nil, nil + } + return nil, apierrors.NewInvalid(schema.GroupKind{Group: "kubedb.com", Kind: "FerretDB"}, f.Name, allErr) +} + +// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type +func (f *FerretDB) ValidateUpdate(old runtime.Object) (admission.Warnings, error) { + ferretdblog.Info("validate update", "name", f.Name) + + _ = old.(*FerretDB) + allErr := f.ValidateCreateOrUpdate() + if len(allErr) == 0 { + return nil, nil + } + return nil, apierrors.NewInvalid(schema.GroupKind{Group: "kubedb.com", Kind: "FerretDB"}, f.Name, allErr) +} + +// ValidateDelete implements webhook.Validator so a webhook will be registered for the type +func (f *FerretDB) ValidateDelete() (admission.Warnings, error) { + ferretdblog.Info("validate delete", "name", f.Name) + + var allErr field.ErrorList + if f.Spec.TerminationPolicy == TerminationPolicyDoNotTerminate { + allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("terminationPolicy"), + f.Name, + "Can not delete as terminationPolicy is set to \"DoNotTerminate\"")) + return nil, apierrors.NewInvalid(schema.GroupKind{Group: "kubedb.com", Kind: "FerretDB"}, f.Name, allErr) + } + return nil, nil +} + +func (f *FerretDB) ValidateCreateOrUpdate() field.ErrorList { + var allErr field.ErrorList + + err := f.validateFerretDBVersion() + if err != nil { + allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("version"), + f.Name, + err.Error())) + } + if f.Spec.Replicas == nil || *f.Spec.Replicas < 1 { + allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("replicas"), + f.Name, + fmt.Sprintf(`spec.replicas "%v" invalid. Must be greater than zero`, f.Spec.Replicas))) + } + + if f.Spec.PodTemplate != nil { + if err := FerretDBValidateEnvVar(getMainContainerEnvs(f), forbiddenEnvVars, f.ResourceKind()); err != nil { + allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("podTemplate"), + f.Name, + err.Error())) + } + } + + if f.Spec.StorageType == "" { + allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("storageType"), + f.Name, + `'spec.storageType' is missing`)) + } + if f.Spec.StorageType != StorageTypeDurable && f.Spec.StorageType != StorageTypeEphemeral { + allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("storageType"), + f.Name, + fmt.Sprintf(`'spec.storageType' %s is invalid`, f.Spec.StorageType))) + } + if f.Spec.StorageType == StorageTypeEphemeral && f.Spec.Storage != nil { + allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("storageType"), + f.Name, + `'spec.storageType' is set to Ephemeral, so 'spec.storage' needs to be empty`)) + } + + if f.Spec.AuthSecret != nil && f.Spec.AuthSecret.ExternallyManaged != f.Spec.Backend.ExternallyManaged { + allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("authSecret"), + f.Name, + `when 'spec.backend' is internally manager, 'spec.authSecret' can't be externally managed and vice versa`)) + } + + if f.Spec.AuthSecret != nil && f.Spec.AuthSecret.ExternallyManaged && f.Spec.AuthSecret.Name == "" { + allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("authSecret"), + f.Name, + `for externallyManaged auth secret, user must configure "spec.authSecret.name"`)) + } + if f.Spec.StorageType == StorageTypeEphemeral && f.Spec.TerminationPolicy == TerminationPolicyHalt { + allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("storageType"), + f.Name, + `'spec.terminationPolicy: Halt' can not be used for 'Ephemeral' storage`)) + } + if f.Spec.TerminationPolicy == "" { + allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("terminationPolicy"), + f.Name, + `'spec.terminationPolicy' is missing`)) + } + if f.Spec.TerminationPolicy == TerminationPolicyHalt || f.Spec.TerminationPolicy == TerminationPolicyDelete { + allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("terminationPolicy"), + f.Name, + `'spec.terminationPolicy' value 'Halt' or 'Delete' is not supported yet for FerretDB`)) + } + + if f.Spec.Backend.ExternallyManaged { + if f.Spec.Backend.Postgres == nil { + allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("backend"), + f.Name, + `'spec.postgres' is missing when backend is externally managed`)) + } + } + if f.Spec.SSLMode == SSLModeAllowSSL || f.Spec.SSLMode == SSLModePreferSSL { + allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("sslMode"), + f.Name, + `'spec.sslMode' value 'allowSSL' or 'preferSSL' is not supported yet for FerretDB`)) + } + if !f.Spec.Backend.ExternallyManaged && f.Spec.Backend.Postgres != nil && f.Spec.Backend.Postgres.Version != nil { + err := f.validatePostgresVersion() + if err != nil { + allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("backend"), + f.Name, + err.Error())) + } + } + + return allErr +} + +func FerretDBValidateEnvVar(envs []core.EnvVar, forbiddenEnvs []string, resourceType string) error { + for _, env := range envs { + present, _ := arrays.Contains(forbiddenEnvs, env.Name) + if present { + return fmt.Errorf("environment variable %s is forbidden to use in %s spec", env.Name, resourceType) + } + } + return nil +} + +var forbiddenEnvVars = []string{ + EnvFerretDBUser, EnvFerretDBPassword, EnvFerretDBHandler, EnvFerretDBPgURL, + EnvFerretDBTLSPort, EnvFerretDBCAPath, EnvFerretDBCertPath, EnvFerretDBKeyPath, +} + +func getMainContainerEnvs(f *FerretDB) []core.EnvVar { + for _, container := range f.Spec.PodTemplate.Spec.Containers { + if container.Name == FerretDBContainerName { + return container.Env + } + } + return []core.EnvVar{} +} + +func (f *FerretDB) validateFerretDBVersion() error { + frVersion := v1alpha1.FerretDBVersion{} + err := DefaultClient.Get(context.TODO(), types.NamespacedName{Name: f.Spec.Version}, &frVersion) + if err != nil { + return errors.New("version not supported") + } + return nil +} + +func (f *FerretDB) validatePostgresVersion() error { + pgVersion := v1alpha1.PostgresVersion{} + err := DefaultClient.Get(context.TODO(), types.NamespacedName{Name: *f.Spec.Backend.Postgres.Version}, &pgVersion) + if err != nil { + return errors.New("postgres version not supported in KubeDB") + } + return nil +} diff --git a/apis/kubedb/v1alpha2/openapi_generated.go b/apis/kubedb/v1alpha2/openapi_generated.go index 5dd9eb35b1..19c0c8e568 100644 --- a/apis/kubedb/v1alpha2/openapi_generated.go +++ b/apis/kubedb/v1alpha2/openapi_generated.go @@ -461,6 +461,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.Archiver": schema_apimachinery_apis_kubedb_v1alpha2_Archiver(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.ArchiverRecovery": schema_apimachinery_apis_kubedb_v1alpha2_ArchiverRecovery(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.AutoOpsSpec": schema_apimachinery_apis_kubedb_v1alpha2_AutoOpsSpec(ref), + "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.Backend": schema_apimachinery_apis_kubedb_v1alpha2_Backend(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.ConnectionPoolConfig": schema_apimachinery_apis_kubedb_v1alpha2_ConnectionPoolConfig(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.ConsumerNamespaces": schema_apimachinery_apis_kubedb_v1alpha2_ConsumerNamespaces(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.CoordinatorSpec": schema_apimachinery_apis_kubedb_v1alpha2_CoordinatorSpec(ref), @@ -485,6 +486,12 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.EtcdList": schema_apimachinery_apis_kubedb_v1alpha2_EtcdList(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.EtcdSpec": schema_apimachinery_apis_kubedb_v1alpha2_EtcdSpec(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.EtcdStatus": schema_apimachinery_apis_kubedb_v1alpha2_EtcdStatus(ref), + "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.FerretDB": schema_apimachinery_apis_kubedb_v1alpha2_FerretDB(ref), + "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.FerretDBApp": schema_apimachinery_apis_kubedb_v1alpha2_FerretDBApp(ref), + "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.FerretDBList": schema_apimachinery_apis_kubedb_v1alpha2_FerretDBList(ref), + "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.FerretDBSpec": schema_apimachinery_apis_kubedb_v1alpha2_FerretDBSpec(ref), + "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.FerretDBStatsService": schema_apimachinery_apis_kubedb_v1alpha2_FerretDBStatsService(ref), + "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.FerretDBStatus": schema_apimachinery_apis_kubedb_v1alpha2_FerretDBStatus(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.GitRepo": schema_apimachinery_apis_kubedb_v1alpha2_GitRepo(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.InitSpec": schema_apimachinery_apis_kubedb_v1alpha2_InitSpec(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.Kafka": schema_apimachinery_apis_kubedb_v1alpha2_Kafka(ref), @@ -545,6 +552,8 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.PostgreLeaderElectionConfig": schema_apimachinery_apis_kubedb_v1alpha2_PostgreLeaderElectionConfig(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.Postgres": schema_apimachinery_apis_kubedb_v1alpha2_Postgres(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.PostgresList": schema_apimachinery_apis_kubedb_v1alpha2_PostgresList(ref), + "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.PostgresRef": schema_apimachinery_apis_kubedb_v1alpha2_PostgresRef(ref), + "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.PostgresServiceRef": schema_apimachinery_apis_kubedb_v1alpha2_PostgresServiceRef(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.PostgresSpec": schema_apimachinery_apis_kubedb_v1alpha2_PostgresSpec(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.PostgresStatus": schema_apimachinery_apis_kubedb_v1alpha2_PostgresStatus(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.ProxySQL": schema_apimachinery_apis_kubedb_v1alpha2_ProxySQL(ref), @@ -22977,6 +22986,38 @@ func schema_apimachinery_apis_kubedb_v1alpha2_AutoOpsSpec(ref common.ReferenceCa } } +func schema_apimachinery_apis_kubedb_v1alpha2_Backend(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "postgres": { + SchemaProps: spec.SchemaProps{ + Ref: ref("kubedb.dev/apimachinery/apis/kubedb/v1alpha2.PostgresRef"), + }, + }, + "linkedDB": { + SchemaProps: spec.SchemaProps{ + Description: "A DB inside backend specifically made for ferretdb", + Type: []string{"string"}, + Format: "", + }, + }, + "externallyManaged": { + SchemaProps: spec.SchemaProps{ + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.PostgresRef"}, + } +} + func schema_apimachinery_apis_kubedb_v1alpha2_ConnectionPoolConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -24572,6 +24613,296 @@ func schema_apimachinery_apis_kubedb_v1alpha2_EtcdStatus(ref common.ReferenceCal } } +func schema_apimachinery_apis_kubedb_v1alpha2_FerretDB(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{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta"), + }, + }, + "spec": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kubedb.dev/apimachinery/apis/kubedb/v1alpha2.FerretDBSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kubedb.dev/apimachinery/apis/kubedb/v1alpha2.FerretDBStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.FerretDBSpec", "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.FerretDBStatus"}, + } +} + +func schema_apimachinery_apis_kubedb_v1alpha2_FerretDBApp(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "FerretDB": { + SchemaProps: spec.SchemaProps{ + Ref: ref("kubedb.dev/apimachinery/apis/kubedb/v1alpha2.FerretDB"), + }, + }, + }, + Required: []string{"FerretDB"}, + }, + }, + Dependencies: []string{ + "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.FerretDB"}, + } +} + +func schema_apimachinery_apis_kubedb_v1alpha2_FerretDBList(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{ + Default: map[string]interface{}{}, + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta"), + }, + }, + "items": { + SchemaProps: spec.SchemaProps{ + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kubedb.dev/apimachinery/apis/kubedb/v1alpha2.FerretDB"), + }, + }, + }, + }, + }, + }, + Required: []string{"items"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.FerretDB"}, + } +} + +func schema_apimachinery_apis_kubedb_v1alpha2_FerretDBSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "version": { + SchemaProps: spec.SchemaProps{ + Description: "Version of FerretDB to be deployed.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "replicas": { + SchemaProps: spec.SchemaProps{ + Description: "Number of instances to deploy for a FerretDB database.", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "authSecret": { + SchemaProps: spec.SchemaProps{ + Description: "Database authentication secret", + Ref: ref("kubedb.dev/apimachinery/apis/kubedb/v1alpha2.SecretReference"), + }, + }, + "sslMode": { + SchemaProps: spec.SchemaProps{ + Description: "See more options: https://docs.ferretdb.io/security/tls-connections/", + Type: []string{"string"}, + Format: "", + }, + }, + "podTemplate": { + SchemaProps: spec.SchemaProps{ + Description: "PodTemplate is an optional configuration for pods used to expose database", + Ref: ref("kmodules.xyz/offshoot-api/api/v2.PodTemplateSpec"), + }, + }, + "serviceTemplates": { + SchemaProps: spec.SchemaProps{ + Description: "ServiceTemplates is an optional configuration for services used to expose database", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kubedb.dev/apimachinery/apis/kubedb/v1alpha2.NamedServiceTemplateSpec"), + }, + }, + }, + }, + }, + "tls": { + SchemaProps: spec.SchemaProps{ + Description: "TLS contains tls configurations for client and server.", + Ref: ref("kmodules.xyz/client-go/api/v1.TLSConfig"), + }, + }, + "halted": { + SchemaProps: spec.SchemaProps{ + Description: "Indicates that the database is halted and all offshoot Kubernetes resources except PVCs are deleted.", + Type: []string{"boolean"}, + Format: "", + }, + }, + "storageType": { + SchemaProps: spec.SchemaProps{ + Description: "StorageType can be durable (default) or ephemeral for KubeDB Backend", + Type: []string{"string"}, + Format: "", + }, + }, + "storage": { + SchemaProps: spec.SchemaProps{ + Description: "Storage to specify how storage shall be used for KubeDB Backend.", + Ref: ref("k8s.io/api/core/v1.PersistentVolumeClaimSpec"), + }, + }, + "terminationPolicy": { + SchemaProps: spec.SchemaProps{ + Description: "TerminationPolicy controls the delete operation for database and KubeDB Backend", + Type: []string{"string"}, + Format: "", + }, + }, + "healthChecker": { + SchemaProps: spec.SchemaProps{ + Description: "HealthChecker defines attributes of the health checker", + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/client-go/api/v1.HealthCheckSpec"), + }, + }, + "monitor": { + SchemaProps: spec.SchemaProps{ + Description: "Monitor is used monitor database instance and KubeDB Backend", + Ref: ref("kmodules.xyz/monitoring-agent-api/api/v1.AgentSpec"), + }, + }, + "backend": { + SchemaProps: spec.SchemaProps{ + Ref: ref("kubedb.dev/apimachinery/apis/kubedb/v1alpha2.Backend"), + }, + }, + }, + Required: []string{"version", "backend"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.PersistentVolumeClaimSpec", "kmodules.xyz/client-go/api/v1.HealthCheckSpec", "kmodules.xyz/client-go/api/v1.TLSConfig", "kmodules.xyz/monitoring-agent-api/api/v1.AgentSpec", "kmodules.xyz/offshoot-api/api/v2.PodTemplateSpec", "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.Backend", "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.NamedServiceTemplateSpec", "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.SecretReference"}, + } +} + +func schema_apimachinery_apis_kubedb_v1alpha2_FerretDBStatsService(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "FerretDB": { + SchemaProps: spec.SchemaProps{ + Ref: ref("kubedb.dev/apimachinery/apis/kubedb/v1alpha2.FerretDB"), + }, + }, + }, + Required: []string{"FerretDB"}, + }, + }, + Dependencies: []string{ + "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.FerretDB"}, + } +} + +func schema_apimachinery_apis_kubedb_v1alpha2_FerretDBStatus(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "phase": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies the current phase of the database", + Type: []string{"string"}, + Format: "", + }, + }, + "observedGeneration": { + SchemaProps: spec.SchemaProps{ + Description: "observedGeneration is the most recent generation observed for this resource. It corresponds to the resource's generation, which is updated on mutation by the API Server.", + Type: []string{"integer"}, + Format: "int64", + }, + }, + "conditions": { + SchemaProps: spec.SchemaProps{ + Description: "Conditions applied to the database, such as approval or denial.", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/client-go/api/v1.Condition"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "kmodules.xyz/client-go/api/v1.Condition"}, + } +} + func schema_apimachinery_apis_kubedb_v1alpha2_GitRepo(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -27965,6 +28296,75 @@ func schema_apimachinery_apis_kubedb_v1alpha2_PostgresList(ref common.ReferenceC } } +func schema_apimachinery_apis_kubedb_v1alpha2_PostgresRef(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "url": { + SchemaProps: spec.SchemaProps{ + Description: "Postgres URL address", + Type: []string{"string"}, + Format: "", + }, + }, + "service": { + SchemaProps: spec.SchemaProps{ + Description: "Service information for Postgres", + Ref: ref("kubedb.dev/apimachinery/apis/kubedb/v1alpha2.PostgresServiceRef"), + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Description: "Which versions pg will be used as backend of ferretdb", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.PostgresServiceRef"}, + } +} + +func schema_apimachinery_apis_kubedb_v1alpha2_PostgresServiceRef(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "name": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "namespace": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "pgPort": { + SchemaProps: spec.SchemaProps{ + Description: "PgPort is used because the service referred to the pg pod can have any port between 1 and 65535, inclusive but targetPort is fixed to 5432", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + Required: []string{"name", "namespace", "pgPort"}, + }, + }, + } +} + func schema_apimachinery_apis_kubedb_v1alpha2_PostgresSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/apis/kubedb/v1alpha2/register.go b/apis/kubedb/v1alpha2/register.go index 8f372a2873..6e071d91e7 100644 --- a/apis/kubedb/v1alpha2/register.go +++ b/apis/kubedb/v1alpha2/register.go @@ -60,6 +60,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &ElasticsearchList{}, &Etcd{}, &EtcdList{}, + &FerretDB{}, + &FerretDBList{}, &Kafka{}, &KafkaList{}, &MariaDB{}, diff --git a/apis/kubedb/v1alpha2/zz_generated.deepcopy.go b/apis/kubedb/v1alpha2/zz_generated.deepcopy.go index cbfa267a53..10b494ef2c 100644 --- a/apis/kubedb/v1alpha2/zz_generated.deepcopy.go +++ b/apis/kubedb/v1alpha2/zz_generated.deepcopy.go @@ -171,6 +171,27 @@ func (in *AutoOpsSpec) DeepCopy() *AutoOpsSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Backend) DeepCopyInto(out *Backend) { + *out = *in + if in.Postgres != nil { + in, out := &in.Postgres, &out.Postgres + *out = new(PostgresRef) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Backend. +func (in *Backend) DeepCopy() *Backend { + if in == nil { + return nil + } + out := new(Backend) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *ConnectionPoolConfig) DeepCopyInto(out *ConnectionPoolConfig) { *out = *in @@ -1112,6 +1133,191 @@ func (in *EtcdStatus) DeepCopy() *EtcdStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FerretDB) DeepCopyInto(out *FerretDB) { + *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 FerretDB. +func (in *FerretDB) DeepCopy() *FerretDB { + if in == nil { + return nil + } + out := new(FerretDB) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FerretDB) 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 *FerretDBApp) DeepCopyInto(out *FerretDBApp) { + *out = *in + if in.FerretDB != nil { + in, out := &in.FerretDB, &out.FerretDB + *out = new(FerretDB) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FerretDBApp. +func (in *FerretDBApp) DeepCopy() *FerretDBApp { + if in == nil { + return nil + } + out := new(FerretDBApp) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FerretDBList) DeepCopyInto(out *FerretDBList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]FerretDB, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FerretDBList. +func (in *FerretDBList) DeepCopy() *FerretDBList { + if in == nil { + return nil + } + out := new(FerretDBList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *FerretDBList) 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 *FerretDBSpec) DeepCopyInto(out *FerretDBSpec) { + *out = *in + if in.Replicas != nil { + in, out := &in.Replicas, &out.Replicas + *out = new(int32) + **out = **in + } + if in.AuthSecret != nil { + in, out := &in.AuthSecret, &out.AuthSecret + *out = new(SecretReference) + **out = **in + } + if in.PodTemplate != nil { + in, out := &in.PodTemplate, &out.PodTemplate + *out = new(v2.PodTemplateSpec) + (*in).DeepCopyInto(*out) + } + if in.ServiceTemplates != nil { + in, out := &in.ServiceTemplates, &out.ServiceTemplates + *out = make([]NamedServiceTemplateSpec, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.TLS != nil { + in, out := &in.TLS, &out.TLS + *out = new(apiv1.TLSConfig) + (*in).DeepCopyInto(*out) + } + if in.Storage != nil { + in, out := &in.Storage, &out.Storage + *out = new(corev1.PersistentVolumeClaimSpec) + (*in).DeepCopyInto(*out) + } + in.HealthChecker.DeepCopyInto(&out.HealthChecker) + if in.Monitor != nil { + in, out := &in.Monitor, &out.Monitor + *out = new(monitoringagentapiapiv1.AgentSpec) + (*in).DeepCopyInto(*out) + } + if in.Backend != nil { + in, out := &in.Backend, &out.Backend + *out = new(Backend) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FerretDBSpec. +func (in *FerretDBSpec) DeepCopy() *FerretDBSpec { + if in == nil { + return nil + } + out := new(FerretDBSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FerretDBStatsService) DeepCopyInto(out *FerretDBStatsService) { + *out = *in + if in.FerretDB != nil { + in, out := &in.FerretDB, &out.FerretDB + *out = new(FerretDB) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FerretDBStatsService. +func (in *FerretDBStatsService) DeepCopy() *FerretDBStatsService { + if in == nil { + return nil + } + out := new(FerretDBStatsService) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *FerretDBStatus) DeepCopyInto(out *FerretDBStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]apiv1.Condition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FerretDBStatus. +func (in *FerretDBStatus) DeepCopy() *FerretDBStatus { + if in == nil { + return nil + } + out := new(FerretDBStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *GitRepo) DeepCopyInto(out *GitRepo) { *out = *in @@ -3077,6 +3283,53 @@ func (in *PostgresList) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PostgresRef) DeepCopyInto(out *PostgresRef) { + *out = *in + if in.URL != nil { + in, out := &in.URL, &out.URL + *out = new(string) + **out = **in + } + if in.Service != nil { + in, out := &in.Service, &out.Service + *out = new(PostgresServiceRef) + **out = **in + } + if in.Version != nil { + in, out := &in.Version, &out.Version + *out = new(string) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PostgresRef. +func (in *PostgresRef) DeepCopy() *PostgresRef { + if in == nil { + return nil + } + out := new(PostgresRef) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PostgresServiceRef) DeepCopyInto(out *PostgresServiceRef) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PostgresServiceRef. +func (in *PostgresServiceRef) DeepCopy() *PostgresServiceRef { + if in == nil { + return nil + } + out := new(PostgresServiceRef) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PostgresSpec) DeepCopyInto(out *PostgresSpec) { *out = *in diff --git a/client/clientset/versioned/typed/catalog/v1alpha1/catalog_client.go b/client/clientset/versioned/typed/catalog/v1alpha1/catalog_client.go index 4be8ad35ba..d3f1438c34 100644 --- a/client/clientset/versioned/typed/catalog/v1alpha1/catalog_client.go +++ b/client/clientset/versioned/typed/catalog/v1alpha1/catalog_client.go @@ -32,6 +32,7 @@ type CatalogV1alpha1Interface interface { DruidVersionsGetter ElasticsearchVersionsGetter EtcdVersionsGetter + FerretDBVersionsGetter KafkaConnectorVersionsGetter KafkaVersionsGetter MariaDBVersionsGetter @@ -67,6 +68,10 @@ func (c *CatalogV1alpha1Client) EtcdVersions() EtcdVersionInterface { return newEtcdVersions(c) } +func (c *CatalogV1alpha1Client) FerretDBVersions() FerretDBVersionInterface { + return newFerretDBVersions(c) +} + func (c *CatalogV1alpha1Client) KafkaConnectorVersions() KafkaConnectorVersionInterface { return newKafkaConnectorVersions(c) } diff --git a/client/clientset/versioned/typed/catalog/v1alpha1/fake/fake_catalog_client.go b/client/clientset/versioned/typed/catalog/v1alpha1/fake/fake_catalog_client.go index 8448037b5a..48d58957b4 100644 --- a/client/clientset/versioned/typed/catalog/v1alpha1/fake/fake_catalog_client.go +++ b/client/clientset/versioned/typed/catalog/v1alpha1/fake/fake_catalog_client.go @@ -41,6 +41,10 @@ func (c *FakeCatalogV1alpha1) EtcdVersions() v1alpha1.EtcdVersionInterface { return &FakeEtcdVersions{c} } +func (c *FakeCatalogV1alpha1) FerretDBVersions() v1alpha1.FerretDBVersionInterface { + return &FakeFerretDBVersions{c} +} + func (c *FakeCatalogV1alpha1) KafkaConnectorVersions() v1alpha1.KafkaConnectorVersionInterface { return &FakeKafkaConnectorVersions{c} } diff --git a/client/clientset/versioned/typed/catalog/v1alpha1/fake/fake_ferretdbversion.go b/client/clientset/versioned/typed/catalog/v1alpha1/fake/fake_ferretdbversion.go new file mode 100644 index 0000000000..ff2695e829 --- /dev/null +++ b/client/clientset/versioned/typed/catalog/v1alpha1/fake/fake_ferretdbversion.go @@ -0,0 +1,122 @@ +/* +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/catalog/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" +) + +// FakeFerretDBVersions implements FerretDBVersionInterface +type FakeFerretDBVersions struct { + Fake *FakeCatalogV1alpha1 +} + +var ferretdbversionsResource = v1alpha1.SchemeGroupVersion.WithResource("ferretdbversions") + +var ferretdbversionsKind = v1alpha1.SchemeGroupVersion.WithKind("FerretDBVersion") + +// Get takes name of the ferretDBVersion, and returns the corresponding ferretDBVersion object, and an error if there is any. +func (c *FakeFerretDBVersions) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.FerretDBVersion, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(ferretdbversionsResource, name), &v1alpha1.FerretDBVersion{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.FerretDBVersion), err +} + +// List takes label and field selectors, and returns the list of FerretDBVersions that match those selectors. +func (c *FakeFerretDBVersions) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.FerretDBVersionList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(ferretdbversionsResource, ferretdbversionsKind, opts), &v1alpha1.FerretDBVersionList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.FerretDBVersionList{ListMeta: obj.(*v1alpha1.FerretDBVersionList).ListMeta} + for _, item := range obj.(*v1alpha1.FerretDBVersionList).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 ferretDBVersions. +func (c *FakeFerretDBVersions) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(ferretdbversionsResource, opts)) +} + +// Create takes the representation of a ferretDBVersion and creates it. Returns the server's representation of the ferretDBVersion, and an error, if there is any. +func (c *FakeFerretDBVersions) Create(ctx context.Context, ferretDBVersion *v1alpha1.FerretDBVersion, opts v1.CreateOptions) (result *v1alpha1.FerretDBVersion, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(ferretdbversionsResource, ferretDBVersion), &v1alpha1.FerretDBVersion{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.FerretDBVersion), err +} + +// Update takes the representation of a ferretDBVersion and updates it. Returns the server's representation of the ferretDBVersion, and an error, if there is any. +func (c *FakeFerretDBVersions) Update(ctx context.Context, ferretDBVersion *v1alpha1.FerretDBVersion, opts v1.UpdateOptions) (result *v1alpha1.FerretDBVersion, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(ferretdbversionsResource, ferretDBVersion), &v1alpha1.FerretDBVersion{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.FerretDBVersion), err +} + +// Delete takes name of the ferretDBVersion and deletes it. Returns an error if one occurs. +func (c *FakeFerretDBVersions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(ferretdbversionsResource, name, opts), &v1alpha1.FerretDBVersion{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeFerretDBVersions) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(ferretdbversionsResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.FerretDBVersionList{}) + return err +} + +// Patch applies the patch and returns the patched ferretDBVersion. +func (c *FakeFerretDBVersions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.FerretDBVersion, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(ferretdbversionsResource, name, pt, data, subresources...), &v1alpha1.FerretDBVersion{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.FerretDBVersion), err +} diff --git a/client/clientset/versioned/typed/catalog/v1alpha1/ferretdbversion.go b/client/clientset/versioned/typed/catalog/v1alpha1/ferretdbversion.go new file mode 100644 index 0000000000..9b687cc474 --- /dev/null +++ b/client/clientset/versioned/typed/catalog/v1alpha1/ferretdbversion.go @@ -0,0 +1,169 @@ +/* +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/catalog/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" +) + +// FerretDBVersionsGetter has a method to return a FerretDBVersionInterface. +// A group's client should implement this interface. +type FerretDBVersionsGetter interface { + FerretDBVersions() FerretDBVersionInterface +} + +// FerretDBVersionInterface has methods to work with FerretDBVersion resources. +type FerretDBVersionInterface interface { + Create(ctx context.Context, ferretDBVersion *v1alpha1.FerretDBVersion, opts v1.CreateOptions) (*v1alpha1.FerretDBVersion, error) + Update(ctx context.Context, ferretDBVersion *v1alpha1.FerretDBVersion, opts v1.UpdateOptions) (*v1alpha1.FerretDBVersion, 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.FerretDBVersion, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.FerretDBVersionList, 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.FerretDBVersion, err error) + FerretDBVersionExpansion +} + +// ferretDBVersions implements FerretDBVersionInterface +type ferretDBVersions struct { + client rest.Interface +} + +// newFerretDBVersions returns a FerretDBVersions +func newFerretDBVersions(c *CatalogV1alpha1Client) *ferretDBVersions { + return &ferretDBVersions{ + client: c.RESTClient(), + } +} + +// Get takes name of the ferretDBVersion, and returns the corresponding ferretDBVersion object, and an error if there is any. +func (c *ferretDBVersions) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.FerretDBVersion, err error) { + result = &v1alpha1.FerretDBVersion{} + err = c.client.Get(). + Resource("ferretdbversions"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of FerretDBVersions that match those selectors. +func (c *ferretDBVersions) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.FerretDBVersionList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.FerretDBVersionList{} + err = c.client.Get(). + Resource("ferretdbversions"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested ferretDBVersions. +func (c *ferretDBVersions) 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("ferretdbversions"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a ferretDBVersion and creates it. Returns the server's representation of the ferretDBVersion, and an error, if there is any. +func (c *ferretDBVersions) Create(ctx context.Context, ferretDBVersion *v1alpha1.FerretDBVersion, opts v1.CreateOptions) (result *v1alpha1.FerretDBVersion, err error) { + result = &v1alpha1.FerretDBVersion{} + err = c.client.Post(). + Resource("ferretdbversions"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(ferretDBVersion). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a ferretDBVersion and updates it. Returns the server's representation of the ferretDBVersion, and an error, if there is any. +func (c *ferretDBVersions) Update(ctx context.Context, ferretDBVersion *v1alpha1.FerretDBVersion, opts v1.UpdateOptions) (result *v1alpha1.FerretDBVersion, err error) { + result = &v1alpha1.FerretDBVersion{} + err = c.client.Put(). + Resource("ferretdbversions"). + Name(ferretDBVersion.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(ferretDBVersion). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the ferretDBVersion and deletes it. Returns an error if one occurs. +func (c *ferretDBVersions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("ferretdbversions"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *ferretDBVersions) 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("ferretdbversions"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched ferretDBVersion. +func (c *ferretDBVersions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.FerretDBVersion, err error) { + result = &v1alpha1.FerretDBVersion{} + err = c.client.Patch(pt). + Resource("ferretdbversions"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/client/clientset/versioned/typed/catalog/v1alpha1/generated_expansion.go b/client/clientset/versioned/typed/catalog/v1alpha1/generated_expansion.go index f79256a9e8..2b81ee34f3 100644 --- a/client/clientset/versioned/typed/catalog/v1alpha1/generated_expansion.go +++ b/client/clientset/versioned/typed/catalog/v1alpha1/generated_expansion.go @@ -24,6 +24,8 @@ type ElasticsearchVersionExpansion interface{} type EtcdVersionExpansion interface{} +type FerretDBVersionExpansion interface{} + type KafkaConnectorVersionExpansion interface{} type KafkaVersionExpansion interface{} diff --git a/client/clientset/versioned/typed/kubedb/v1alpha2/fake/fake_ferretdb.go b/client/clientset/versioned/typed/kubedb/v1alpha2/fake/fake_ferretdb.go new file mode 100644 index 0000000000..3f3bf63f4f --- /dev/null +++ b/client/clientset/versioned/typed/kubedb/v1alpha2/fake/fake_ferretdb.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" + + v1alpha2 "kubedb.dev/apimachinery/apis/kubedb/v1alpha2" + + 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" +) + +// FakeFerretDBs implements FerretDBInterface +type FakeFerretDBs struct { + Fake *FakeKubedbV1alpha2 + ns string +} + +var ferretdbsResource = v1alpha2.SchemeGroupVersion.WithResource("ferretdbs") + +var ferretdbsKind = v1alpha2.SchemeGroupVersion.WithKind("FerretDB") + +// Get takes name of the ferretDB, and returns the corresponding ferretDB object, and an error if there is any. +func (c *FakeFerretDBs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.FerretDB, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(ferretdbsResource, c.ns, name), &v1alpha2.FerretDB{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.FerretDB), err +} + +// List takes label and field selectors, and returns the list of FerretDBs that match those selectors. +func (c *FakeFerretDBs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.FerretDBList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(ferretdbsResource, ferretdbsKind, c.ns, opts), &v1alpha2.FerretDBList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha2.FerretDBList{ListMeta: obj.(*v1alpha2.FerretDBList).ListMeta} + for _, item := range obj.(*v1alpha2.FerretDBList).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 ferretDBs. +func (c *FakeFerretDBs) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(ferretdbsResource, c.ns, opts)) + +} + +// Create takes the representation of a ferretDB and creates it. Returns the server's representation of the ferretDB, and an error, if there is any. +func (c *FakeFerretDBs) Create(ctx context.Context, ferretDB *v1alpha2.FerretDB, opts v1.CreateOptions) (result *v1alpha2.FerretDB, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(ferretdbsResource, c.ns, ferretDB), &v1alpha2.FerretDB{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.FerretDB), err +} + +// Update takes the representation of a ferretDB and updates it. Returns the server's representation of the ferretDB, and an error, if there is any. +func (c *FakeFerretDBs) Update(ctx context.Context, ferretDB *v1alpha2.FerretDB, opts v1.UpdateOptions) (result *v1alpha2.FerretDB, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(ferretdbsResource, c.ns, ferretDB), &v1alpha2.FerretDB{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.FerretDB), 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 *FakeFerretDBs) UpdateStatus(ctx context.Context, ferretDB *v1alpha2.FerretDB, opts v1.UpdateOptions) (*v1alpha2.FerretDB, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(ferretdbsResource, "status", c.ns, ferretDB), &v1alpha2.FerretDB{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.FerretDB), err +} + +// Delete takes name of the ferretDB and deletes it. Returns an error if one occurs. +func (c *FakeFerretDBs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(ferretdbsResource, c.ns, name, opts), &v1alpha2.FerretDB{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeFerretDBs) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(ferretdbsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha2.FerretDBList{}) + return err +} + +// Patch applies the patch and returns the patched ferretDB. +func (c *FakeFerretDBs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.FerretDB, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(ferretdbsResource, c.ns, name, pt, data, subresources...), &v1alpha2.FerretDB{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.FerretDB), err +} diff --git a/client/clientset/versioned/typed/kubedb/v1alpha2/fake/fake_kubedb_client.go b/client/clientset/versioned/typed/kubedb/v1alpha2/fake/fake_kubedb_client.go index 83da38f72f..eec4d17e83 100644 --- a/client/clientset/versioned/typed/kubedb/v1alpha2/fake/fake_kubedb_client.go +++ b/client/clientset/versioned/typed/kubedb/v1alpha2/fake/fake_kubedb_client.go @@ -41,6 +41,10 @@ func (c *FakeKubedbV1alpha2) Etcds(namespace string) v1alpha2.EtcdInterface { return &FakeEtcds{c, namespace} } +func (c *FakeKubedbV1alpha2) FerretDBs(namespace string) v1alpha2.FerretDBInterface { + return &FakeFerretDBs{c, namespace} +} + func (c *FakeKubedbV1alpha2) Kafkas(namespace string) v1alpha2.KafkaInterface { return &FakeKafkas{c, namespace} } diff --git a/client/clientset/versioned/typed/kubedb/v1alpha2/ferretdb.go b/client/clientset/versioned/typed/kubedb/v1alpha2/ferretdb.go new file mode 100644 index 0000000000..fee204c27b --- /dev/null +++ b/client/clientset/versioned/typed/kubedb/v1alpha2/ferretdb.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 v1alpha2 + +import ( + "context" + "time" + + v1alpha2 "kubedb.dev/apimachinery/apis/kubedb/v1alpha2" + 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" +) + +// FerretDBsGetter has a method to return a FerretDBInterface. +// A group's client should implement this interface. +type FerretDBsGetter interface { + FerretDBs(namespace string) FerretDBInterface +} + +// FerretDBInterface has methods to work with FerretDB resources. +type FerretDBInterface interface { + Create(ctx context.Context, ferretDB *v1alpha2.FerretDB, opts v1.CreateOptions) (*v1alpha2.FerretDB, error) + Update(ctx context.Context, ferretDB *v1alpha2.FerretDB, opts v1.UpdateOptions) (*v1alpha2.FerretDB, error) + UpdateStatus(ctx context.Context, ferretDB *v1alpha2.FerretDB, opts v1.UpdateOptions) (*v1alpha2.FerretDB, 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) (*v1alpha2.FerretDB, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha2.FerretDBList, 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 *v1alpha2.FerretDB, err error) + FerretDBExpansion +} + +// ferretDBs implements FerretDBInterface +type ferretDBs struct { + client rest.Interface + ns string +} + +// newFerretDBs returns a FerretDBs +func newFerretDBs(c *KubedbV1alpha2Client, namespace string) *ferretDBs { + return &ferretDBs{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the ferretDB, and returns the corresponding ferretDB object, and an error if there is any. +func (c *ferretDBs) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.FerretDB, err error) { + result = &v1alpha2.FerretDB{} + err = c.client.Get(). + Namespace(c.ns). + Resource("ferretdbs"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of FerretDBs that match those selectors. +func (c *ferretDBs) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.FerretDBList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha2.FerretDBList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("ferretdbs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested ferretDBs. +func (c *ferretDBs) 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("ferretdbs"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a ferretDB and creates it. Returns the server's representation of the ferretDB, and an error, if there is any. +func (c *ferretDBs) Create(ctx context.Context, ferretDB *v1alpha2.FerretDB, opts v1.CreateOptions) (result *v1alpha2.FerretDB, err error) { + result = &v1alpha2.FerretDB{} + err = c.client.Post(). + Namespace(c.ns). + Resource("ferretdbs"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(ferretDB). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a ferretDB and updates it. Returns the server's representation of the ferretDB, and an error, if there is any. +func (c *ferretDBs) Update(ctx context.Context, ferretDB *v1alpha2.FerretDB, opts v1.UpdateOptions) (result *v1alpha2.FerretDB, err error) { + result = &v1alpha2.FerretDB{} + err = c.client.Put(). + Namespace(c.ns). + Resource("ferretdbs"). + Name(ferretDB.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(ferretDB). + 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 *ferretDBs) UpdateStatus(ctx context.Context, ferretDB *v1alpha2.FerretDB, opts v1.UpdateOptions) (result *v1alpha2.FerretDB, err error) { + result = &v1alpha2.FerretDB{} + err = c.client.Put(). + Namespace(c.ns). + Resource("ferretdbs"). + Name(ferretDB.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(ferretDB). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the ferretDB and deletes it. Returns an error if one occurs. +func (c *ferretDBs) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("ferretdbs"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *ferretDBs) 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("ferretdbs"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched ferretDB. +func (c *ferretDBs) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.FerretDB, err error) { + result = &v1alpha2.FerretDB{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("ferretdbs"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/client/clientset/versioned/typed/kubedb/v1alpha2/generated_expansion.go b/client/clientset/versioned/typed/kubedb/v1alpha2/generated_expansion.go index bfa6427694..7aa4a15dd9 100644 --- a/client/clientset/versioned/typed/kubedb/v1alpha2/generated_expansion.go +++ b/client/clientset/versioned/typed/kubedb/v1alpha2/generated_expansion.go @@ -24,6 +24,8 @@ type ElasticsearchExpansion interface{} type EtcdExpansion interface{} +type FerretDBExpansion interface{} + type KafkaExpansion interface{} type MariaDBExpansion interface{} diff --git a/client/clientset/versioned/typed/kubedb/v1alpha2/kubedb_client.go b/client/clientset/versioned/typed/kubedb/v1alpha2/kubedb_client.go index 43cfca3f8e..e0503d6b93 100644 --- a/client/clientset/versioned/typed/kubedb/v1alpha2/kubedb_client.go +++ b/client/clientset/versioned/typed/kubedb/v1alpha2/kubedb_client.go @@ -32,6 +32,7 @@ type KubedbV1alpha2Interface interface { DruidsGetter ElasticsearchesGetter EtcdsGetter + FerretDBsGetter KafkasGetter MariaDBsGetter MemcachedsGetter @@ -67,6 +68,10 @@ func (c *KubedbV1alpha2Client) Etcds(namespace string) EtcdInterface { return newEtcds(c, namespace) } +func (c *KubedbV1alpha2Client) FerretDBs(namespace string) FerretDBInterface { + return newFerretDBs(c, namespace) +} + func (c *KubedbV1alpha2Client) Kafkas(namespace string) KafkaInterface { return newKafkas(c, namespace) } diff --git a/client/informers/externalversions/catalog/v1alpha1/ferretdbversion.go b/client/informers/externalversions/catalog/v1alpha1/ferretdbversion.go new file mode 100644 index 0000000000..e92cb53b1f --- /dev/null +++ b/client/informers/externalversions/catalog/v1alpha1/ferretdbversion.go @@ -0,0 +1,90 @@ +/* +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" + + catalogv1alpha1 "kubedb.dev/apimachinery/apis/catalog/v1alpha1" + versioned "kubedb.dev/apimachinery/client/clientset/versioned" + internalinterfaces "kubedb.dev/apimachinery/client/informers/externalversions/internalinterfaces" + v1alpha1 "kubedb.dev/apimachinery/client/listers/catalog/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" +) + +// FerretDBVersionInformer provides access to a shared informer and lister for +// FerretDBVersions. +type FerretDBVersionInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.FerretDBVersionLister +} + +type ferretDBVersionInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewFerretDBVersionInformer constructs a new informer for FerretDBVersion 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 NewFerretDBVersionInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredFerretDBVersionInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredFerretDBVersionInformer constructs a new informer for FerretDBVersion 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 NewFilteredFerretDBVersionInformer(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.CatalogV1alpha1().FerretDBVersions().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CatalogV1alpha1().FerretDBVersions().Watch(context.TODO(), options) + }, + }, + &catalogv1alpha1.FerretDBVersion{}, + resyncPeriod, + indexers, + ) +} + +func (f *ferretDBVersionInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredFerretDBVersionInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *ferretDBVersionInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&catalogv1alpha1.FerretDBVersion{}, f.defaultInformer) +} + +func (f *ferretDBVersionInformer) Lister() v1alpha1.FerretDBVersionLister { + return v1alpha1.NewFerretDBVersionLister(f.Informer().GetIndexer()) +} diff --git a/client/informers/externalversions/catalog/v1alpha1/interface.go b/client/informers/externalversions/catalog/v1alpha1/interface.go index 0efd4438fe..1e4ee2b2ca 100644 --- a/client/informers/externalversions/catalog/v1alpha1/interface.go +++ b/client/informers/externalversions/catalog/v1alpha1/interface.go @@ -30,6 +30,8 @@ type Interface interface { ElasticsearchVersions() ElasticsearchVersionInformer // EtcdVersions returns a EtcdVersionInformer. EtcdVersions() EtcdVersionInformer + // FerretDBVersions returns a FerretDBVersionInformer. + FerretDBVersions() FerretDBVersionInformer // KafkaConnectorVersions returns a KafkaConnectorVersionInformer. KafkaConnectorVersions() KafkaConnectorVersionInformer // KafkaVersions returns a KafkaVersionInformer. @@ -90,6 +92,11 @@ func (v *version) EtcdVersions() EtcdVersionInformer { return &etcdVersionInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } +// FerretDBVersions returns a FerretDBVersionInformer. +func (v *version) FerretDBVersions() FerretDBVersionInformer { + return &ferretDBVersionInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + // KafkaConnectorVersions returns a KafkaConnectorVersionInformer. func (v *version) KafkaConnectorVersions() KafkaConnectorVersionInformer { return &kafkaConnectorVersionInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} diff --git a/client/informers/externalversions/generic.go b/client/informers/externalversions/generic.go index c5192638e6..738809b5c4 100644 --- a/client/informers/externalversions/generic.go +++ b/client/informers/externalversions/generic.go @@ -102,6 +102,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericInformer{resource: resource.GroupResource(), informer: f.Catalog().V1alpha1().ElasticsearchVersions().Informer()}, nil case catalogv1alpha1.SchemeGroupVersion.WithResource("etcdversions"): return &genericInformer{resource: resource.GroupResource(), informer: f.Catalog().V1alpha1().EtcdVersions().Informer()}, nil + case catalogv1alpha1.SchemeGroupVersion.WithResource("ferretdbversions"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Catalog().V1alpha1().FerretDBVersions().Informer()}, nil case catalogv1alpha1.SchemeGroupVersion.WithResource("kafkaconnectorversions"): return &genericInformer{resource: resource.GroupResource(), informer: f.Catalog().V1alpha1().KafkaConnectorVersions().Informer()}, nil case catalogv1alpha1.SchemeGroupVersion.WithResource("kafkaversions"): @@ -152,6 +154,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericInformer{resource: resource.GroupResource(), informer: f.Kubedb().V1alpha2().Elasticsearches().Informer()}, nil case v1alpha2.SchemeGroupVersion.WithResource("etcds"): return &genericInformer{resource: resource.GroupResource(), informer: f.Kubedb().V1alpha2().Etcds().Informer()}, nil + case v1alpha2.SchemeGroupVersion.WithResource("ferretdbs"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Kubedb().V1alpha2().FerretDBs().Informer()}, nil case v1alpha2.SchemeGroupVersion.WithResource("kafkas"): return &genericInformer{resource: resource.GroupResource(), informer: f.Kubedb().V1alpha2().Kafkas().Informer()}, nil case v1alpha2.SchemeGroupVersion.WithResource("mariadbs"): diff --git a/client/informers/externalversions/kubedb/v1alpha2/ferretdb.go b/client/informers/externalversions/kubedb/v1alpha2/ferretdb.go new file mode 100644 index 0000000000..fabe116dcf --- /dev/null +++ b/client/informers/externalversions/kubedb/v1alpha2/ferretdb.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 v1alpha2 + +import ( + "context" + time "time" + + kubedbv1alpha2 "kubedb.dev/apimachinery/apis/kubedb/v1alpha2" + versioned "kubedb.dev/apimachinery/client/clientset/versioned" + internalinterfaces "kubedb.dev/apimachinery/client/informers/externalversions/internalinterfaces" + v1alpha2 "kubedb.dev/apimachinery/client/listers/kubedb/v1alpha2" + + 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" +) + +// FerretDBInformer provides access to a shared informer and lister for +// FerretDBs. +type FerretDBInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha2.FerretDBLister +} + +type ferretDBInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewFerretDBInformer constructs a new informer for FerretDB 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 NewFerretDBInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredFerretDBInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredFerretDBInformer constructs a new informer for FerretDB 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 NewFilteredFerretDBInformer(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.KubedbV1alpha2().FerretDBs(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.KubedbV1alpha2().FerretDBs(namespace).Watch(context.TODO(), options) + }, + }, + &kubedbv1alpha2.FerretDB{}, + resyncPeriod, + indexers, + ) +} + +func (f *ferretDBInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredFerretDBInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *ferretDBInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&kubedbv1alpha2.FerretDB{}, f.defaultInformer) +} + +func (f *ferretDBInformer) Lister() v1alpha2.FerretDBLister { + return v1alpha2.NewFerretDBLister(f.Informer().GetIndexer()) +} diff --git a/client/informers/externalversions/kubedb/v1alpha2/interface.go b/client/informers/externalversions/kubedb/v1alpha2/interface.go index 7f20f3dc10..53de8a84e9 100644 --- a/client/informers/externalversions/kubedb/v1alpha2/interface.go +++ b/client/informers/externalversions/kubedb/v1alpha2/interface.go @@ -30,6 +30,8 @@ type Interface interface { Elasticsearches() ElasticsearchInformer // Etcds returns a EtcdInformer. Etcds() EtcdInformer + // FerretDBs returns a FerretDBInformer. + FerretDBs() FerretDBInformer // Kafkas returns a KafkaInformer. Kafkas() KafkaInformer // MariaDBs returns a MariaDBInformer. @@ -90,6 +92,11 @@ func (v *version) Etcds() EtcdInformer { return &etcdInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } +// FerretDBs returns a FerretDBInformer. +func (v *version) FerretDBs() FerretDBInformer { + return &ferretDBInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + // Kafkas returns a KafkaInformer. func (v *version) Kafkas() KafkaInformer { return &kafkaInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/client/listers/catalog/v1alpha1/expansion_generated.go b/client/listers/catalog/v1alpha1/expansion_generated.go index 44a0b82181..22240e8c94 100644 --- a/client/listers/catalog/v1alpha1/expansion_generated.go +++ b/client/listers/catalog/v1alpha1/expansion_generated.go @@ -30,6 +30,10 @@ type ElasticsearchVersionListerExpansion interface{} // EtcdVersionLister. type EtcdVersionListerExpansion interface{} +// FerretDBVersionListerExpansion allows custom methods to be added to +// FerretDBVersionLister. +type FerretDBVersionListerExpansion interface{} + // KafkaConnectorVersionListerExpansion allows custom methods to be added to // KafkaConnectorVersionLister. type KafkaConnectorVersionListerExpansion interface{} diff --git a/client/listers/catalog/v1alpha1/ferretdbversion.go b/client/listers/catalog/v1alpha1/ferretdbversion.go new file mode 100644 index 0000000000..83c3548f0d --- /dev/null +++ b/client/listers/catalog/v1alpha1/ferretdbversion.go @@ -0,0 +1,69 @@ +/* +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/catalog/v1alpha1" + + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// FerretDBVersionLister helps list FerretDBVersions. +// All objects returned here must be treated as read-only. +type FerretDBVersionLister interface { + // List lists all FerretDBVersions in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.FerretDBVersion, err error) + // Get retrieves the FerretDBVersion from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.FerretDBVersion, error) + FerretDBVersionListerExpansion +} + +// ferretDBVersionLister implements the FerretDBVersionLister interface. +type ferretDBVersionLister struct { + indexer cache.Indexer +} + +// NewFerretDBVersionLister returns a new FerretDBVersionLister. +func NewFerretDBVersionLister(indexer cache.Indexer) FerretDBVersionLister { + return &ferretDBVersionLister{indexer: indexer} +} + +// List lists all FerretDBVersions in the indexer. +func (s *ferretDBVersionLister) List(selector labels.Selector) (ret []*v1alpha1.FerretDBVersion, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.FerretDBVersion)) + }) + return ret, err +} + +// Get retrieves the FerretDBVersion from the index for a given name. +func (s *ferretDBVersionLister) Get(name string) (*v1alpha1.FerretDBVersion, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("ferretdbversion"), name) + } + return obj.(*v1alpha1.FerretDBVersion), nil +} diff --git a/client/listers/kubedb/v1alpha2/expansion_generated.go b/client/listers/kubedb/v1alpha2/expansion_generated.go index 10e97c865f..9cad0d8edd 100644 --- a/client/listers/kubedb/v1alpha2/expansion_generated.go +++ b/client/listers/kubedb/v1alpha2/expansion_generated.go @@ -42,6 +42,14 @@ type EtcdListerExpansion interface{} // EtcdNamespaceLister. type EtcdNamespaceListerExpansion interface{} +// FerretDBListerExpansion allows custom methods to be added to +// FerretDBLister. +type FerretDBListerExpansion interface{} + +// FerretDBNamespaceListerExpansion allows custom methods to be added to +// FerretDBNamespaceLister. +type FerretDBNamespaceListerExpansion interface{} + // KafkaListerExpansion allows custom methods to be added to // KafkaLister. type KafkaListerExpansion interface{} diff --git a/client/listers/kubedb/v1alpha2/ferretdb.go b/client/listers/kubedb/v1alpha2/ferretdb.go new file mode 100644 index 0000000000..9b94e8c56c --- /dev/null +++ b/client/listers/kubedb/v1alpha2/ferretdb.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 v1alpha2 + +import ( + v1alpha2 "kubedb.dev/apimachinery/apis/kubedb/v1alpha2" + + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// FerretDBLister helps list FerretDBs. +// All objects returned here must be treated as read-only. +type FerretDBLister interface { + // List lists all FerretDBs in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha2.FerretDB, err error) + // FerretDBs returns an object that can list and get FerretDBs. + FerretDBs(namespace string) FerretDBNamespaceLister + FerretDBListerExpansion +} + +// ferretDBLister implements the FerretDBLister interface. +type ferretDBLister struct { + indexer cache.Indexer +} + +// NewFerretDBLister returns a new FerretDBLister. +func NewFerretDBLister(indexer cache.Indexer) FerretDBLister { + return &ferretDBLister{indexer: indexer} +} + +// List lists all FerretDBs in the indexer. +func (s *ferretDBLister) List(selector labels.Selector) (ret []*v1alpha2.FerretDB, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha2.FerretDB)) + }) + return ret, err +} + +// FerretDBs returns an object that can list and get FerretDBs. +func (s *ferretDBLister) FerretDBs(namespace string) FerretDBNamespaceLister { + return ferretDBNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// FerretDBNamespaceLister helps list and get FerretDBs. +// All objects returned here must be treated as read-only. +type FerretDBNamespaceLister interface { + // List lists all FerretDBs in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha2.FerretDB, err error) + // Get retrieves the FerretDB from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha2.FerretDB, error) + FerretDBNamespaceListerExpansion +} + +// ferretDBNamespaceLister implements the FerretDBNamespaceLister +// interface. +type ferretDBNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all FerretDBs in the indexer for a given namespace. +func (s ferretDBNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.FerretDB, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha2.FerretDB)) + }) + return ret, err +} + +// Get retrieves the FerretDB from the indexer for a given namespace and name. +func (s ferretDBNamespaceLister) Get(name string) (*v1alpha2.FerretDB, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha2.Resource("ferretdb"), name) + } + return obj.(*v1alpha2.FerretDB), nil +} diff --git a/crds/catalog.kubedb.com_ferretdbversions.yaml b/crds/catalog.kubedb.com_ferretdbversions.yaml new file mode 100644 index 0000000000..4133d915ba --- /dev/null +++ b/crds/catalog.kubedb.com_ferretdbversions.yaml @@ -0,0 +1,83 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + creationTimestamp: null + labels: + app.kubernetes.io/name: kubedb + name: ferretdbversions.catalog.kubedb.com +spec: + group: catalog.kubedb.com + names: + categories: + - datastore + - kubedb + - appscode + kind: FerretDBVersion + listKind: FerretDBVersionList + plural: ferretdbversions + shortNames: + - drversion + singular: ferretdbversion + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .spec.version + name: Version + type: string + - jsonPath: .spec.db.image + name: DB_IMAGE + type: string + - jsonPath: .spec.deprecated + name: Deprecated + type: boolean + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + properties: + apiVersion: + type: string + kind: + type: string + metadata: + type: object + spec: + properties: + db: + properties: + image: + type: string + required: + - image + type: object + deprecated: + type: boolean + securityContext: + properties: + runAsUser: + format: int64 + type: integer + type: object + updateConstraints: + properties: + allowlist: + items: + type: string + type: array + denylist: + items: + type: string + type: array + type: object + version: + type: string + required: + - db + - version + type: object + type: object + served: true + storage: true + subresources: {} diff --git a/crds/kubedb.com_ferretdbs.yaml b/crds/kubedb.com_ferretdbs.yaml new file mode 100644 index 0000000000..32bdd89feb --- /dev/null +++ b/crds/kubedb.com_ferretdbs.yaml @@ -0,0 +1,3972 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + creationTimestamp: null + labels: + app.kubernetes.io/name: kubedb + name: ferretdbs.kubedb.com +spec: + group: kubedb.com + names: + kind: FerretDB + listKind: FerretDBList + plural: ferretdbs + shortNames: + - fr + singular: ferretdb + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .metadata.namespace + name: Namespace + type: string + - jsonPath: .spec.version + name: Version + type: string + - jsonPath: .status.phase + name: Status + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha2 + schema: + openAPIV3Schema: + properties: + apiVersion: + type: string + kind: + type: string + metadata: + type: object + spec: + properties: + authSecret: + properties: + externallyManaged: + type: boolean + name: + type: string + type: object + x-kubernetes-map-type: atomic + backend: + properties: + externallyManaged: + type: boolean + linkedDB: + type: string + postgres: + properties: + service: + properties: + name: + type: string + namespace: + type: string + pgPort: + type: string + required: + - name + - namespace + - pgPort + type: object + url: + type: string + version: + type: string + type: object + type: object + halted: + type: boolean + healthChecker: + default: + failureThreshold: 1 + periodSeconds: 10 + timeoutSeconds: 10 + properties: + disableWriteCheck: + type: boolean + failureThreshold: + default: 1 + format: int32 + type: integer + periodSeconds: + default: 10 + format: int32 + type: integer + timeoutSeconds: + default: 10 + format: int32 + type: integer + type: object + monitor: + properties: + agent: + enum: + - prometheus.io/operator + - prometheus.io + - prometheus.io/builtin + type: string + prometheus: + properties: + exporter: + properties: + args: + items: + type: string + type: array + env: + items: + properties: + name: + type: string + value: + type: string + valueFrom: + properties: + configMapKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + resourceFieldRef: + properties: + containerName: + type: string + divisor: + 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 + resource: + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + port: + default: 56790 + format: int32 + type: integer + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + 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 + requests: + 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 + type: object + securityContext: + properties: + allowPrivilegeEscalation: + type: boolean + capabilities: + properties: + add: + items: + type: string + type: array + drop: + items: + type: string + type: array + type: object + privileged: + type: boolean + procMount: + type: string + readOnlyRootFilesystem: + type: boolean + runAsGroup: + format: int64 + type: integer + runAsNonRoot: + type: boolean + runAsUser: + format: int64 + type: integer + seLinuxOptions: + properties: + level: + type: string + role: + type: string + type: + type: string + user: + type: string + type: object + seccompProfile: + properties: + localhostProfile: + type: string + type: + type: string + required: + - type + type: object + windowsOptions: + properties: + gmsaCredentialSpec: + type: string + gmsaCredentialSpecName: + type: string + hostProcess: + type: boolean + runAsUserName: + type: string + type: object + type: object + type: object + serviceMonitor: + properties: + interval: + type: string + labels: + additionalProperties: + type: string + type: object + type: object + type: object + type: object + podTemplate: + properties: + controller: + properties: + annotations: + additionalProperties: + type: string + type: object + labels: + additionalProperties: + type: string + type: object + type: object + metadata: + properties: + annotations: + additionalProperties: + type: string + type: object + labels: + additionalProperties: + type: string + type: object + type: object + spec: + properties: + activeDeadlineSeconds: + format: int64 + type: integer + affinity: + properties: + nodeAffinity: + properties: + preferredDuringSchedulingIgnoredDuringExecution: + items: + properties: + preference: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchFields: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + type: object + x-kubernetes-map-type: atomic + weight: + format: int32 + type: integer + required: + - preference + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + properties: + nodeSelectorTerms: + items: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchFields: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + type: object + x-kubernetes-map-type: atomic + type: array + required: + - nodeSelectorTerms + type: object + x-kubernetes-map-type: atomic + type: object + podAffinity: + properties: + preferredDuringSchedulingIgnoredDuringExecution: + items: + properties: + podAffinityTerm: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + namespaceSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + items: + type: string + type: array + topologyKey: + type: string + required: + - topologyKey + type: object + weight: + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + items: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + namespaceSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + items: + type: string + type: array + topologyKey: + type: string + required: + - topologyKey + type: object + type: array + type: object + podAntiAffinity: + properties: + preferredDuringSchedulingIgnoredDuringExecution: + items: + properties: + podAffinityTerm: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + namespaceSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + items: + type: string + type: array + topologyKey: + type: string + required: + - topologyKey + type: object + weight: + format: int32 + type: integer + required: + - podAffinityTerm + - weight + type: object + type: array + requiredDuringSchedulingIgnoredDuringExecution: + items: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + mismatchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + namespaceSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + namespaces: + items: + type: string + type: array + topologyKey: + type: string + required: + - topologyKey + type: object + type: array + type: object + type: object + automountServiceAccountToken: + type: boolean + containers: + items: + properties: + args: + items: + type: string + type: array + command: + items: + type: string + type: array + env: + items: + properties: + name: + type: string + value: + type: string + valueFrom: + properties: + configMapKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + resourceFieldRef: + properties: + containerName: + type: string + divisor: + 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 + resource: + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + envFrom: + items: + properties: + configMapRef: + properties: + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + prefix: + type: string + secretRef: + properties: + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + type: object + type: array + image: + type: string + imagePullPolicy: + type: string + lifecycle: + properties: + postStart: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + preStop: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + type: object + livenessProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + name: + type: string + ports: + items: + properties: + containerPort: + format: int32 + type: integer + hostIP: + type: string + hostPort: + format: int32 + type: integer + name: + type: string + protocol: + default: TCP + type: string + required: + - containerPort + type: object + type: array + x-kubernetes-list-map-keys: + - containerPort + - protocol + x-kubernetes-list-type: map + readinessProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + 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 + requests: + 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 + type: object + restartPolicy: + type: string + securityContext: + properties: + allowPrivilegeEscalation: + type: boolean + capabilities: + properties: + add: + items: + type: string + type: array + drop: + items: + type: string + type: array + type: object + privileged: + type: boolean + procMount: + type: string + readOnlyRootFilesystem: + type: boolean + runAsGroup: + format: int64 + type: integer + runAsNonRoot: + type: boolean + runAsUser: + format: int64 + type: integer + seLinuxOptions: + properties: + level: + type: string + role: + type: string + type: + type: string + user: + type: string + type: object + seccompProfile: + properties: + localhostProfile: + type: string + type: + type: string + required: + - type + type: object + windowsOptions: + properties: + gmsaCredentialSpec: + type: string + gmsaCredentialSpecName: + type: string + hostProcess: + type: boolean + runAsUserName: + type: string + type: object + type: object + startupProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + stdin: + type: boolean + stdinOnce: + type: boolean + terminationMessagePath: + type: string + terminationMessagePolicy: + type: string + tty: + type: boolean + volumeDevices: + items: + properties: + devicePath: + type: string + name: + type: string + required: + - devicePath + - name + type: object + type: array + volumeMounts: + items: + properties: + mountPath: + type: string + mountPropagation: + type: string + name: + type: string + readOnly: + type: boolean + subPath: + type: string + subPathExpr: + type: string + required: + - mountPath + - name + type: object + type: array + workingDir: + type: string + required: + - name + type: object + type: array + dnsConfig: + properties: + nameservers: + items: + type: string + type: array + options: + items: + properties: + name: + type: string + value: + type: string + type: object + type: array + searches: + items: + type: string + type: array + type: object + dnsPolicy: + type: string + enableServiceLinks: + type: boolean + ephemeralContainers: + items: + properties: + args: + items: + type: string + type: array + command: + items: + type: string + type: array + env: + items: + properties: + name: + type: string + value: + type: string + valueFrom: + properties: + configMapKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + resourceFieldRef: + properties: + containerName: + type: string + divisor: + 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 + resource: + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + envFrom: + items: + properties: + configMapRef: + properties: + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + prefix: + type: string + secretRef: + properties: + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + type: object + type: array + image: + type: string + imagePullPolicy: + type: string + lifecycle: + properties: + postStart: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + preStop: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + type: object + livenessProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + name: + type: string + ports: + items: + properties: + containerPort: + format: int32 + type: integer + hostIP: + type: string + hostPort: + format: int32 + type: integer + name: + type: string + protocol: + default: TCP + type: string + required: + - containerPort + type: object + type: array + x-kubernetes-list-map-keys: + - containerPort + - protocol + x-kubernetes-list-type: map + readinessProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + 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 + requests: + 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 + type: object + restartPolicy: + type: string + securityContext: + properties: + allowPrivilegeEscalation: + type: boolean + capabilities: + properties: + add: + items: + type: string + type: array + drop: + items: + type: string + type: array + type: object + privileged: + type: boolean + procMount: + type: string + readOnlyRootFilesystem: + type: boolean + runAsGroup: + format: int64 + type: integer + runAsNonRoot: + type: boolean + runAsUser: + format: int64 + type: integer + seLinuxOptions: + properties: + level: + type: string + role: + type: string + type: + type: string + user: + type: string + type: object + seccompProfile: + properties: + localhostProfile: + type: string + type: + type: string + required: + - type + type: object + windowsOptions: + properties: + gmsaCredentialSpec: + type: string + gmsaCredentialSpecName: + type: string + hostProcess: + type: boolean + runAsUserName: + type: string + type: object + type: object + startupProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + stdin: + type: boolean + stdinOnce: + type: boolean + targetContainerName: + type: string + terminationMessagePath: + type: string + terminationMessagePolicy: + type: string + tty: + type: boolean + volumeDevices: + items: + properties: + devicePath: + type: string + name: + type: string + required: + - devicePath + - name + type: object + type: array + volumeMounts: + items: + properties: + mountPath: + type: string + mountPropagation: + type: string + name: + type: string + readOnly: + type: boolean + subPath: + type: string + subPathExpr: + type: string + required: + - mountPath + - name + type: object + type: array + workingDir: + type: string + required: + - name + type: object + type: array + hostAliases: + items: + properties: + hostnames: + items: + type: string + type: array + ip: + type: string + type: object + type: array + hostIPC: + type: boolean + hostNetwork: + type: boolean + hostPID: + type: boolean + hostUsers: + type: boolean + imagePullSecrets: + items: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + type: array + initContainers: + items: + properties: + args: + items: + type: string + type: array + command: + items: + type: string + type: array + env: + items: + properties: + name: + type: string + value: + type: string + valueFrom: + properties: + configMapKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + resourceFieldRef: + properties: + containerName: + type: string + divisor: + 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 + resource: + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + secretKeyRef: + properties: + key: + type: string + name: + type: string + optional: + type: boolean + required: + - key + type: object + x-kubernetes-map-type: atomic + type: object + required: + - name + type: object + type: array + envFrom: + items: + properties: + configMapRef: + properties: + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + prefix: + type: string + secretRef: + properties: + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + type: object + type: array + image: + type: string + imagePullPolicy: + type: string + lifecycle: + properties: + postStart: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + preStop: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + sleep: + properties: + seconds: + format: int64 + type: integer + required: + - seconds + type: object + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + type: object + type: object + livenessProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + name: + type: string + ports: + items: + properties: + containerPort: + format: int32 + type: integer + hostIP: + type: string + hostPort: + format: int32 + type: integer + name: + type: string + protocol: + default: TCP + type: string + required: + - containerPort + type: object + type: array + x-kubernetes-list-map-keys: + - containerPort + - protocol + x-kubernetes-list-type: map + readinessProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + resizePolicy: + items: + properties: + resourceName: + type: string + restartPolicy: + type: string + required: + - resourceName + - restartPolicy + type: object + type: array + x-kubernetes-list-type: atomic + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + 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 + requests: + 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 + type: object + restartPolicy: + type: string + securityContext: + properties: + allowPrivilegeEscalation: + type: boolean + capabilities: + properties: + add: + items: + type: string + type: array + drop: + items: + type: string + type: array + type: object + privileged: + type: boolean + procMount: + type: string + readOnlyRootFilesystem: + type: boolean + runAsGroup: + format: int64 + type: integer + runAsNonRoot: + type: boolean + runAsUser: + format: int64 + type: integer + seLinuxOptions: + properties: + level: + type: string + role: + type: string + type: + type: string + user: + type: string + type: object + seccompProfile: + properties: + localhostProfile: + type: string + type: + type: string + required: + - type + type: object + windowsOptions: + properties: + gmsaCredentialSpec: + type: string + gmsaCredentialSpecName: + type: string + hostProcess: + type: boolean + runAsUserName: + type: string + type: object + type: object + startupProbe: + properties: + exec: + properties: + command: + items: + type: string + type: array + type: object + failureThreshold: + format: int32 + type: integer + grpc: + properties: + port: + format: int32 + type: integer + service: + type: string + required: + - port + type: object + httpGet: + properties: + host: + type: string + httpHeaders: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + path: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + scheme: + type: string + required: + - port + type: object + initialDelaySeconds: + format: int32 + type: integer + periodSeconds: + format: int32 + type: integer + successThreshold: + format: int32 + type: integer + tcpSocket: + properties: + host: + type: string + port: + anyOf: + - type: integer + - type: string + x-kubernetes-int-or-string: true + required: + - port + type: object + terminationGracePeriodSeconds: + format: int64 + type: integer + timeoutSeconds: + format: int32 + type: integer + type: object + stdin: + type: boolean + stdinOnce: + type: boolean + terminationMessagePath: + type: string + terminationMessagePolicy: + type: string + tty: + type: boolean + volumeDevices: + items: + properties: + devicePath: + type: string + name: + type: string + required: + - devicePath + - name + type: object + type: array + volumeMounts: + items: + properties: + mountPath: + type: string + mountPropagation: + type: string + name: + type: string + readOnly: + type: boolean + subPath: + type: string + subPathExpr: + type: string + required: + - mountPath + - name + type: object + type: array + workingDir: + type: string + required: + - name + type: object + type: array + nodeName: + type: string + nodeSelector: + additionalProperties: + type: string + type: object + x-kubernetes-map-type: atomic + os: + properties: + name: + type: string + required: + - name + type: object + overhead: + 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 + preemptionPolicy: + type: string + priority: + format: int32 + type: integer + priorityClassName: + type: string + readinessGates: + items: + properties: + conditionType: + type: string + required: + - conditionType + type: object + type: array + restartPolicy: + type: string + runtimeClassName: + type: string + schedulerName: + type: string + securityContext: + properties: + fsGroup: + format: int64 + type: integer + fsGroupChangePolicy: + type: string + runAsGroup: + format: int64 + type: integer + runAsNonRoot: + type: boolean + runAsUser: + format: int64 + type: integer + seLinuxOptions: + properties: + level: + type: string + role: + type: string + type: + type: string + user: + type: string + type: object + seccompProfile: + properties: + localhostProfile: + type: string + type: + type: string + required: + - type + type: object + supplementalGroups: + items: + format: int64 + type: integer + type: array + sysctls: + items: + properties: + name: + type: string + value: + type: string + required: + - name + - value + type: object + type: array + windowsOptions: + properties: + gmsaCredentialSpec: + type: string + gmsaCredentialSpecName: + type: string + hostProcess: + type: boolean + runAsUserName: + type: string + type: object + type: object + serviceAccountName: + type: string + setHostnameAsFQDN: + type: boolean + shareProcessNamespace: + type: boolean + terminationGracePeriodSeconds: + format: int64 + type: integer + tolerations: + items: + properties: + effect: + type: string + key: + type: string + operator: + type: string + tolerationSeconds: + format: int64 + type: integer + value: + type: string + type: object + type: array + topologySpreadConstraints: + items: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + matchLabelKeys: + items: + type: string + type: array + x-kubernetes-list-type: atomic + maxSkew: + format: int32 + type: integer + minDomains: + format: int32 + type: integer + nodeAffinityPolicy: + type: string + nodeTaintsPolicy: + type: string + topologyKey: + type: string + whenUnsatisfiable: + type: string + required: + - maxSkew + - topologyKey + - whenUnsatisfiable + type: object + type: array + x-kubernetes-list-map-keys: + - topologyKey + - whenUnsatisfiable + x-kubernetes-list-type: map + volumes: + items: + properties: + awsElasticBlockStore: + properties: + fsType: + type: string + partition: + format: int32 + type: integer + readOnly: + type: boolean + volumeID: + type: string + required: + - volumeID + type: object + azureDisk: + properties: + cachingMode: + type: string + diskName: + type: string + diskURI: + type: string + fsType: + type: string + kind: + type: string + readOnly: + type: boolean + required: + - diskName + - diskURI + type: object + azureFile: + properties: + readOnly: + type: boolean + secretName: + type: string + shareName: + type: string + required: + - secretName + - shareName + type: object + cephfs: + properties: + monitors: + items: + type: string + type: array + path: + type: string + readOnly: + type: boolean + secretFile: + type: string + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + user: + type: string + required: + - monitors + type: object + cinder: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + volumeID: + type: string + required: + - volumeID + type: object + configMap: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + csi: + properties: + driver: + type: string + fsType: + type: string + nodePublishSecretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + readOnly: + type: boolean + volumeAttributes: + additionalProperties: + type: string + type: object + required: + - driver + type: object + downwardAPI: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + mode: + format: int32 + type: integer + path: + type: string + resourceFieldRef: + properties: + containerName: + type: string + divisor: + 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 + resource: + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + type: object + emptyDir: + properties: + medium: + type: string + sizeLimit: + 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 + ephemeral: + properties: + volumeClaimTemplate: + properties: + metadata: + properties: + annotations: + additionalProperties: + type: string + type: object + generateName: + type: string + labels: + additionalProperties: + type: string + type: object + name: + type: string + namespace: + type: string + ownerReferences: + items: + properties: + apiVersion: + type: string + blockOwnerDeletion: + type: boolean + controller: + type: boolean + kind: + type: string + name: + type: string + uid: + type: string + required: + - apiVersion + - kind + - name + - uid + type: object + x-kubernetes-map-type: atomic + type: array + type: object + spec: + properties: + accessModes: + items: + type: string + type: array + dataSource: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + dataSourceRef: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + namespace: + type: string + required: + - kind + - name + type: object + resources: + properties: + limits: + 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 + requests: + 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 + type: object + selector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + storageClassName: + type: string + volumeAttributesClassName: + type: string + volumeMode: + type: string + volumeName: + type: string + type: object + required: + - spec + type: object + type: object + fc: + properties: + fsType: + type: string + lun: + format: int32 + type: integer + readOnly: + type: boolean + targetWWNs: + items: + type: string + type: array + wwids: + items: + type: string + type: array + type: object + flexVolume: + properties: + driver: + type: string + fsType: + type: string + options: + additionalProperties: + type: string + type: object + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + required: + - driver + type: object + flocker: + properties: + datasetName: + type: string + datasetUUID: + type: string + type: object + gcePersistentDisk: + properties: + fsType: + type: string + partition: + format: int32 + type: integer + pdName: + type: string + readOnly: + type: boolean + required: + - pdName + type: object + glusterfs: + properties: + endpoints: + type: string + path: + type: string + readOnly: + type: boolean + required: + - endpoints + - path + type: object + hostPath: + properties: + path: + type: string + type: + type: string + required: + - path + type: object + iscsi: + properties: + chapAuthDiscovery: + type: boolean + chapAuthSession: + type: boolean + fsType: + type: string + initiatorName: + type: string + iqn: + type: string + iscsiInterface: + type: string + lun: + format: int32 + type: integer + portals: + items: + type: string + type: array + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + targetPortal: + type: string + required: + - iqn + - lun + - targetPortal + type: object + name: + type: string + nfs: + properties: + path: + type: string + readOnly: + type: boolean + server: + type: string + required: + - path + - server + type: object + persistentVolumeClaim: + properties: + claimName: + type: string + readOnly: + type: boolean + required: + - claimName + type: object + photonPersistentDisk: + properties: + fsType: + type: string + pdID: + type: string + required: + - pdID + type: object + portworxVolume: + properties: + fsType: + type: string + readOnly: + type: boolean + volumeID: + type: string + required: + - volumeID + type: object + projected: + properties: + defaultMode: + format: int32 + type: integer + sources: + items: + properties: + clusterTrustBundle: + properties: + labelSelector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + name: + type: string + optional: + type: boolean + path: + type: string + signerName: + type: string + required: + - path + type: object + configMap: + properties: + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + downwardAPI: + properties: + items: + items: + properties: + fieldRef: + properties: + apiVersion: + type: string + fieldPath: + type: string + required: + - fieldPath + type: object + x-kubernetes-map-type: atomic + mode: + format: int32 + type: integer + path: + type: string + resourceFieldRef: + properties: + containerName: + type: string + divisor: + 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 + resource: + type: string + required: + - resource + type: object + x-kubernetes-map-type: atomic + required: + - path + type: object + type: array + type: object + secret: + properties: + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + name: + type: string + optional: + type: boolean + type: object + x-kubernetes-map-type: atomic + serviceAccountToken: + properties: + audience: + type: string + expirationSeconds: + format: int64 + type: integer + path: + type: string + required: + - path + type: object + type: object + type: array + type: object + quobyte: + properties: + group: + type: string + readOnly: + type: boolean + registry: + type: string + tenant: + type: string + user: + type: string + volume: + type: string + required: + - registry + - volume + type: object + rbd: + properties: + fsType: + type: string + image: + type: string + keyring: + type: string + monitors: + items: + type: string + type: array + pool: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + user: + type: string + required: + - image + - monitors + type: object + scaleIO: + properties: + fsType: + type: string + gateway: + type: string + protectionDomain: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + sslEnabled: + type: boolean + storageMode: + type: string + storagePool: + type: string + system: + type: string + volumeName: + type: string + required: + - gateway + - secretRef + - system + type: object + secret: + properties: + defaultMode: + format: int32 + type: integer + items: + items: + properties: + key: + type: string + mode: + format: int32 + type: integer + path: + type: string + required: + - key + - path + type: object + type: array + optional: + type: boolean + secretName: + type: string + type: object + storageos: + properties: + fsType: + type: string + readOnly: + type: boolean + secretRef: + properties: + name: + type: string + type: object + x-kubernetes-map-type: atomic + volumeName: + type: string + volumeNamespace: + type: string + type: object + vsphereVolume: + properties: + fsType: + type: string + storagePolicyID: + type: string + storagePolicyName: + type: string + volumePath: + type: string + required: + - volumePath + type: object + required: + - name + type: object + type: array + type: object + type: object + replicas: + format: int32 + type: integer + serviceTemplates: + items: + properties: + alias: + enum: + - primary + - standby + - stats + type: string + metadata: + properties: + annotations: + additionalProperties: + type: string + type: object + labels: + additionalProperties: + type: string + type: object + type: object + spec: + properties: + clusterIP: + type: string + externalIPs: + items: + type: string + type: array + externalTrafficPolicy: + type: string + healthCheckNodePort: + format: int32 + type: integer + loadBalancerIP: + type: string + loadBalancerSourceRanges: + items: + type: string + type: array + ports: + items: + properties: + name: + type: string + nodePort: + format: int32 + type: integer + port: + format: int32 + type: integer + required: + - port + type: object + type: array + sessionAffinityConfig: + properties: + clientIP: + properties: + timeoutSeconds: + format: int32 + type: integer + type: object + type: object + type: + type: string + type: object + required: + - alias + type: object + type: array + sslMode: + enum: + - disabled + - allowSSL + - preferSSL + - requireSSL + type: string + storage: + properties: + accessModes: + items: + type: string + type: array + dataSource: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + dataSourceRef: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + namespace: + type: string + required: + - kind + - name + type: object + resources: + properties: + limits: + 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 + requests: + 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 + type: object + selector: + properties: + matchExpressions: + items: + properties: + key: + type: string + operator: + type: string + values: + items: + type: string + type: array + required: + - key + - operator + type: object + type: array + matchLabels: + additionalProperties: + type: string + type: object + type: object + x-kubernetes-map-type: atomic + storageClassName: + type: string + volumeAttributesClassName: + type: string + volumeMode: + type: string + volumeName: + type: string + type: object + storageType: + enum: + - Durable + - Ephemeral + type: string + terminationPolicy: + enum: + - Halt + - Delete + - WipeOut + - DoNotTerminate + type: string + tls: + properties: + certificates: + items: + properties: + alias: + type: string + dnsNames: + items: + type: string + type: array + duration: + type: string + emailAddresses: + items: + type: string + type: array + ipAddresses: + items: + type: string + type: array + issuerRef: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + privateKey: + properties: + encoding: + enum: + - PKCS1 + - PKCS8 + type: string + type: object + renewBefore: + type: string + secretName: + type: string + subject: + properties: + countries: + items: + type: string + type: array + localities: + items: + type: string + type: array + organizationalUnits: + items: + type: string + type: array + organizations: + items: + type: string + type: array + postalCodes: + items: + type: string + type: array + provinces: + items: + type: string + type: array + serialNumber: + type: string + streetAddresses: + items: + type: string + type: array + type: object + uris: + items: + type: string + type: array + required: + - alias + type: object + type: array + issuerRef: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + type: object + version: + type: string + required: + - backend + - version + type: object + status: + properties: + 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: + - Provisioning + - DataRestoring + - Ready + - Critical + - NotReady + - Halted + - Unknown + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/go.mod b/go.mod index 5f44c01b8b..ba66cf6092 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( github.com/Masterminds/semver/v3 v3.2.1 github.com/cert-manager/cert-manager v1.9.1 github.com/evanphx/json-patch v5.7.0+incompatible + github.com/fatih/structs v1.1.0 github.com/google/go-cmp v0.6.0 github.com/google/gofuzz v1.2.0 github.com/iancoleman/orderedmap v0.2.0 @@ -77,7 +78,6 @@ require ( github.com/docker/docker-credential-helpers v0.7.0 // indirect github.com/emicklei/go-restful/v3 v3.11.0 // indirect github.com/evanphx/json-patch/v5 v5.7.0 // indirect - github.com/fatih/structs v1.1.0 // indirect github.com/felixge/httpsnoop v1.0.3 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/go-logr/logr v1.3.0 // indirect diff --git a/pkg/openapi/lib.go b/pkg/openapi/lib.go index 72c060d099..f193b919a1 100644 --- a/pkg/openapi/lib.go +++ b/pkg/openapi/lib.go @@ -65,12 +65,6 @@ func ConfigureOpenAPI(scheme *runtime.Scheme, serverConfig *genericapiserver.Rec "/apis/mutators.kubedb.com/v1alpha1/singlestorewebhooks", "/apis/mutators.kubedb.com/v1alpha1/solrwebhooks", "/apis/mutators.kubedb.com/v1alpha1/zookeeperwebhooks", - "/apis/mutators.kubedb.com/v1alpha1/rabbitmqwebhooks", - "/apis/mutators.kubedb.com/v1alpha1/druidwebhooks", - "/apis/mutators.kubedb.com/v1alpha1/solrwebhooks", - "/apis/mutators.kubedb.com/v1alpha1/singlestorewebhooks", - "/apis/mutators.kubedb.com/v1alpha1/pgpoolwebhooks", - "/apis/mutators.kubedb.com/v1alpha1/ferretdbwebhooks", "/apis/mutators.ops.kubedb.com/v1alpha1", "/apis/mutators.ops.kubedb.com/v1alpha1/mysqlopsrequestwebhooks", @@ -121,12 +115,6 @@ func ConfigureOpenAPI(scheme *runtime.Scheme, serverConfig *genericapiserver.Rec "/apis/validators.kubedb.com/v1alpha1/singlestorewebhooks", "/apis/validators.kubedb.com/v1alpha1/solrwebhooks", "/apis/validators.kubedb.com/v1alpha1/zookeeperwebhooks", - "/apis/validators.kubedb.com/v1alpha1/rabbitmqwebhooks", - "/apis/validators.kubedb.com/v1alpha1/druidwebhooks", - "/apis/validators.kubedb.com/v1alpha1/solrwebhooks", - "/apis/validators.kubedb.com/v1alpha1/singlestorewebhooks", - "/apis/validators.kubedb.com/v1alpha1/pgpoolwebhooks", - "/apis/validators.kubedb.com/v1alpha1/ferretdbwebhooks", "/apis/validators.ops.kubedb.com/v1alpha1", "/apis/validators.ops.kubedb.com/v1alpha1/elasticsearchopsrequestwebhooks",