diff --git a/apis/catalog/v1alpha1/milvus_version_types.go b/apis/catalog/v1alpha1/milvus_version_types.go index 92012bc48e..4edca3def2 100644 --- a/apis/catalog/v1alpha1/milvus_version_types.go +++ b/apis/catalog/v1alpha1/milvus_version_types.go @@ -27,10 +27,13 @@ const ( ResourcePluralMilvusVersion = "milvusversions" ) -// Package v1alpha2 contains API Schema definitions for the v1alpha2 API group. +// +genclient +// +genclient:nonNamespaced +// +genclient:skipVerbs=updateStatus +// +k8s:openapi-gen=true // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + // +kubebuilder:object:root=true -// +genclient:nonNamespaced // +kubebuilder:resource:path=milvusversions,singular=milvusversion,scope=Cluster,shortName=mvversion,categories={catalog,kubedb,appscode} // +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".spec.version" // +kubebuilder:printcolumn:name="DB_IMAGE",type="string",JSONPath=".spec.db.image" diff --git a/apis/catalog/v1alpha1/openapi_generated.go b/apis/catalog/v1alpha1/openapi_generated.go index afcdeb7cd1..7f264f95bf 100644 --- a/apis/catalog/v1alpha1/openapi_generated.go +++ b/apis/catalog/v1alpha1/openapi_generated.go @@ -37773,8 +37773,7 @@ func schema_apimachinery_apis_catalog_v1alpha1_MilvusVersion(ref common.Referenc return common.OpenAPIDefinition{ Schema: spec.Schema{ SchemaProps: spec.SchemaProps{ - Description: "Package v1alpha2 contains API Schema definitions for the v1alpha2 API group.", - Type: []string{"object"}, + Type: []string{"object"}, Properties: map[string]spec.Schema{ "kind": { SchemaProps: spec.SchemaProps{ diff --git a/apis/catalog/v1alpha1/register.go b/apis/catalog/v1alpha1/register.go index 56e270c359..7ecff74f1f 100644 --- a/apis/catalog/v1alpha1/register.go +++ b/apis/catalog/v1alpha1/register.go @@ -84,6 +84,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &MariaDBVersionList{}, &MemcachedVersion{}, &MemcachedVersionList{}, + &MilvusVersion{}, + &MilvusVersionList{}, &MongoDBVersion{}, &MongoDBVersionList{}, &MSSQLServerVersion{}, @@ -120,8 +122,6 @@ func addKnownTypes(scheme *runtime.Scheme) error { &WeaviateVersionList{}, &ZooKeeperVersion{}, &ZooKeeperVersionList{}, - &MilvusVersion{}, - &MilvusVersionList{}, ) scheme.AddKnownTypes(SchemeGroupVersion, diff --git a/apis/kubedb/constants.go b/apis/kubedb/constants.go index 57a391c816..4bff740101 100644 --- a/apis/kubedb/constants.go +++ b/apis/kubedb/constants.go @@ -915,6 +915,17 @@ const ( MilvusPortDataNode = 21124 MilvusPortQueryNode = 21123 MilvusPortStreamingNode = 22222 + + MilvusTLSVolName = "milvus-tls" + MilvusTLSVolDir = "/milvus/tls" + MilvusTLSCACert = "ca.crt" + MilvusTLSCAPem = "ca.pem" + MilvusTLSCert = "tls.crt" + MilvusTLSKey = "tls.key" + MilvusTLSServerPem = "server.pem" + MilvusTLSServerKeyPem = "server.key" + MilvusTLSClientPem = "client.pem" + MilvusTLSClientKeyPem = "client.key" ) const ( diff --git a/apis/kubedb/v1alpha2/milvus_helpers.go b/apis/kubedb/v1alpha2/milvus_helpers.go index 0b8af7f90f..0dd07682c6 100644 --- a/apis/kubedb/v1alpha2/milvus_helpers.go +++ b/apis/kubedb/v1alpha2/milvus_helpers.go @@ -32,6 +32,7 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/klog/v2" + 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" @@ -80,6 +81,9 @@ func (m Milvus) Type() appcat.AppType { func (m *Milvus) GetConnectionScheme() string { scheme := "http" + if m.Spec.TLS != nil && m.Spec.TLS.External != nil && m.Spec.TLS.External.Mode != TLSModeDisabled { + scheme = "https" + } return scheme } @@ -354,6 +358,8 @@ func (m *Milvus) SetDefaults(kc client.Client) { m.SetHealthCheckerDefaults() + m.SetTLSDefaults() + if m.Spec.Monitor != nil { if m.Spec.Monitor.Prometheus == nil { m.Spec.Monitor.Prometheus = &mona.PrometheusSpec{} @@ -371,6 +377,27 @@ func (m *Milvus) SetDefaults(kc client.Client) { } } +func (m *Milvus) SetTLSDefaults() { + if m.Spec.TLS == nil || m.Spec.TLS.IssuerRef == nil { + return + } + + if m.Spec.TLS.External == nil { + m.Spec.TLS.External = &ProtocolTLSConfig{ + Mode: TLSModeDisabled, + } + } + + if m.Spec.TLS.Internal == nil { + m.Spec.TLS.Internal = &ProtocolTLSConfig{ + Mode: TLSModeDisabled, + } + } + + m.Spec.TLS.Certificates = kmapi.SetMissingSecretNameForCertificate(m.Spec.TLS.Certificates, string(MilvusCertificateTypeServer), m.CertificateName(MilvusCertificateTypeServer)) + m.Spec.TLS.Certificates = kmapi.SetMissingSecretNameForCertificate(m.Spec.TLS.Certificates, string(MilvusCertificateTypeClient), m.CertificateName(MilvusCertificateTypeClient)) +} + func (m *Milvus) setMetaStorageDefaults() { if m.Spec.MetaStorage == nil { m.Spec.MetaStorage = &MetaStorageSpec{} @@ -508,3 +535,17 @@ func (m milvusStatsService) TLSConfig() *promapi.TLSConfig { func (m Milvus) StatsService() mona.StatsAccessor { return &milvusStatsService{&m} } + +func (m *Milvus) GetCertSecretName(alias MilvusCertificateType) string { + if m.Spec.TLS != nil { + name, ok := kmapi.GetCertificateSecretName(m.Spec.TLS.Certificates, string(alias)) + if ok { + return name + } + } + return m.CertificateName(alias) +} + +func (m *Milvus) CertificateName(alias MilvusCertificateType) string { + return meta_util.NameWithSuffix(m.Name, fmt.Sprintf("%s-cert", string(alias))) +} diff --git a/apis/kubedb/v1alpha2/milvus_types.go b/apis/kubedb/v1alpha2/milvus_types.go index c089e2dd56..32218d8d67 100644 --- a/apis/kubedb/v1alpha2/milvus_types.go +++ b/apis/kubedb/v1alpha2/milvus_types.go @@ -42,7 +42,6 @@ type MilvusMode string // +kubebuilder:object:root=true // +kubebuilder:subresource:status // +kubebuilder:resource:path=milvuses,singular=milvus,shortName=mv,categories={datastore,kubedb,appscode,all} - // +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" @@ -113,8 +112,32 @@ type MilvusSpec struct { // Monitor is used monitor database instance // +optional Monitor *mona.AgentSpec `json:"monitor,omitempty"` + + // TLS contains tls configurations + // +optional + TLS *MilvusTLSConfig `json:"tls,omitempty"` } +type MilvusTLSConfig struct { + kmapi.TLSConfig `json:",inline"` + + // External controls TLS for client-facing traffic (gRPC + REST). + // +optional + External *ProtocolTLSConfig `json:"external,omitempty"` + + // Internal enables TLS for inter-component communication (one-way only) + // +optional + Internal *ProtocolTLSConfig `json:"internal,omitempty"` +} + +// +kubebuilder:validation:Enum=server;client +type MilvusCertificateType string + +const ( + MilvusCertificateTypeServer MilvusCertificateType = "server" + MilvusCertificateTypeClient MilvusCertificateType = "client" +) + type MilvusTopology struct { // If set to - // "Standalone", Milvus will start a Standalone Mode diff --git a/apis/kubedb/v1alpha2/neo4j_types.go b/apis/kubedb/v1alpha2/neo4j_types.go index dcb1eabf8f..f790ce6d18 100644 --- a/apis/kubedb/v1alpha2/neo4j_types.go +++ b/apis/kubedb/v1alpha2/neo4j_types.go @@ -117,20 +117,6 @@ type Neo4jTLSConfig struct { KeystoreCredSecret *SecretReference `json:"keystoreCredSecret,omitempty"` } -type TLSMode string - -const ( - TLSModeDisabled TLSMode = "Disabled" - TLSModeTLS TLSMode = "TLS" - TLSModeMTLS TLSMode = "mTLS" -) - -type ProtocolTLSConfig struct { - // +kubebuilder:validation:Enum=Disabled;TLS;mTLS - // +optional - Mode TLSMode `json:"mode,omitempty"` -} - // Neo4jStatus defines the observed state of Neo4j. type Neo4jStatus struct { // Important: Run "make" to regenerate code after modifying this file diff --git a/apis/kubedb/v1alpha2/openapi_generated.go b/apis/kubedb/v1alpha2/openapi_generated.go index 8d93cf5e81..93ef02774b 100644 --- a/apis/kubedb/v1alpha2/openapi_generated.go +++ b/apis/kubedb/v1alpha2/openapi_generated.go @@ -711,6 +711,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.MilvusNode": schema_apimachinery_apis_kubedb_v1alpha2_MilvusNode(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.MilvusSpec": schema_apimachinery_apis_kubedb_v1alpha2_MilvusSpec(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.MilvusStatus": schema_apimachinery_apis_kubedb_v1alpha2_MilvusStatus(ref), + "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.MilvusTLSConfig": schema_apimachinery_apis_kubedb_v1alpha2_MilvusTLSConfig(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.MilvusTopology": schema_apimachinery_apis_kubedb_v1alpha2_MilvusTopology(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.MongoArbiterNode": schema_apimachinery_apis_kubedb_v1alpha2_MongoArbiterNode(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.MongoDB": schema_apimachinery_apis_kubedb_v1alpha2_MongoDB(ref), @@ -40464,12 +40465,18 @@ func schema_apimachinery_apis_kubedb_v1alpha2_MilvusSpec(ref common.ReferenceCal Ref: ref("kmodules.xyz/monitoring-agent-api/api/v1.AgentSpec"), }, }, + "tls": { + SchemaProps: spec.SchemaProps{ + Description: "TLS contains tls configurations", + Ref: ref("kubedb.dev/apimachinery/apis/kubedb/v1alpha2.MilvusTLSConfig"), + }, + }, }, Required: []string{"version", "objectStorage"}, }, }, Dependencies: []string{ - "k8s.io/api/core/v1.PersistentVolumeClaimSpec", "kmodules.xyz/client-go/api/v1.HealthCheckSpec", "kmodules.xyz/monitoring-agent-api/api/v1.AgentSpec", "kmodules.xyz/offshoot-api/api/v2.PodTemplateSpec", "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.ConfigurationSpec", "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.MetaStorageSpec", "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.MilvusTopology", "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.NamedServiceTemplateSpec", "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.ObjectStorageSpec", "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.SecretReference"}, + "k8s.io/api/core/v1.PersistentVolumeClaimSpec", "kmodules.xyz/client-go/api/v1.HealthCheckSpec", "kmodules.xyz/monitoring-agent-api/api/v1.AgentSpec", "kmodules.xyz/offshoot-api/api/v2.PodTemplateSpec", "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.ConfigurationSpec", "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.MetaStorageSpec", "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.MilvusTLSConfig", "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.MilvusTopology", "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.NamedServiceTemplateSpec", "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.ObjectStorageSpec", "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.SecretReference"}, } } @@ -40516,6 +40523,52 @@ func schema_apimachinery_apis_kubedb_v1alpha2_MilvusStatus(ref common.ReferenceC } } +func schema_apimachinery_apis_kubedb_v1alpha2_MilvusTLSConfig(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "issuerRef": { + SchemaProps: spec.SchemaProps{ + Description: "IssuerRef is a reference to a Certificate Issuer.", + Ref: ref("k8s.io/api/core/v1.TypedLocalObjectReference"), + }, + }, + "certificates": { + SchemaProps: spec.SchemaProps{ + Description: "Certificate provides server and/or client certificate options used by application pods. These options are passed to a cert-manager Certificate object. xref: https://github.com/jetstack/cert-manager/blob/v0.16.0/pkg/apis/certmanager/v1beta1/types_certificate.go#L82-L162", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/client-go/api/v1.CertificateSpec"), + }, + }, + }, + }, + }, + "external": { + SchemaProps: spec.SchemaProps{ + Description: "External controls TLS for client-facing traffic (gRPC + REST).", + Ref: ref("kubedb.dev/apimachinery/apis/kubedb/v1alpha2.ProtocolTLSConfig"), + }, + }, + "internal": { + SchemaProps: spec.SchemaProps{ + Description: "Internal enables TLS for inter-component communication (one-way only)", + Ref: ref("kubedb.dev/apimachinery/apis/kubedb/v1alpha2.ProtocolTLSConfig"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.TypedLocalObjectReference", "kmodules.xyz/client-go/api/v1.CertificateSpec", "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.ProtocolTLSConfig"}, + } +} + func schema_apimachinery_apis_kubedb_v1alpha2_MilvusTopology(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/apis/kubedb/v1alpha2/types.go b/apis/kubedb/v1alpha2/types.go index c4e98f872f..23ea849be9 100644 --- a/apis/kubedb/v1alpha2/types.go +++ b/apis/kubedb/v1alpha2/types.go @@ -250,6 +250,19 @@ type Archiver struct { Ref kmapi.ObjectReference `json:"ref"` } +type TLSMode string + +const ( + TLSModeDisabled TLSMode = "Disabled" + TLSModeTLS TLSMode = "TLS" + TLSModeMTLS TLSMode = "mTLS" +) + +type ProtocolTLSConfig struct { + // +kubebuilder:validation:Enum=Disabled;TLS;mTLS + // +optional + Mode TLSMode `json:"mode,omitempty"` +} type ArchiverRecovery struct { RecoveryTimestamp metav1.Time `json:"recoveryTimestamp"` // +optional diff --git a/apis/kubedb/v1alpha2/zz_generated.deepcopy.go b/apis/kubedb/v1alpha2/zz_generated.deepcopy.go index f7133437b1..c1d846097f 100644 --- a/apis/kubedb/v1alpha2/zz_generated.deepcopy.go +++ b/apis/kubedb/v1alpha2/zz_generated.deepcopy.go @@ -4293,6 +4293,11 @@ func (in *MilvusSpec) DeepCopyInto(out *MilvusSpec) { *out = new(monitoringagentapiapiv1.AgentSpec) (*in).DeepCopyInto(*out) } + if in.TLS != nil { + in, out := &in.TLS, &out.TLS + *out = new(MilvusTLSConfig) + (*in).DeepCopyInto(*out) + } return } @@ -4329,6 +4334,33 @@ func (in *MilvusStatus) DeepCopy() *MilvusStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MilvusTLSConfig) DeepCopyInto(out *MilvusTLSConfig) { + *out = *in + in.TLSConfig.DeepCopyInto(&out.TLSConfig) + if in.External != nil { + in, out := &in.External, &out.External + *out = new(ProtocolTLSConfig) + **out = **in + } + if in.Internal != nil { + in, out := &in.Internal, &out.Internal + *out = new(ProtocolTLSConfig) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MilvusTLSConfig. +func (in *MilvusTLSConfig) DeepCopy() *MilvusTLSConfig { + if in == nil { + return nil + } + out := new(MilvusTLSConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MilvusTopology) DeepCopyInto(out *MilvusTopology) { *out = *in diff --git a/apis/ops/v1alpha1/constant.go b/apis/ops/v1alpha1/constant.go index 3a372d7d0c..2b13573731 100644 --- a/apis/ops/v1alpha1/constant.go +++ b/apis/ops/v1alpha1/constant.go @@ -409,6 +409,11 @@ const ( UpdateCredentialDynamically = "UpdateCredentialDynamically" ) +// Milvus Constants +const ( + UpdateStreamingNodePVCs = "UpdateStreamingNodePVCs" +) + // SingleStore Constants const ( UpdateAggregatorNodePVCs = "UpdateAggregatorNodePVCs" diff --git a/apis/ops/v1alpha1/milvus_ops_helpers.go b/apis/ops/v1alpha1/milvus_ops_helpers.go new file mode 100644 index 0000000000..a7fbfc7276 --- /dev/null +++ b/apis/ops/v1alpha1/milvus_ops_helpers.go @@ -0,0 +1,76 @@ +/* +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/ops" + "kubedb.dev/apimachinery/crds" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "kmodules.xyz/client-go/apiextensions" +) + +func (r *MilvusOpsRequest) CustomResourceDefinition() *apiextensions.CustomResourceDefinition { + return crds.MustCustomResourceDefinition(SchemeGroupVersion.WithResource(ResourcePluralMilvusOpsRequest)) +} + +var _ apis.ResourceInfo = &MilvusOpsRequest{} + +func (r *MilvusOpsRequest) ResourceFQN() string { + return fmt.Sprintf("%s.%s", ResourcePluralMilvusOpsRequest, ops.GroupName) +} + +func (r *MilvusOpsRequest) ResourceShortCode() string { + return ResourceCodeMilvusOpsRequest +} + +func (r *MilvusOpsRequest) ResourceKind() string { + return ResourceKindMilvusOpsRequest +} + +func (r *MilvusOpsRequest) ResourceSingular() string { + return ResourceSingularMilvusOpsRequest +} + +func (r *MilvusOpsRequest) ResourcePlural() string { + return ResourcePluralMilvusOpsRequest +} + +var _ Accessor = &MilvusOpsRequest{} + +func (r *MilvusOpsRequest) GetObjectMeta() metav1.ObjectMeta { + return r.ObjectMeta +} + +func (r *MilvusOpsRequest) GetDBRefName() string { + return r.Spec.DatabaseRef.Name +} + +func (r *MilvusOpsRequest) GetRequestType() string { + return string(r.Spec.Type) +} + +func (r *MilvusOpsRequest) GetStatus() OpsRequestStatus { + return r.Status +} + +func (r *MilvusOpsRequest) SetStatus(s OpsRequestStatus) { + r.Status = s +} diff --git a/apis/ops/v1alpha1/milvus_ops_types.go b/apis/ops/v1alpha1/milvus_ops_types.go new file mode 100644 index 0000000000..5d46411a2c --- /dev/null +++ b/apis/ops/v1alpha1/milvus_ops_types.go @@ -0,0 +1,163 @@ +/* +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. +*/ + +//go:generate go-enum --mustparse --names --values +package v1alpha1 + +import ( + api "kubedb.dev/apimachinery/apis/kubedb/v1alpha2" + + core "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +const ( + ResourceCodeMilvusOpsRequest = "mvops" + ResourceKindMilvusOpsRequest = "MilvusOpsRequest" + ResourceSingularMilvusOpsRequest = "milvusopsrequest" + ResourcePluralMilvusOpsRequest = "milvusopsrequests" +) + +// MilvusDBOpsRequest defines a Milvus DBA operation. + +// +genclient +// +k8s:openapi-gen=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// +kubebuilder:object:root=true +// +kubebuilder:resource:path=milvusopsrequests,singular=milvusopsrequest,shortName=mvops,categories={ops,kubedb,appscode} +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="Type",type="string",JSONPath=".spec.type" +// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase" +// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +type MilvusOpsRequest struct { + metav1.TypeMeta `json:",inline,omitempty"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec MilvusOpsRequestSpec `json:"spec,omitempty"` + Status OpsRequestStatus `json:"status,omitempty"` +} + +// MilvusOpsRequestSpec is the spec for MilvusOpsRequest +type MilvusOpsRequestSpec struct { + // Specifies the Milvus reference + DatabaseRef core.LocalObjectReference `json:"databaseRef"` + // Specifies the ops request type: UpdateVersion, HorizontalScaling, VerticalScaling etc. + Type MilvusOpsRequestType `json:"type"` + // Specifies information necessary for upgrading milvus + UpdateVersion *MilvusUpdateVersionSpec `json:"updateVersion,omitempty"` + // Specifies information necessary for horizontal scaling + HorizontalScaling *MilvusHorizontalScalingSpec `json:"horizontalScaling,omitempty"` + // Specifies information necessary for vertical scaling + VerticalScaling *MilvusVerticalScalingSpec `json:"verticalScaling,omitempty"` + // Specifies information necessary for volume expansion + VolumeExpansion *MilvusVolumeExpansionSpec `json:"volumeExpansion,omitempty"` + // Specifies information necessary for custom configuration of milvus + Configuration *ReconfigurationSpec `json:"configuration,omitempty"` + // Specifies information necessary for configuring TLS + TLS *MilvusTLSSpec `json:"tls,omitempty"` + // Specifies information necessary for configuring authSecret of the database + Authentication *AuthSpec `json:"authentication,omitempty"` + // Specifies information necessary for restarting database + Restart *RestartSpec `json:"restart,omitempty"` + // Timeout for each step of the ops request in second. If a step doesn't finish within the specified timeout, the ops request will result in failure. + Timeout *metav1.Duration `json:"timeout,omitempty"` + // ApplyOption is to control the execution of OpsRequest depending on the database state. + // +kubebuilder:default="IfReady" + Apply ApplyOption `json:"apply,omitempty"` + // +kubebuilder:default=1 + MaxRetries int32 `json:"maxRetries,omitempty"` +} + +// +kubebuilder:validation:Enum=UpdateVersion;HorizontalScaling;VerticalScaling;VolumeExpansion;Restart;Reconfigure;ReconfigureTLS;RotateAuth +// ENUM(UpdateVersion, HorizontalScaling, VerticalScaling, VolumeExpansion, Restart, Reconfigure, ReconfigureTLS, RotateAuth) +type MilvusOpsRequestType string + +// MilvusUpdateVersionSpec contains the update version information of a milvus cluster +type MilvusUpdateVersionSpec struct { + // Specifies the target version name from catalog + TargetVersion string `json:"targetVersion,omitempty"` +} + +// MilvusReplicaReadinessCriteria is the criteria for checking readiness of a Milvus pod +// after updating, horizontal scaling etc. +type MilvusReplicaReadinessCriteria struct{} + +// MilvusHorizontalScalingSpec contains the horizontal scaling information of a Milvus cluster +type MilvusHorizontalScalingSpec struct { + // Node topology specification + Topology *MilvusHorizontalScalingTopologySpec `json:"topology,omitempty"` +} + +// MilvusHorizontalScalingTopologySpec contains the horizontal scaling information in cluster topology mode +type MilvusHorizontalScalingTopologySpec struct { + // Standalone node + Node *int32 `json:"node,omitempty"` + // Number of Proxy nodes + Proxy *int32 `json:"proxy,omitempty"` + // Number of MixCoord nodes + MixCoord *int32 `json:"mixcoord,omitempty"` + // Number of QueryNode nodes + QueryNode *int32 `json:"querynode,omitempty"` + // Number of StreamingNode nodes + StreamingNode *int32 `json:"streamingnode,omitempty"` + // Number of DataNode nodes + DataNode *int32 `json:"dataNode,omitempty"` +} + +// MilvusVerticalScalingSpec contains the vertical scaling information of a Milvus cluster +type MilvusVerticalScalingSpec struct { + // Used when Milvus runs in Standalone mode + Node *PodResources `json:"node,omitempty"` + // Used when Milvus runs in Distributed mode + Proxy *PodResources `json:"proxy,omitempty"` + MixCoord *PodResources `json:"mixcoord,omitempty"` + DataNode *PodResources `json:"datanode,omitempty"` + QueryNode *PodResources `json:"querynode,omitempty"` + StreamingNode *PodResources `json:"streamingnode,omitempty"` +} + +// MilvusVolumeExpansionSpec is the spec for Milvus volume expansion +type MilvusVolumeExpansionSpec struct { + Mode VolumeExpansionMode `json:"mode"` + // volume specification for standalone node + Node *resource.Quantity `json:"node,omitempty"` + // volume specification for stremingnode + StreamingNode *resource.Quantity `json:"streamingnode,omitempty"` +} + +type MilvusTLSSpec struct { + // +optional + api.MilvusTLSConfig `json:",inline,omitempty"` + + // RotateCertificates tells operator to initiate certificate rotation + // +optional + RotateCertificates bool `json:"rotateCertificates,omitempty"` + + // Remove tells operator to remove TLS configuration + // +optional + Remove bool `json:"remove,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// MilvusOpsRequestList is a list of MilvusOpsRequests +type MilvusOpsRequestList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + // Items is a list of MilvusOpsRequest CRD objects + Items []MilvusOpsRequest `json:"items,omitempty"` +} diff --git a/apis/ops/v1alpha1/milvus_ops_types_enum.go b/apis/ops/v1alpha1/milvus_ops_types_enum.go new file mode 100644 index 0000000000..01a66afc3e --- /dev/null +++ b/apis/ops/v1alpha1/milvus_ops_types_enum.go @@ -0,0 +1,104 @@ +// Code generated by go-enum DO NOT EDIT. +// Version: v0.9.2 + +// Built By: go install + +package v1alpha1 + +import ( + "fmt" + "strings" +) + +const ( + // MilvusOpsRequestTypeUpdateVersion is a MilvusOpsRequestType of type UpdateVersion. + MilvusOpsRequestTypeUpdateVersion MilvusOpsRequestType = "UpdateVersion" + // MilvusOpsRequestTypeHorizontalScaling is a MilvusOpsRequestType of type HorizontalScaling. + MilvusOpsRequestTypeHorizontalScaling MilvusOpsRequestType = "HorizontalScaling" + // MilvusOpsRequestTypeVerticalScaling is a MilvusOpsRequestType of type VerticalScaling. + MilvusOpsRequestTypeVerticalScaling MilvusOpsRequestType = "VerticalScaling" + // MilvusOpsRequestTypeVolumeExpansion is a MilvusOpsRequestType of type VolumeExpansion. + MilvusOpsRequestTypeVolumeExpansion MilvusOpsRequestType = "VolumeExpansion" + // MilvusOpsRequestTypeRestart is a MilvusOpsRequestType of type Restart. + MilvusOpsRequestTypeRestart MilvusOpsRequestType = "Restart" + // MilvusOpsRequestTypeReconfigure is a MilvusOpsRequestType of type Reconfigure. + MilvusOpsRequestTypeReconfigure MilvusOpsRequestType = "Reconfigure" + // MilvusOpsRequestTypeReconfigureTLS is a MilvusOpsRequestType of type ReconfigureTLS. + MilvusOpsRequestTypeReconfigureTLS MilvusOpsRequestType = "ReconfigureTLS" + // MilvusOpsRequestTypeRotateAuth is a MilvusOpsRequestType of type RotateAuth. + MilvusOpsRequestTypeRotateAuth MilvusOpsRequestType = "RotateAuth" +) + +var ErrInvalidMilvusOpsRequestType = fmt.Errorf("not a valid MilvusOpsRequestType, try [%s]", strings.Join(_MilvusOpsRequestTypeNames, ", ")) + +var _MilvusOpsRequestTypeNames = []string{ + string(MilvusOpsRequestTypeUpdateVersion), + string(MilvusOpsRequestTypeHorizontalScaling), + string(MilvusOpsRequestTypeVerticalScaling), + string(MilvusOpsRequestTypeVolumeExpansion), + string(MilvusOpsRequestTypeRestart), + string(MilvusOpsRequestTypeReconfigure), + string(MilvusOpsRequestTypeReconfigureTLS), + string(MilvusOpsRequestTypeRotateAuth), +} + +// MilvusOpsRequestTypeNames returns a list of possible string values of MilvusOpsRequestType. +func MilvusOpsRequestTypeNames() []string { + tmp := make([]string, len(_MilvusOpsRequestTypeNames)) + copy(tmp, _MilvusOpsRequestTypeNames) + return tmp +} + +// MilvusOpsRequestTypeValues returns a list of the values for MilvusOpsRequestType +func MilvusOpsRequestTypeValues() []MilvusOpsRequestType { + return []MilvusOpsRequestType{ + MilvusOpsRequestTypeUpdateVersion, + MilvusOpsRequestTypeHorizontalScaling, + MilvusOpsRequestTypeVerticalScaling, + MilvusOpsRequestTypeVolumeExpansion, + MilvusOpsRequestTypeRestart, + MilvusOpsRequestTypeReconfigure, + MilvusOpsRequestTypeReconfigureTLS, + MilvusOpsRequestTypeRotateAuth, + } +} + +// String implements the Stringer interface. +func (x MilvusOpsRequestType) String() string { + return string(x) +} + +// IsValid provides a quick way to determine if the typed value is +// part of the allowed enumerated values +func (x MilvusOpsRequestType) IsValid() bool { + _, err := ParseMilvusOpsRequestType(string(x)) + return err == nil +} + +var _MilvusOpsRequestTypeValue = map[string]MilvusOpsRequestType{ + "UpdateVersion": MilvusOpsRequestTypeUpdateVersion, + "HorizontalScaling": MilvusOpsRequestTypeHorizontalScaling, + "VerticalScaling": MilvusOpsRequestTypeVerticalScaling, + "VolumeExpansion": MilvusOpsRequestTypeVolumeExpansion, + "Restart": MilvusOpsRequestTypeRestart, + "Reconfigure": MilvusOpsRequestTypeReconfigure, + "ReconfigureTLS": MilvusOpsRequestTypeReconfigureTLS, + "RotateAuth": MilvusOpsRequestTypeRotateAuth, +} + +// ParseMilvusOpsRequestType attempts to convert a string to a MilvusOpsRequestType. +func ParseMilvusOpsRequestType(name string) (MilvusOpsRequestType, error) { + if x, ok := _MilvusOpsRequestTypeValue[name]; ok { + return x, nil + } + return MilvusOpsRequestType(""), fmt.Errorf("%s is %w", name, ErrInvalidMilvusOpsRequestType) +} + +// MustParseMilvusOpsRequestType converts a string to a MilvusOpsRequestType, and panics if is not valid. +func MustParseMilvusOpsRequestType(name string) MilvusOpsRequestType { + val, err := ParseMilvusOpsRequestType(name) + if err != nil { + panic(err) + } + return val +} diff --git a/apis/ops/v1alpha1/openapi_generated.go b/apis/ops/v1alpha1/openapi_generated.go index 91adbf0a8a..aa698e6e62 100644 --- a/apis/ops/v1alpha1/openapi_generated.go +++ b/apis/ops/v1alpha1/openapi_generated.go @@ -688,6 +688,16 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kubedb.dev/apimachinery/apis/ops/v1alpha1.MemcachedUpdateVersionSpec": schema_apimachinery_apis_ops_v1alpha1_MemcachedUpdateVersionSpec(ref), "kubedb.dev/apimachinery/apis/ops/v1alpha1.MemcachedVerticalScalingSpec": schema_apimachinery_apis_ops_v1alpha1_MemcachedVerticalScalingSpec(ref), "kubedb.dev/apimachinery/apis/ops/v1alpha1.MemcachedVolumeExpansionSpec": schema_apimachinery_apis_ops_v1alpha1_MemcachedVolumeExpansionSpec(ref), + "kubedb.dev/apimachinery/apis/ops/v1alpha1.MilvusHorizontalScalingSpec": schema_apimachinery_apis_ops_v1alpha1_MilvusHorizontalScalingSpec(ref), + "kubedb.dev/apimachinery/apis/ops/v1alpha1.MilvusHorizontalScalingTopologySpec": schema_apimachinery_apis_ops_v1alpha1_MilvusHorizontalScalingTopologySpec(ref), + "kubedb.dev/apimachinery/apis/ops/v1alpha1.MilvusOpsRequest": schema_apimachinery_apis_ops_v1alpha1_MilvusOpsRequest(ref), + "kubedb.dev/apimachinery/apis/ops/v1alpha1.MilvusOpsRequestList": schema_apimachinery_apis_ops_v1alpha1_MilvusOpsRequestList(ref), + "kubedb.dev/apimachinery/apis/ops/v1alpha1.MilvusOpsRequestSpec": schema_apimachinery_apis_ops_v1alpha1_MilvusOpsRequestSpec(ref), + "kubedb.dev/apimachinery/apis/ops/v1alpha1.MilvusReplicaReadinessCriteria": schema_apimachinery_apis_ops_v1alpha1_MilvusReplicaReadinessCriteria(ref), + "kubedb.dev/apimachinery/apis/ops/v1alpha1.MilvusTLSSpec": schema_apimachinery_apis_ops_v1alpha1_MilvusTLSSpec(ref), + "kubedb.dev/apimachinery/apis/ops/v1alpha1.MilvusUpdateVersionSpec": schema_apimachinery_apis_ops_v1alpha1_MilvusUpdateVersionSpec(ref), + "kubedb.dev/apimachinery/apis/ops/v1alpha1.MilvusVerticalScalingSpec": schema_apimachinery_apis_ops_v1alpha1_MilvusVerticalScalingSpec(ref), + "kubedb.dev/apimachinery/apis/ops/v1alpha1.MilvusVolumeExpansionSpec": schema_apimachinery_apis_ops_v1alpha1_MilvusVolumeExpansionSpec(ref), "kubedb.dev/apimachinery/apis/ops/v1alpha1.MongoDBHorizontalScalingSpec": schema_apimachinery_apis_ops_v1alpha1_MongoDBHorizontalScalingSpec(ref), "kubedb.dev/apimachinery/apis/ops/v1alpha1.MongoDBOpsRequest": schema_apimachinery_apis_ops_v1alpha1_MongoDBOpsRequest(ref), "kubedb.dev/apimachinery/apis/ops/v1alpha1.MongoDBOpsRequestList": schema_apimachinery_apis_ops_v1alpha1_MongoDBOpsRequestList(ref), @@ -38093,6 +38103,448 @@ func schema_apimachinery_apis_ops_v1alpha1_MemcachedVolumeExpansionSpec(ref comm } } +func schema_apimachinery_apis_ops_v1alpha1_MilvusHorizontalScalingSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MilvusHorizontalScalingSpec contains the horizontal scaling information of a Milvus cluster", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "topology": { + SchemaProps: spec.SchemaProps{ + Description: "Node topology specification", + Ref: ref("kubedb.dev/apimachinery/apis/ops/v1alpha1.MilvusHorizontalScalingTopologySpec"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "kubedb.dev/apimachinery/apis/ops/v1alpha1.MilvusHorizontalScalingTopologySpec"}, + } +} + +func schema_apimachinery_apis_ops_v1alpha1_MilvusHorizontalScalingTopologySpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MilvusHorizontalScalingTopologySpec contains the horizontal scaling information in cluster topology mode", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "node": { + SchemaProps: spec.SchemaProps{ + Description: "Standalone node", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "proxy": { + SchemaProps: spec.SchemaProps{ + Description: "Number of Proxy nodes", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "mixcoord": { + SchemaProps: spec.SchemaProps{ + Description: "Number of MixCoord nodes", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "querynode": { + SchemaProps: spec.SchemaProps{ + Description: "Number of QueryNode nodes", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "streamingnode": { + SchemaProps: spec.SchemaProps{ + Description: "Number of StreamingNode nodes", + Type: []string{"integer"}, + Format: "int32", + }, + }, + "dataNode": { + SchemaProps: spec.SchemaProps{ + Description: "Number of DataNode nodes", + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + }, + }, + } +} + +func schema_apimachinery_apis_ops_v1alpha1_MilvusOpsRequest(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/ops/v1alpha1.MilvusOpsRequestSpec"), + }, + }, + "status": { + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kubedb.dev/apimachinery/apis/ops/v1alpha1.OpsRequestStatus"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ObjectMeta", "kubedb.dev/apimachinery/apis/ops/v1alpha1.MilvusOpsRequestSpec", "kubedb.dev/apimachinery/apis/ops/v1alpha1.OpsRequestStatus"}, + } +} + +func schema_apimachinery_apis_ops_v1alpha1_MilvusOpsRequestList(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MilvusOpsRequestList is a list of MilvusOpsRequests", + 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{ + Description: "Items is a list of MilvusOpsRequest CRD objects", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kubedb.dev/apimachinery/apis/ops/v1alpha1.MilvusOpsRequest"), + }, + }, + }, + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/apis/meta/v1.ListMeta", "kubedb.dev/apimachinery/apis/ops/v1alpha1.MilvusOpsRequest"}, + } +} + +func schema_apimachinery_apis_ops_v1alpha1_MilvusOpsRequestSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MilvusOpsRequestSpec is the spec for MilvusOpsRequest", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "databaseRef": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies the Milvus reference", + Default: map[string]interface{}{}, + Ref: ref("k8s.io/api/core/v1.LocalObjectReference"), + }, + }, + "type": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies the ops request type: UpdateVersion, HorizontalScaling, VerticalScaling etc.", + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "updateVersion": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies information necessary for upgrading milvus", + Ref: ref("kubedb.dev/apimachinery/apis/ops/v1alpha1.MilvusUpdateVersionSpec"), + }, + }, + "horizontalScaling": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies information necessary for horizontal scaling", + Ref: ref("kubedb.dev/apimachinery/apis/ops/v1alpha1.MilvusHorizontalScalingSpec"), + }, + }, + "verticalScaling": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies information necessary for vertical scaling", + Ref: ref("kubedb.dev/apimachinery/apis/ops/v1alpha1.MilvusVerticalScalingSpec"), + }, + }, + "volumeExpansion": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies information necessary for volume expansion", + Ref: ref("kubedb.dev/apimachinery/apis/ops/v1alpha1.MilvusVolumeExpansionSpec"), + }, + }, + "configuration": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies information necessary for custom configuration of milvus", + Ref: ref("kubedb.dev/apimachinery/apis/ops/v1alpha1.ReconfigurationSpec"), + }, + }, + "tls": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies information necessary for configuring TLS", + Ref: ref("kubedb.dev/apimachinery/apis/ops/v1alpha1.MilvusTLSSpec"), + }, + }, + "authentication": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies information necessary for configuring authSecret of the database", + Ref: ref("kubedb.dev/apimachinery/apis/ops/v1alpha1.AuthSpec"), + }, + }, + "restart": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies information necessary for restarting database", + Ref: ref("kubedb.dev/apimachinery/apis/ops/v1alpha1.RestartSpec"), + }, + }, + "timeout": { + SchemaProps: spec.SchemaProps{ + Description: "Timeout for each step of the ops request in second. If a step doesn't finish within the specified timeout, the ops request will result in failure.", + Ref: ref("k8s.io/apimachinery/pkg/apis/meta/v1.Duration"), + }, + }, + "apply": { + SchemaProps: spec.SchemaProps{ + Description: "ApplyOption is to control the execution of OpsRequest depending on the database state.", + Type: []string{"string"}, + Format: "", + }, + }, + "maxRetries": { + SchemaProps: spec.SchemaProps{ + Type: []string{"integer"}, + Format: "int32", + }, + }, + }, + Required: []string{"databaseRef", "type"}, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.LocalObjectReference", "k8s.io/apimachinery/pkg/apis/meta/v1.Duration", "kubedb.dev/apimachinery/apis/ops/v1alpha1.AuthSpec", "kubedb.dev/apimachinery/apis/ops/v1alpha1.MilvusHorizontalScalingSpec", "kubedb.dev/apimachinery/apis/ops/v1alpha1.MilvusTLSSpec", "kubedb.dev/apimachinery/apis/ops/v1alpha1.MilvusUpdateVersionSpec", "kubedb.dev/apimachinery/apis/ops/v1alpha1.MilvusVerticalScalingSpec", "kubedb.dev/apimachinery/apis/ops/v1alpha1.MilvusVolumeExpansionSpec", "kubedb.dev/apimachinery/apis/ops/v1alpha1.ReconfigurationSpec", "kubedb.dev/apimachinery/apis/ops/v1alpha1.RestartSpec"}, + } +} + +func schema_apimachinery_apis_ops_v1alpha1_MilvusReplicaReadinessCriteria(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MilvusReplicaReadinessCriteria is the criteria for checking readiness of a Milvus pod after updating, horizontal scaling etc.", + Type: []string{"object"}, + }, + }, + } +} + +func schema_apimachinery_apis_ops_v1alpha1_MilvusTLSSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "issuerRef": { + SchemaProps: spec.SchemaProps{ + Description: "IssuerRef is a reference to a Certificate Issuer.", + Ref: ref("k8s.io/api/core/v1.TypedLocalObjectReference"), + }, + }, + "certificates": { + SchemaProps: spec.SchemaProps{ + Description: "Certificate provides server and/or client certificate options used by application pods. These options are passed to a cert-manager Certificate object. xref: https://github.com/jetstack/cert-manager/blob/v0.16.0/pkg/apis/certmanager/v1beta1/types_certificate.go#L82-L162", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/client-go/api/v1.CertificateSpec"), + }, + }, + }, + }, + }, + "external": { + SchemaProps: spec.SchemaProps{ + Description: "External controls TLS for client-facing traffic (gRPC + REST).", + Ref: ref("kubedb.dev/apimachinery/apis/kubedb/v1alpha2.ProtocolTLSConfig"), + }, + }, + "internal": { + SchemaProps: spec.SchemaProps{ + Description: "Internal enables TLS for inter-component communication (one-way only)", + Ref: ref("kubedb.dev/apimachinery/apis/kubedb/v1alpha2.ProtocolTLSConfig"), + }, + }, + "rotateCertificates": { + SchemaProps: spec.SchemaProps{ + Description: "RotateCertificates tells operator to initiate certificate rotation", + Type: []string{"boolean"}, + Format: "", + }, + }, + "remove": { + SchemaProps: spec.SchemaProps{ + Description: "Remove tells operator to remove TLS configuration", + Type: []string{"boolean"}, + Format: "", + }, + }, + }, + }, + }, + Dependencies: []string{ + "k8s.io/api/core/v1.TypedLocalObjectReference", "kmodules.xyz/client-go/api/v1.CertificateSpec", "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.ProtocolTLSConfig"}, + } +} + +func schema_apimachinery_apis_ops_v1alpha1_MilvusUpdateVersionSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MilvusUpdateVersionSpec contains the update version information of a milvus cluster", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "targetVersion": { + SchemaProps: spec.SchemaProps{ + Description: "Specifies the target version name from catalog", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + +func schema_apimachinery_apis_ops_v1alpha1_MilvusVerticalScalingSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MilvusVerticalScalingSpec contains the vertical scaling information of a Milvus cluster", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "node": { + SchemaProps: spec.SchemaProps{ + Description: "Used when Milvus runs in Standalone mode", + Ref: ref("kubedb.dev/apimachinery/apis/ops/v1alpha1.PodResources"), + }, + }, + "proxy": { + SchemaProps: spec.SchemaProps{ + Description: "Used when Milvus runs in Distributed mode", + Ref: ref("kubedb.dev/apimachinery/apis/ops/v1alpha1.PodResources"), + }, + }, + "mixcoord": { + SchemaProps: spec.SchemaProps{ + Ref: ref("kubedb.dev/apimachinery/apis/ops/v1alpha1.PodResources"), + }, + }, + "datanode": { + SchemaProps: spec.SchemaProps{ + Ref: ref("kubedb.dev/apimachinery/apis/ops/v1alpha1.PodResources"), + }, + }, + "querynode": { + SchemaProps: spec.SchemaProps{ + Ref: ref("kubedb.dev/apimachinery/apis/ops/v1alpha1.PodResources"), + }, + }, + "streamingnode": { + SchemaProps: spec.SchemaProps{ + Ref: ref("kubedb.dev/apimachinery/apis/ops/v1alpha1.PodResources"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "kubedb.dev/apimachinery/apis/ops/v1alpha1.PodResources"}, + } +} + +func schema_apimachinery_apis_ops_v1alpha1_MilvusVolumeExpansionSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "MilvusVolumeExpansionSpec is the spec for Milvus volume expansion", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "mode": { + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + "node": { + SchemaProps: spec.SchemaProps{ + Description: "volume specification for standalone node", + Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"), + }, + }, + "streamingnode": { + SchemaProps: spec.SchemaProps{ + Description: "volume specification for stremingnode", + Ref: ref("k8s.io/apimachinery/pkg/api/resource.Quantity"), + }, + }, + }, + Required: []string{"mode"}, + }, + }, + Dependencies: []string{ + "k8s.io/apimachinery/pkg/api/resource.Quantity"}, + } +} + func schema_apimachinery_apis_ops_v1alpha1_MongoDBHorizontalScalingSpec(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/apis/ops/v1alpha1/register.go b/apis/ops/v1alpha1/register.go index 37741d958d..29a4c15ca5 100644 --- a/apis/ops/v1alpha1/register.go +++ b/apis/ops/v1alpha1/register.go @@ -76,6 +76,8 @@ func addKnownTypes(scheme *runtime.Scheme) error { &MariaDBOpsRequestList{}, &MemcachedOpsRequest{}, &MemcachedOpsRequestList{}, + &MilvusOpsRequest{}, + &MilvusOpsRequestList{}, &MongoDBOpsRequest{}, &MongoDBOpsRequestList{}, &MSSQLServerOpsRequest{}, diff --git a/apis/ops/v1alpha1/zz_generated.deepcopy.go b/apis/ops/v1alpha1/zz_generated.deepcopy.go index 204de4bef3..c312b29dd3 100644 --- a/apis/ops/v1alpha1/zz_generated.deepcopy.go +++ b/apis/ops/v1alpha1/zz_generated.deepcopy.go @@ -3332,6 +3332,317 @@ func (in *MemcachedVolumeExpansionSpec) DeepCopy() *MemcachedVolumeExpansionSpec return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MilvusHorizontalScalingSpec) DeepCopyInto(out *MilvusHorizontalScalingSpec) { + *out = *in + if in.Topology != nil { + in, out := &in.Topology, &out.Topology + *out = new(MilvusHorizontalScalingTopologySpec) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MilvusHorizontalScalingSpec. +func (in *MilvusHorizontalScalingSpec) DeepCopy() *MilvusHorizontalScalingSpec { + if in == nil { + return nil + } + out := new(MilvusHorizontalScalingSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MilvusHorizontalScalingTopologySpec) DeepCopyInto(out *MilvusHorizontalScalingTopologySpec) { + *out = *in + if in.Node != nil { + in, out := &in.Node, &out.Node + *out = new(int32) + **out = **in + } + if in.Proxy != nil { + in, out := &in.Proxy, &out.Proxy + *out = new(int32) + **out = **in + } + if in.MixCoord != nil { + in, out := &in.MixCoord, &out.MixCoord + *out = new(int32) + **out = **in + } + if in.QueryNode != nil { + in, out := &in.QueryNode, &out.QueryNode + *out = new(int32) + **out = **in + } + if in.StreamingNode != nil { + in, out := &in.StreamingNode, &out.StreamingNode + *out = new(int32) + **out = **in + } + if in.DataNode != nil { + in, out := &in.DataNode, &out.DataNode + *out = new(int32) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MilvusHorizontalScalingTopologySpec. +func (in *MilvusHorizontalScalingTopologySpec) DeepCopy() *MilvusHorizontalScalingTopologySpec { + if in == nil { + return nil + } + out := new(MilvusHorizontalScalingTopologySpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MilvusOpsRequest) DeepCopyInto(out *MilvusOpsRequest) { + *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 MilvusOpsRequest. +func (in *MilvusOpsRequest) DeepCopy() *MilvusOpsRequest { + if in == nil { + return nil + } + out := new(MilvusOpsRequest) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MilvusOpsRequest) 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 *MilvusOpsRequestList) DeepCopyInto(out *MilvusOpsRequestList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]MilvusOpsRequest, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MilvusOpsRequestList. +func (in *MilvusOpsRequestList) DeepCopy() *MilvusOpsRequestList { + if in == nil { + return nil + } + out := new(MilvusOpsRequestList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *MilvusOpsRequestList) 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 *MilvusOpsRequestSpec) DeepCopyInto(out *MilvusOpsRequestSpec) { + *out = *in + out.DatabaseRef = in.DatabaseRef + if in.UpdateVersion != nil { + in, out := &in.UpdateVersion, &out.UpdateVersion + *out = new(MilvusUpdateVersionSpec) + **out = **in + } + if in.HorizontalScaling != nil { + in, out := &in.HorizontalScaling, &out.HorizontalScaling + *out = new(MilvusHorizontalScalingSpec) + (*in).DeepCopyInto(*out) + } + if in.VerticalScaling != nil { + in, out := &in.VerticalScaling, &out.VerticalScaling + *out = new(MilvusVerticalScalingSpec) + (*in).DeepCopyInto(*out) + } + if in.VolumeExpansion != nil { + in, out := &in.VolumeExpansion, &out.VolumeExpansion + *out = new(MilvusVolumeExpansionSpec) + (*in).DeepCopyInto(*out) + } + if in.Configuration != nil { + in, out := &in.Configuration, &out.Configuration + *out = new(ReconfigurationSpec) + (*in).DeepCopyInto(*out) + } + if in.TLS != nil { + in, out := &in.TLS, &out.TLS + *out = new(MilvusTLSSpec) + (*in).DeepCopyInto(*out) + } + if in.Authentication != nil { + in, out := &in.Authentication, &out.Authentication + *out = new(AuthSpec) + (*in).DeepCopyInto(*out) + } + if in.Restart != nil { + in, out := &in.Restart, &out.Restart + *out = new(RestartSpec) + **out = **in + } + if in.Timeout != nil { + in, out := &in.Timeout, &out.Timeout + *out = new(metav1.Duration) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MilvusOpsRequestSpec. +func (in *MilvusOpsRequestSpec) DeepCopy() *MilvusOpsRequestSpec { + if in == nil { + return nil + } + out := new(MilvusOpsRequestSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MilvusReplicaReadinessCriteria) DeepCopyInto(out *MilvusReplicaReadinessCriteria) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MilvusReplicaReadinessCriteria. +func (in *MilvusReplicaReadinessCriteria) DeepCopy() *MilvusReplicaReadinessCriteria { + if in == nil { + return nil + } + out := new(MilvusReplicaReadinessCriteria) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MilvusTLSSpec) DeepCopyInto(out *MilvusTLSSpec) { + *out = *in + in.MilvusTLSConfig.DeepCopyInto(&out.MilvusTLSConfig) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MilvusTLSSpec. +func (in *MilvusTLSSpec) DeepCopy() *MilvusTLSSpec { + if in == nil { + return nil + } + out := new(MilvusTLSSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MilvusUpdateVersionSpec) DeepCopyInto(out *MilvusUpdateVersionSpec) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MilvusUpdateVersionSpec. +func (in *MilvusUpdateVersionSpec) DeepCopy() *MilvusUpdateVersionSpec { + if in == nil { + return nil + } + out := new(MilvusUpdateVersionSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MilvusVerticalScalingSpec) DeepCopyInto(out *MilvusVerticalScalingSpec) { + *out = *in + if in.Node != nil { + in, out := &in.Node, &out.Node + *out = new(PodResources) + (*in).DeepCopyInto(*out) + } + if in.Proxy != nil { + in, out := &in.Proxy, &out.Proxy + *out = new(PodResources) + (*in).DeepCopyInto(*out) + } + if in.MixCoord != nil { + in, out := &in.MixCoord, &out.MixCoord + *out = new(PodResources) + (*in).DeepCopyInto(*out) + } + if in.DataNode != nil { + in, out := &in.DataNode, &out.DataNode + *out = new(PodResources) + (*in).DeepCopyInto(*out) + } + if in.QueryNode != nil { + in, out := &in.QueryNode, &out.QueryNode + *out = new(PodResources) + (*in).DeepCopyInto(*out) + } + if in.StreamingNode != nil { + in, out := &in.StreamingNode, &out.StreamingNode + *out = new(PodResources) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MilvusVerticalScalingSpec. +func (in *MilvusVerticalScalingSpec) DeepCopy() *MilvusVerticalScalingSpec { + if in == nil { + return nil + } + out := new(MilvusVerticalScalingSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *MilvusVolumeExpansionSpec) DeepCopyInto(out *MilvusVolumeExpansionSpec) { + *out = *in + if in.Node != nil { + in, out := &in.Node, &out.Node + x := (*in).DeepCopy() + *out = &x + } + if in.StreamingNode != nil { + in, out := &in.StreamingNode, &out.StreamingNode + x := (*in).DeepCopy() + *out = &x + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MilvusVolumeExpansionSpec. +func (in *MilvusVolumeExpansionSpec) DeepCopy() *MilvusVolumeExpansionSpec { + if in == nil { + return nil + } + out := new(MilvusVolumeExpansionSpec) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MongoDBHorizontalScalingSpec) DeepCopyInto(out *MongoDBHorizontalScalingSpec) { *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 bf74e9ca8e..511761ede5 100644 --- a/client/clientset/versioned/typed/catalog/v1alpha1/catalog_client.go +++ b/client/clientset/versioned/typed/catalog/v1alpha1/catalog_client.go @@ -45,6 +45,7 @@ type CatalogV1alpha1Interface interface { MSSQLServerVersionsGetter MariaDBVersionsGetter MemcachedVersionsGetter + MilvusVersionsGetter MongoDBVersionsGetter MySQLVersionsGetter Neo4jVersionsGetter @@ -133,6 +134,10 @@ func (c *CatalogV1alpha1Client) MemcachedVersions() MemcachedVersionInterface { return newMemcachedVersions(c) } +func (c *CatalogV1alpha1Client) MilvusVersions() MilvusVersionInterface { + return newMilvusVersions(c) +} + func (c *CatalogV1alpha1Client) MongoDBVersions() MongoDBVersionInterface { return newMongoDBVersions(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 506364c908..9dc7671739 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 @@ -93,6 +93,10 @@ func (c *FakeCatalogV1alpha1) MemcachedVersions() v1alpha1.MemcachedVersionInter return &FakeMemcachedVersions{c} } +func (c *FakeCatalogV1alpha1) MilvusVersions() v1alpha1.MilvusVersionInterface { + return &FakeMilvusVersions{c} +} + func (c *FakeCatalogV1alpha1) MongoDBVersions() v1alpha1.MongoDBVersionInterface { return &FakeMongoDBVersions{c} } diff --git a/client/clientset/versioned/typed/catalog/v1alpha1/fake/fake_milvusversion.go b/client/clientset/versioned/typed/catalog/v1alpha1/fake/fake_milvusversion.go new file mode 100644 index 0000000000..1eceb7b75f --- /dev/null +++ b/client/clientset/versioned/typed/catalog/v1alpha1/fake/fake_milvusversion.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" +) + +// FakeMilvusVersions implements MilvusVersionInterface +type FakeMilvusVersions struct { + Fake *FakeCatalogV1alpha1 +} + +var milvusversionsResource = v1alpha1.SchemeGroupVersion.WithResource("milvusversions") + +var milvusversionsKind = v1alpha1.SchemeGroupVersion.WithKind("MilvusVersion") + +// Get takes name of the milvusVersion, and returns the corresponding milvusVersion object, and an error if there is any. +func (c *FakeMilvusVersions) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.MilvusVersion, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootGetAction(milvusversionsResource, name), &v1alpha1.MilvusVersion{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MilvusVersion), err +} + +// List takes label and field selectors, and returns the list of MilvusVersions that match those selectors. +func (c *FakeMilvusVersions) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.MilvusVersionList, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootListAction(milvusversionsResource, milvusversionsKind, opts), &v1alpha1.MilvusVersionList{}) + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.MilvusVersionList{ListMeta: obj.(*v1alpha1.MilvusVersionList).ListMeta} + for _, item := range obj.(*v1alpha1.MilvusVersionList).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 milvusVersions. +func (c *FakeMilvusVersions) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewRootWatchAction(milvusversionsResource, opts)) +} + +// Create takes the representation of a milvusVersion and creates it. Returns the server's representation of the milvusVersion, and an error, if there is any. +func (c *FakeMilvusVersions) Create(ctx context.Context, milvusVersion *v1alpha1.MilvusVersion, opts v1.CreateOptions) (result *v1alpha1.MilvusVersion, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootCreateAction(milvusversionsResource, milvusVersion), &v1alpha1.MilvusVersion{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MilvusVersion), err +} + +// Update takes the representation of a milvusVersion and updates it. Returns the server's representation of the milvusVersion, and an error, if there is any. +func (c *FakeMilvusVersions) Update(ctx context.Context, milvusVersion *v1alpha1.MilvusVersion, opts v1.UpdateOptions) (result *v1alpha1.MilvusVersion, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootUpdateAction(milvusversionsResource, milvusVersion), &v1alpha1.MilvusVersion{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MilvusVersion), err +} + +// Delete takes name of the milvusVersion and deletes it. Returns an error if one occurs. +func (c *FakeMilvusVersions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewRootDeleteActionWithOptions(milvusversionsResource, name, opts), &v1alpha1.MilvusVersion{}) + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeMilvusVersions) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewRootDeleteCollectionAction(milvusversionsResource, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.MilvusVersionList{}) + return err +} + +// Patch applies the patch and returns the patched milvusVersion. +func (c *FakeMilvusVersions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.MilvusVersion, err error) { + obj, err := c.Fake. + Invokes(testing.NewRootPatchSubresourceAction(milvusversionsResource, name, pt, data, subresources...), &v1alpha1.MilvusVersion{}) + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MilvusVersion), err +} diff --git a/client/clientset/versioned/typed/catalog/v1alpha1/generated_expansion.go b/client/clientset/versioned/typed/catalog/v1alpha1/generated_expansion.go index 6f87331951..d552947310 100644 --- a/client/clientset/versioned/typed/catalog/v1alpha1/generated_expansion.go +++ b/client/clientset/versioned/typed/catalog/v1alpha1/generated_expansion.go @@ -50,6 +50,8 @@ type MariaDBVersionExpansion interface{} type MemcachedVersionExpansion interface{} +type MilvusVersionExpansion interface{} + type MongoDBVersionExpansion interface{} type MySQLVersionExpansion interface{} diff --git a/client/clientset/versioned/typed/catalog/v1alpha1/milvusversion.go b/client/clientset/versioned/typed/catalog/v1alpha1/milvusversion.go new file mode 100644 index 0000000000..05323a76c4 --- /dev/null +++ b/client/clientset/versioned/typed/catalog/v1alpha1/milvusversion.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" +) + +// MilvusVersionsGetter has a method to return a MilvusVersionInterface. +// A group's client should implement this interface. +type MilvusVersionsGetter interface { + MilvusVersions() MilvusVersionInterface +} + +// MilvusVersionInterface has methods to work with MilvusVersion resources. +type MilvusVersionInterface interface { + Create(ctx context.Context, milvusVersion *v1alpha1.MilvusVersion, opts v1.CreateOptions) (*v1alpha1.MilvusVersion, error) + Update(ctx context.Context, milvusVersion *v1alpha1.MilvusVersion, opts v1.UpdateOptions) (*v1alpha1.MilvusVersion, 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.MilvusVersion, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.MilvusVersionList, 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.MilvusVersion, err error) + MilvusVersionExpansion +} + +// milvusVersions implements MilvusVersionInterface +type milvusVersions struct { + client rest.Interface +} + +// newMilvusVersions returns a MilvusVersions +func newMilvusVersions(c *CatalogV1alpha1Client) *milvusVersions { + return &milvusVersions{ + client: c.RESTClient(), + } +} + +// Get takes name of the milvusVersion, and returns the corresponding milvusVersion object, and an error if there is any. +func (c *milvusVersions) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.MilvusVersion, err error) { + result = &v1alpha1.MilvusVersion{} + err = c.client.Get(). + Resource("milvusversions"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of MilvusVersions that match those selectors. +func (c *milvusVersions) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.MilvusVersionList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.MilvusVersionList{} + err = c.client.Get(). + Resource("milvusversions"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested milvusVersions. +func (c *milvusVersions) 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("milvusversions"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a milvusVersion and creates it. Returns the server's representation of the milvusVersion, and an error, if there is any. +func (c *milvusVersions) Create(ctx context.Context, milvusVersion *v1alpha1.MilvusVersion, opts v1.CreateOptions) (result *v1alpha1.MilvusVersion, err error) { + result = &v1alpha1.MilvusVersion{} + err = c.client.Post(). + Resource("milvusversions"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(milvusVersion). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a milvusVersion and updates it. Returns the server's representation of the milvusVersion, and an error, if there is any. +func (c *milvusVersions) Update(ctx context.Context, milvusVersion *v1alpha1.MilvusVersion, opts v1.UpdateOptions) (result *v1alpha1.MilvusVersion, err error) { + result = &v1alpha1.MilvusVersion{} + err = c.client.Put(). + Resource("milvusversions"). + Name(milvusVersion.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(milvusVersion). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the milvusVersion and deletes it. Returns an error if one occurs. +func (c *milvusVersions) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Resource("milvusversions"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *milvusVersions) 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("milvusversions"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched milvusVersion. +func (c *milvusVersions) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.MilvusVersion, err error) { + result = &v1alpha1.MilvusVersion{} + err = c.client.Patch(pt). + Resource("milvusversions"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} 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 21e34f4a01..6ff9089793 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 @@ -89,6 +89,10 @@ func (c *FakeKubedbV1alpha2) Memcacheds(namespace string) v1alpha2.MemcachedInte return &FakeMemcacheds{c, namespace} } +func (c *FakeKubedbV1alpha2) Milvuses(namespace string) v1alpha2.MilvusInterface { + return &FakeMilvuses{c, namespace} +} + func (c *FakeKubedbV1alpha2) MongoDBs(namespace string) v1alpha2.MongoDBInterface { return &FakeMongoDBs{c, namespace} } diff --git a/client/clientset/versioned/typed/kubedb/v1alpha2/fake/fake_milvus.go b/client/clientset/versioned/typed/kubedb/v1alpha2/fake/fake_milvus.go new file mode 100644 index 0000000000..a4596a84e9 --- /dev/null +++ b/client/clientset/versioned/typed/kubedb/v1alpha2/fake/fake_milvus.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" +) + +// FakeMilvuses implements MilvusInterface +type FakeMilvuses struct { + Fake *FakeKubedbV1alpha2 + ns string +} + +var milvusesResource = v1alpha2.SchemeGroupVersion.WithResource("milvuses") + +var milvusesKind = v1alpha2.SchemeGroupVersion.WithKind("Milvus") + +// Get takes name of the milvus, and returns the corresponding milvus object, and an error if there is any. +func (c *FakeMilvuses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.Milvus, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(milvusesResource, c.ns, name), &v1alpha2.Milvus{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.Milvus), err +} + +// List takes label and field selectors, and returns the list of Milvuses that match those selectors. +func (c *FakeMilvuses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.MilvusList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(milvusesResource, milvusesKind, c.ns, opts), &v1alpha2.MilvusList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha2.MilvusList{ListMeta: obj.(*v1alpha2.MilvusList).ListMeta} + for _, item := range obj.(*v1alpha2.MilvusList).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 milvuses. +func (c *FakeMilvuses) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(milvusesResource, c.ns, opts)) + +} + +// Create takes the representation of a milvus and creates it. Returns the server's representation of the milvus, and an error, if there is any. +func (c *FakeMilvuses) Create(ctx context.Context, milvus *v1alpha2.Milvus, opts v1.CreateOptions) (result *v1alpha2.Milvus, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(milvusesResource, c.ns, milvus), &v1alpha2.Milvus{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.Milvus), err +} + +// Update takes the representation of a milvus and updates it. Returns the server's representation of the milvus, and an error, if there is any. +func (c *FakeMilvuses) Update(ctx context.Context, milvus *v1alpha2.Milvus, opts v1.UpdateOptions) (result *v1alpha2.Milvus, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(milvusesResource, c.ns, milvus), &v1alpha2.Milvus{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.Milvus), 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 *FakeMilvuses) UpdateStatus(ctx context.Context, milvus *v1alpha2.Milvus, opts v1.UpdateOptions) (*v1alpha2.Milvus, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(milvusesResource, "status", c.ns, milvus), &v1alpha2.Milvus{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.Milvus), err +} + +// Delete takes name of the milvus and deletes it. Returns an error if one occurs. +func (c *FakeMilvuses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(milvusesResource, c.ns, name, opts), &v1alpha2.Milvus{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeMilvuses) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(milvusesResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha2.MilvusList{}) + return err +} + +// Patch applies the patch and returns the patched milvus. +func (c *FakeMilvuses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.Milvus, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(milvusesResource, c.ns, name, pt, data, subresources...), &v1alpha2.Milvus{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha2.Milvus), err +} diff --git a/client/clientset/versioned/typed/kubedb/v1alpha2/generated_expansion.go b/client/clientset/versioned/typed/kubedb/v1alpha2/generated_expansion.go index 19d4bd7f76..88eaef503d 100644 --- a/client/clientset/versioned/typed/kubedb/v1alpha2/generated_expansion.go +++ b/client/clientset/versioned/typed/kubedb/v1alpha2/generated_expansion.go @@ -48,6 +48,8 @@ type MariaDBExpansion interface{} type MemcachedExpansion interface{} +type MilvusExpansion interface{} + type MongoDBExpansion interface{} type MySQLExpansion interface{} diff --git a/client/clientset/versioned/typed/kubedb/v1alpha2/kubedb_client.go b/client/clientset/versioned/typed/kubedb/v1alpha2/kubedb_client.go index 987fc9bcf2..b0c38b3367 100644 --- a/client/clientset/versioned/typed/kubedb/v1alpha2/kubedb_client.go +++ b/client/clientset/versioned/typed/kubedb/v1alpha2/kubedb_client.go @@ -44,6 +44,7 @@ type KubedbV1alpha2Interface interface { MSSQLServersGetter MariaDBsGetter MemcachedsGetter + MilvusesGetter MongoDBsGetter MySQLsGetter Neo4jsGetter @@ -128,6 +129,10 @@ func (c *KubedbV1alpha2Client) Memcacheds(namespace string) MemcachedInterface { return newMemcacheds(c, namespace) } +func (c *KubedbV1alpha2Client) Milvuses(namespace string) MilvusInterface { + return newMilvuses(c, namespace) +} + func (c *KubedbV1alpha2Client) MongoDBs(namespace string) MongoDBInterface { return newMongoDBs(c, namespace) } diff --git a/client/clientset/versioned/typed/kubedb/v1alpha2/milvus.go b/client/clientset/versioned/typed/kubedb/v1alpha2/milvus.go new file mode 100644 index 0000000000..be0c70b138 --- /dev/null +++ b/client/clientset/versioned/typed/kubedb/v1alpha2/milvus.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" +) + +// MilvusesGetter has a method to return a MilvusInterface. +// A group's client should implement this interface. +type MilvusesGetter interface { + Milvuses(namespace string) MilvusInterface +} + +// MilvusInterface has methods to work with Milvus resources. +type MilvusInterface interface { + Create(ctx context.Context, milvus *v1alpha2.Milvus, opts v1.CreateOptions) (*v1alpha2.Milvus, error) + Update(ctx context.Context, milvus *v1alpha2.Milvus, opts v1.UpdateOptions) (*v1alpha2.Milvus, error) + UpdateStatus(ctx context.Context, milvus *v1alpha2.Milvus, opts v1.UpdateOptions) (*v1alpha2.Milvus, 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.Milvus, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha2.MilvusList, 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.Milvus, err error) + MilvusExpansion +} + +// milvuses implements MilvusInterface +type milvuses struct { + client rest.Interface + ns string +} + +// newMilvuses returns a Milvuses +func newMilvuses(c *KubedbV1alpha2Client, namespace string) *milvuses { + return &milvuses{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the milvus, and returns the corresponding milvus object, and an error if there is any. +func (c *milvuses) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha2.Milvus, err error) { + result = &v1alpha2.Milvus{} + err = c.client.Get(). + Namespace(c.ns). + Resource("milvuses"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of Milvuses that match those selectors. +func (c *milvuses) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha2.MilvusList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha2.MilvusList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("milvuses"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested milvuses. +func (c *milvuses) 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("milvuses"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a milvus and creates it. Returns the server's representation of the milvus, and an error, if there is any. +func (c *milvuses) Create(ctx context.Context, milvus *v1alpha2.Milvus, opts v1.CreateOptions) (result *v1alpha2.Milvus, err error) { + result = &v1alpha2.Milvus{} + err = c.client.Post(). + Namespace(c.ns). + Resource("milvuses"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(milvus). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a milvus and updates it. Returns the server's representation of the milvus, and an error, if there is any. +func (c *milvuses) Update(ctx context.Context, milvus *v1alpha2.Milvus, opts v1.UpdateOptions) (result *v1alpha2.Milvus, err error) { + result = &v1alpha2.Milvus{} + err = c.client.Put(). + Namespace(c.ns). + Resource("milvuses"). + Name(milvus.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(milvus). + 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 *milvuses) UpdateStatus(ctx context.Context, milvus *v1alpha2.Milvus, opts v1.UpdateOptions) (result *v1alpha2.Milvus, err error) { + result = &v1alpha2.Milvus{} + err = c.client.Put(). + Namespace(c.ns). + Resource("milvuses"). + Name(milvus.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(milvus). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the milvus and deletes it. Returns an error if one occurs. +func (c *milvuses) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("milvuses"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *milvuses) 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("milvuses"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched milvus. +func (c *milvuses) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha2.Milvus, err error) { + result = &v1alpha2.Milvus{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("milvuses"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/client/clientset/versioned/typed/ops/v1alpha1/fake/fake_milvusopsrequest.go b/client/clientset/versioned/typed/ops/v1alpha1/fake/fake_milvusopsrequest.go new file mode 100644 index 0000000000..b24479fa26 --- /dev/null +++ b/client/clientset/versioned/typed/ops/v1alpha1/fake/fake_milvusopsrequest.go @@ -0,0 +1,142 @@ +/* +Copyright AppsCode Inc. and Contributors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + "context" + + v1alpha1 "kubedb.dev/apimachinery/apis/ops/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" +) + +// FakeMilvusOpsRequests implements MilvusOpsRequestInterface +type FakeMilvusOpsRequests struct { + Fake *FakeOpsV1alpha1 + ns string +} + +var milvusopsrequestsResource = v1alpha1.SchemeGroupVersion.WithResource("milvusopsrequests") + +var milvusopsrequestsKind = v1alpha1.SchemeGroupVersion.WithKind("MilvusOpsRequest") + +// Get takes name of the milvusOpsRequest, and returns the corresponding milvusOpsRequest object, and an error if there is any. +func (c *FakeMilvusOpsRequests) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.MilvusOpsRequest, err error) { + obj, err := c.Fake. + Invokes(testing.NewGetAction(milvusopsrequestsResource, c.ns, name), &v1alpha1.MilvusOpsRequest{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MilvusOpsRequest), err +} + +// List takes label and field selectors, and returns the list of MilvusOpsRequests that match those selectors. +func (c *FakeMilvusOpsRequests) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.MilvusOpsRequestList, err error) { + obj, err := c.Fake. + Invokes(testing.NewListAction(milvusopsrequestsResource, milvusopsrequestsKind, c.ns, opts), &v1alpha1.MilvusOpsRequestList{}) + + if obj == nil { + return nil, err + } + + label, _, _ := testing.ExtractFromListOptions(opts) + if label == nil { + label = labels.Everything() + } + list := &v1alpha1.MilvusOpsRequestList{ListMeta: obj.(*v1alpha1.MilvusOpsRequestList).ListMeta} + for _, item := range obj.(*v1alpha1.MilvusOpsRequestList).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 milvusOpsRequests. +func (c *FakeMilvusOpsRequests) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) { + return c.Fake. + InvokesWatch(testing.NewWatchAction(milvusopsrequestsResource, c.ns, opts)) + +} + +// Create takes the representation of a milvusOpsRequest and creates it. Returns the server's representation of the milvusOpsRequest, and an error, if there is any. +func (c *FakeMilvusOpsRequests) Create(ctx context.Context, milvusOpsRequest *v1alpha1.MilvusOpsRequest, opts v1.CreateOptions) (result *v1alpha1.MilvusOpsRequest, err error) { + obj, err := c.Fake. + Invokes(testing.NewCreateAction(milvusopsrequestsResource, c.ns, milvusOpsRequest), &v1alpha1.MilvusOpsRequest{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MilvusOpsRequest), err +} + +// Update takes the representation of a milvusOpsRequest and updates it. Returns the server's representation of the milvusOpsRequest, and an error, if there is any. +func (c *FakeMilvusOpsRequests) Update(ctx context.Context, milvusOpsRequest *v1alpha1.MilvusOpsRequest, opts v1.UpdateOptions) (result *v1alpha1.MilvusOpsRequest, err error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateAction(milvusopsrequestsResource, c.ns, milvusOpsRequest), &v1alpha1.MilvusOpsRequest{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MilvusOpsRequest), 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 *FakeMilvusOpsRequests) UpdateStatus(ctx context.Context, milvusOpsRequest *v1alpha1.MilvusOpsRequest, opts v1.UpdateOptions) (*v1alpha1.MilvusOpsRequest, error) { + obj, err := c.Fake. + Invokes(testing.NewUpdateSubresourceAction(milvusopsrequestsResource, "status", c.ns, milvusOpsRequest), &v1alpha1.MilvusOpsRequest{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MilvusOpsRequest), err +} + +// Delete takes name of the milvusOpsRequest and deletes it. Returns an error if one occurs. +func (c *FakeMilvusOpsRequests) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + _, err := c.Fake. + Invokes(testing.NewDeleteActionWithOptions(milvusopsrequestsResource, c.ns, name, opts), &v1alpha1.MilvusOpsRequest{}) + + return err +} + +// DeleteCollection deletes a collection of objects. +func (c *FakeMilvusOpsRequests) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error { + action := testing.NewDeleteCollectionAction(milvusopsrequestsResource, c.ns, listOpts) + + _, err := c.Fake.Invokes(action, &v1alpha1.MilvusOpsRequestList{}) + return err +} + +// Patch applies the patch and returns the patched milvusOpsRequest. +func (c *FakeMilvusOpsRequests) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.MilvusOpsRequest, err error) { + obj, err := c.Fake. + Invokes(testing.NewPatchSubresourceAction(milvusopsrequestsResource, c.ns, name, pt, data, subresources...), &v1alpha1.MilvusOpsRequest{}) + + if obj == nil { + return nil, err + } + return obj.(*v1alpha1.MilvusOpsRequest), err +} diff --git a/client/clientset/versioned/typed/ops/v1alpha1/fake/fake_ops_client.go b/client/clientset/versioned/typed/ops/v1alpha1/fake/fake_ops_client.go index 08db0593f0..6dc6d35643 100644 --- a/client/clientset/versioned/typed/ops/v1alpha1/fake/fake_ops_client.go +++ b/client/clientset/versioned/typed/ops/v1alpha1/fake/fake_ops_client.go @@ -77,6 +77,10 @@ func (c *FakeOpsV1alpha1) MemcachedOpsRequests(namespace string) v1alpha1.Memcac return &FakeMemcachedOpsRequests{c, namespace} } +func (c *FakeOpsV1alpha1) MilvusOpsRequests(namespace string) v1alpha1.MilvusOpsRequestInterface { + return &FakeMilvusOpsRequests{c, namespace} +} + func (c *FakeOpsV1alpha1) MongoDBOpsRequests(namespace string) v1alpha1.MongoDBOpsRequestInterface { return &FakeMongoDBOpsRequests{c, namespace} } diff --git a/client/clientset/versioned/typed/ops/v1alpha1/generated_expansion.go b/client/clientset/versioned/typed/ops/v1alpha1/generated_expansion.go index f8f7b446ab..4c156b6ed6 100644 --- a/client/clientset/versioned/typed/ops/v1alpha1/generated_expansion.go +++ b/client/clientset/versioned/typed/ops/v1alpha1/generated_expansion.go @@ -42,6 +42,8 @@ type MariaDBOpsRequestExpansion interface{} type MemcachedOpsRequestExpansion interface{} +type MilvusOpsRequestExpansion interface{} + type MongoDBOpsRequestExpansion interface{} type MySQLOpsRequestExpansion interface{} diff --git a/client/clientset/versioned/typed/ops/v1alpha1/milvusopsrequest.go b/client/clientset/versioned/typed/ops/v1alpha1/milvusopsrequest.go new file mode 100644 index 0000000000..68098a30f6 --- /dev/null +++ b/client/clientset/versioned/typed/ops/v1alpha1/milvusopsrequest.go @@ -0,0 +1,196 @@ +/* +Copyright AppsCode Inc. and Contributors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + "time" + + v1alpha1 "kubedb.dev/apimachinery/apis/ops/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" +) + +// MilvusOpsRequestsGetter has a method to return a MilvusOpsRequestInterface. +// A group's client should implement this interface. +type MilvusOpsRequestsGetter interface { + MilvusOpsRequests(namespace string) MilvusOpsRequestInterface +} + +// MilvusOpsRequestInterface has methods to work with MilvusOpsRequest resources. +type MilvusOpsRequestInterface interface { + Create(ctx context.Context, milvusOpsRequest *v1alpha1.MilvusOpsRequest, opts v1.CreateOptions) (*v1alpha1.MilvusOpsRequest, error) + Update(ctx context.Context, milvusOpsRequest *v1alpha1.MilvusOpsRequest, opts v1.UpdateOptions) (*v1alpha1.MilvusOpsRequest, error) + UpdateStatus(ctx context.Context, milvusOpsRequest *v1alpha1.MilvusOpsRequest, opts v1.UpdateOptions) (*v1alpha1.MilvusOpsRequest, 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.MilvusOpsRequest, error) + List(ctx context.Context, opts v1.ListOptions) (*v1alpha1.MilvusOpsRequestList, 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.MilvusOpsRequest, err error) + MilvusOpsRequestExpansion +} + +// milvusOpsRequests implements MilvusOpsRequestInterface +type milvusOpsRequests struct { + client rest.Interface + ns string +} + +// newMilvusOpsRequests returns a MilvusOpsRequests +func newMilvusOpsRequests(c *OpsV1alpha1Client, namespace string) *milvusOpsRequests { + return &milvusOpsRequests{ + client: c.RESTClient(), + ns: namespace, + } +} + +// Get takes name of the milvusOpsRequest, and returns the corresponding milvusOpsRequest object, and an error if there is any. +func (c *milvusOpsRequests) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1alpha1.MilvusOpsRequest, err error) { + result = &v1alpha1.MilvusOpsRequest{} + err = c.client.Get(). + Namespace(c.ns). + Resource("milvusopsrequests"). + Name(name). + VersionedParams(&options, scheme.ParameterCodec). + Do(ctx). + Into(result) + return +} + +// List takes label and field selectors, and returns the list of MilvusOpsRequests that match those selectors. +func (c *milvusOpsRequests) List(ctx context.Context, opts v1.ListOptions) (result *v1alpha1.MilvusOpsRequestList, err error) { + var timeout time.Duration + if opts.TimeoutSeconds != nil { + timeout = time.Duration(*opts.TimeoutSeconds) * time.Second + } + result = &v1alpha1.MilvusOpsRequestList{} + err = c.client.Get(). + Namespace(c.ns). + Resource("milvusopsrequests"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Do(ctx). + Into(result) + return +} + +// Watch returns a watch.Interface that watches the requested milvusOpsRequests. +func (c *milvusOpsRequests) 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("milvusopsrequests"). + VersionedParams(&opts, scheme.ParameterCodec). + Timeout(timeout). + Watch(ctx) +} + +// Create takes the representation of a milvusOpsRequest and creates it. Returns the server's representation of the milvusOpsRequest, and an error, if there is any. +func (c *milvusOpsRequests) Create(ctx context.Context, milvusOpsRequest *v1alpha1.MilvusOpsRequest, opts v1.CreateOptions) (result *v1alpha1.MilvusOpsRequest, err error) { + result = &v1alpha1.MilvusOpsRequest{} + err = c.client.Post(). + Namespace(c.ns). + Resource("milvusopsrequests"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(milvusOpsRequest). + Do(ctx). + Into(result) + return +} + +// Update takes the representation of a milvusOpsRequest and updates it. Returns the server's representation of the milvusOpsRequest, and an error, if there is any. +func (c *milvusOpsRequests) Update(ctx context.Context, milvusOpsRequest *v1alpha1.MilvusOpsRequest, opts v1.UpdateOptions) (result *v1alpha1.MilvusOpsRequest, err error) { + result = &v1alpha1.MilvusOpsRequest{} + err = c.client.Put(). + Namespace(c.ns). + Resource("milvusopsrequests"). + Name(milvusOpsRequest.Name). + VersionedParams(&opts, scheme.ParameterCodec). + Body(milvusOpsRequest). + 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 *milvusOpsRequests) UpdateStatus(ctx context.Context, milvusOpsRequest *v1alpha1.MilvusOpsRequest, opts v1.UpdateOptions) (result *v1alpha1.MilvusOpsRequest, err error) { + result = &v1alpha1.MilvusOpsRequest{} + err = c.client.Put(). + Namespace(c.ns). + Resource("milvusopsrequests"). + Name(milvusOpsRequest.Name). + SubResource("status"). + VersionedParams(&opts, scheme.ParameterCodec). + Body(milvusOpsRequest). + Do(ctx). + Into(result) + return +} + +// Delete takes name of the milvusOpsRequest and deletes it. Returns an error if one occurs. +func (c *milvusOpsRequests) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error { + return c.client.Delete(). + Namespace(c.ns). + Resource("milvusopsrequests"). + Name(name). + Body(&opts). + Do(ctx). + Error() +} + +// DeleteCollection deletes a collection of objects. +func (c *milvusOpsRequests) 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("milvusopsrequests"). + VersionedParams(&listOpts, scheme.ParameterCodec). + Timeout(timeout). + Body(&opts). + Do(ctx). + Error() +} + +// Patch applies the patch and returns the patched milvusOpsRequest. +func (c *milvusOpsRequests) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1alpha1.MilvusOpsRequest, err error) { + result = &v1alpha1.MilvusOpsRequest{} + err = c.client.Patch(pt). + Namespace(c.ns). + Resource("milvusopsrequests"). + Name(name). + SubResource(subresources...). + VersionedParams(&opts, scheme.ParameterCodec). + Body(data). + Do(ctx). + Into(result) + return +} diff --git a/client/clientset/versioned/typed/ops/v1alpha1/ops_client.go b/client/clientset/versioned/typed/ops/v1alpha1/ops_client.go index 66dc77a606..d1828faecb 100644 --- a/client/clientset/versioned/typed/ops/v1alpha1/ops_client.go +++ b/client/clientset/versioned/typed/ops/v1alpha1/ops_client.go @@ -41,6 +41,7 @@ type OpsV1alpha1Interface interface { MSSQLServerOpsRequestsGetter MariaDBOpsRequestsGetter MemcachedOpsRequestsGetter + MilvusOpsRequestsGetter MongoDBOpsRequestsGetter MySQLOpsRequestsGetter Neo4jOpsRequestsGetter @@ -111,6 +112,10 @@ func (c *OpsV1alpha1Client) MemcachedOpsRequests(namespace string) MemcachedOpsR return newMemcachedOpsRequests(c, namespace) } +func (c *OpsV1alpha1Client) MilvusOpsRequests(namespace string) MilvusOpsRequestInterface { + return newMilvusOpsRequests(c, namespace) +} + func (c *OpsV1alpha1Client) MongoDBOpsRequests(namespace string) MongoDBOpsRequestInterface { return newMongoDBOpsRequests(c, namespace) } diff --git a/client/informers/externalversions/catalog/v1alpha1/interface.go b/client/informers/externalversions/catalog/v1alpha1/interface.go index 76a6dfdc4e..224665e44f 100644 --- a/client/informers/externalversions/catalog/v1alpha1/interface.go +++ b/client/informers/externalversions/catalog/v1alpha1/interface.go @@ -56,6 +56,8 @@ type Interface interface { MariaDBVersions() MariaDBVersionInformer // MemcachedVersions returns a MemcachedVersionInformer. MemcachedVersions() MemcachedVersionInformer + // MilvusVersions returns a MilvusVersionInformer. + MilvusVersions() MilvusVersionInformer // MongoDBVersions returns a MongoDBVersionInformer. MongoDBVersions() MongoDBVersionInformer // MySQLVersions returns a MySQLVersionInformer. @@ -183,6 +185,11 @@ func (v *version) MemcachedVersions() MemcachedVersionInformer { return &memcachedVersionInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } +// MilvusVersions returns a MilvusVersionInformer. +func (v *version) MilvusVersions() MilvusVersionInformer { + return &milvusVersionInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + // MongoDBVersions returns a MongoDBVersionInformer. func (v *version) MongoDBVersions() MongoDBVersionInformer { return &mongoDBVersionInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} diff --git a/client/informers/externalversions/catalog/v1alpha1/milvusversion.go b/client/informers/externalversions/catalog/v1alpha1/milvusversion.go new file mode 100644 index 0000000000..3d5765e760 --- /dev/null +++ b/client/informers/externalversions/catalog/v1alpha1/milvusversion.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" +) + +// MilvusVersionInformer provides access to a shared informer and lister for +// MilvusVersions. +type MilvusVersionInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.MilvusVersionLister +} + +type milvusVersionInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewMilvusVersionInformer constructs a new informer for MilvusVersion 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 NewMilvusVersionInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredMilvusVersionInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredMilvusVersionInformer constructs a new informer for MilvusVersion 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 NewFilteredMilvusVersionInformer(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().MilvusVersions().List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.CatalogV1alpha1().MilvusVersions().Watch(context.TODO(), options) + }, + }, + &catalogv1alpha1.MilvusVersion{}, + resyncPeriod, + indexers, + ) +} + +func (f *milvusVersionInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredMilvusVersionInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *milvusVersionInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&catalogv1alpha1.MilvusVersion{}, f.defaultInformer) +} + +func (f *milvusVersionInformer) Lister() v1alpha1.MilvusVersionLister { + return v1alpha1.NewMilvusVersionLister(f.Informer().GetIndexer()) +} diff --git a/client/informers/externalversions/generic.go b/client/informers/externalversions/generic.go index 0c6821a349..5ea686aaa4 100644 --- a/client/informers/externalversions/generic.go +++ b/client/informers/externalversions/generic.go @@ -162,6 +162,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericInformer{resource: resource.GroupResource(), informer: f.Catalog().V1alpha1().MariaDBVersions().Informer()}, nil case catalogv1alpha1.SchemeGroupVersion.WithResource("memcachedversions"): return &genericInformer{resource: resource.GroupResource(), informer: f.Catalog().V1alpha1().MemcachedVersions().Informer()}, nil + case catalogv1alpha1.SchemeGroupVersion.WithResource("milvusversions"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Catalog().V1alpha1().MilvusVersions().Informer()}, nil case catalogv1alpha1.SchemeGroupVersion.WithResource("mongodbversions"): return &genericInformer{resource: resource.GroupResource(), informer: f.Catalog().V1alpha1().MongoDBVersions().Informer()}, nil case catalogv1alpha1.SchemeGroupVersion.WithResource("mysqlversions"): @@ -310,6 +312,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericInformer{resource: resource.GroupResource(), informer: f.Kubedb().V1alpha2().MariaDBs().Informer()}, nil case v1alpha2.SchemeGroupVersion.WithResource("memcacheds"): return &genericInformer{resource: resource.GroupResource(), informer: f.Kubedb().V1alpha2().Memcacheds().Informer()}, nil + case v1alpha2.SchemeGroupVersion.WithResource("milvuses"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Kubedb().V1alpha2().Milvuses().Informer()}, nil case v1alpha2.SchemeGroupVersion.WithResource("mongodbs"): return &genericInformer{resource: resource.GroupResource(), informer: f.Kubedb().V1alpha2().MongoDBs().Informer()}, nil case v1alpha2.SchemeGroupVersion.WithResource("mysqls"): @@ -374,6 +378,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericInformer{resource: resource.GroupResource(), informer: f.Ops().V1alpha1().MariaDBOpsRequests().Informer()}, nil case opsv1alpha1.SchemeGroupVersion.WithResource("memcachedopsrequests"): return &genericInformer{resource: resource.GroupResource(), informer: f.Ops().V1alpha1().MemcachedOpsRequests().Informer()}, nil + case opsv1alpha1.SchemeGroupVersion.WithResource("milvusopsrequests"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Ops().V1alpha1().MilvusOpsRequests().Informer()}, nil case opsv1alpha1.SchemeGroupVersion.WithResource("mongodbopsrequests"): return &genericInformer{resource: resource.GroupResource(), informer: f.Ops().V1alpha1().MongoDBOpsRequests().Informer()}, nil case opsv1alpha1.SchemeGroupVersion.WithResource("mysqlopsrequests"): diff --git a/client/informers/externalversions/kubedb/v1alpha2/interface.go b/client/informers/externalversions/kubedb/v1alpha2/interface.go index e9a57668ca..50d7a0a672 100644 --- a/client/informers/externalversions/kubedb/v1alpha2/interface.go +++ b/client/informers/externalversions/kubedb/v1alpha2/interface.go @@ -54,6 +54,8 @@ type Interface interface { MariaDBs() MariaDBInformer // Memcacheds returns a MemcachedInformer. Memcacheds() MemcachedInformer + // Milvuses returns a MilvusInformer. + Milvuses() MilvusInformer // MongoDBs returns a MongoDBInformer. MongoDBs() MongoDBInformer // MySQLs returns a MySQLInformer. @@ -176,6 +178,11 @@ func (v *version) Memcacheds() MemcachedInformer { return &memcachedInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } +// Milvuses returns a MilvusInformer. +func (v *version) Milvuses() MilvusInformer { + return &milvusInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + // MongoDBs returns a MongoDBInformer. func (v *version) MongoDBs() MongoDBInformer { return &mongoDBInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/client/informers/externalversions/kubedb/v1alpha2/milvus.go b/client/informers/externalversions/kubedb/v1alpha2/milvus.go new file mode 100644 index 0000000000..88907dfac4 --- /dev/null +++ b/client/informers/externalversions/kubedb/v1alpha2/milvus.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" +) + +// MilvusInformer provides access to a shared informer and lister for +// Milvuses. +type MilvusInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha2.MilvusLister +} + +type milvusInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewMilvusInformer constructs a new informer for Milvus 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 NewMilvusInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredMilvusInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredMilvusInformer constructs a new informer for Milvus 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 NewFilteredMilvusInformer(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().Milvuses(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.KubedbV1alpha2().Milvuses(namespace).Watch(context.TODO(), options) + }, + }, + &kubedbv1alpha2.Milvus{}, + resyncPeriod, + indexers, + ) +} + +func (f *milvusInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredMilvusInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *milvusInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&kubedbv1alpha2.Milvus{}, f.defaultInformer) +} + +func (f *milvusInformer) Lister() v1alpha2.MilvusLister { + return v1alpha2.NewMilvusLister(f.Informer().GetIndexer()) +} diff --git a/client/informers/externalversions/ops/v1alpha1/interface.go b/client/informers/externalversions/ops/v1alpha1/interface.go index a7ae889889..8cccaa77a4 100644 --- a/client/informers/externalversions/ops/v1alpha1/interface.go +++ b/client/informers/externalversions/ops/v1alpha1/interface.go @@ -48,6 +48,8 @@ type Interface interface { MariaDBOpsRequests() MariaDBOpsRequestInformer // MemcachedOpsRequests returns a MemcachedOpsRequestInformer. MemcachedOpsRequests() MemcachedOpsRequestInformer + // MilvusOpsRequests returns a MilvusOpsRequestInformer. + MilvusOpsRequests() MilvusOpsRequestInformer // MongoDBOpsRequests returns a MongoDBOpsRequestInformer. MongoDBOpsRequests() MongoDBOpsRequestInformer // MySQLOpsRequests returns a MySQLOpsRequestInformer. @@ -151,6 +153,11 @@ func (v *version) MemcachedOpsRequests() MemcachedOpsRequestInformer { return &memcachedOpsRequestInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} } +// MilvusOpsRequests returns a MilvusOpsRequestInformer. +func (v *version) MilvusOpsRequests() MilvusOpsRequestInformer { + return &milvusOpsRequestInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} +} + // MongoDBOpsRequests returns a MongoDBOpsRequestInformer. func (v *version) MongoDBOpsRequests() MongoDBOpsRequestInformer { return &mongoDBOpsRequestInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions} diff --git a/client/informers/externalversions/ops/v1alpha1/milvusopsrequest.go b/client/informers/externalversions/ops/v1alpha1/milvusopsrequest.go new file mode 100644 index 0000000000..ca857e769d --- /dev/null +++ b/client/informers/externalversions/ops/v1alpha1/milvusopsrequest.go @@ -0,0 +1,91 @@ +/* +Copyright AppsCode Inc. and Contributors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + "context" + time "time" + + opsv1alpha1 "kubedb.dev/apimachinery/apis/ops/v1alpha1" + versioned "kubedb.dev/apimachinery/client/clientset/versioned" + internalinterfaces "kubedb.dev/apimachinery/client/informers/externalversions/internalinterfaces" + v1alpha1 "kubedb.dev/apimachinery/client/listers/ops/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" +) + +// MilvusOpsRequestInformer provides access to a shared informer and lister for +// MilvusOpsRequests. +type MilvusOpsRequestInformer interface { + Informer() cache.SharedIndexInformer + Lister() v1alpha1.MilvusOpsRequestLister +} + +type milvusOpsRequestInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc + namespace string +} + +// NewMilvusOpsRequestInformer constructs a new informer for MilvusOpsRequest 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 NewMilvusOpsRequestInformer(client versioned.Interface, namespace string, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredMilvusOpsRequestInformer(client, namespace, resyncPeriod, indexers, nil) +} + +// NewFilteredMilvusOpsRequestInformer constructs a new informer for MilvusOpsRequest 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 NewFilteredMilvusOpsRequestInformer(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.OpsV1alpha1().MilvusOpsRequests(namespace).List(context.TODO(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OpsV1alpha1().MilvusOpsRequests(namespace).Watch(context.TODO(), options) + }, + }, + &opsv1alpha1.MilvusOpsRequest{}, + resyncPeriod, + indexers, + ) +} + +func (f *milvusOpsRequestInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredMilvusOpsRequestInformer(client, f.namespace, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *milvusOpsRequestInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&opsv1alpha1.MilvusOpsRequest{}, f.defaultInformer) +} + +func (f *milvusOpsRequestInformer) Lister() v1alpha1.MilvusOpsRequestLister { + return v1alpha1.NewMilvusOpsRequestLister(f.Informer().GetIndexer()) +} diff --git a/client/listers/catalog/v1alpha1/expansion_generated.go b/client/listers/catalog/v1alpha1/expansion_generated.go index 8597b4e3f2..6e9a857b8f 100644 --- a/client/listers/catalog/v1alpha1/expansion_generated.go +++ b/client/listers/catalog/v1alpha1/expansion_generated.go @@ -82,6 +82,10 @@ type MariaDBVersionListerExpansion interface{} // MemcachedVersionLister. type MemcachedVersionListerExpansion interface{} +// MilvusVersionListerExpansion allows custom methods to be added to +// MilvusVersionLister. +type MilvusVersionListerExpansion interface{} + // MongoDBVersionListerExpansion allows custom methods to be added to // MongoDBVersionLister. type MongoDBVersionListerExpansion interface{} diff --git a/client/listers/catalog/v1alpha1/milvusversion.go b/client/listers/catalog/v1alpha1/milvusversion.go new file mode 100644 index 0000000000..40dbe99039 --- /dev/null +++ b/client/listers/catalog/v1alpha1/milvusversion.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" +) + +// MilvusVersionLister helps list MilvusVersions. +// All objects returned here must be treated as read-only. +type MilvusVersionLister interface { + // List lists all MilvusVersions in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.MilvusVersion, err error) + // Get retrieves the MilvusVersion from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.MilvusVersion, error) + MilvusVersionListerExpansion +} + +// milvusVersionLister implements the MilvusVersionLister interface. +type milvusVersionLister struct { + indexer cache.Indexer +} + +// NewMilvusVersionLister returns a new MilvusVersionLister. +func NewMilvusVersionLister(indexer cache.Indexer) MilvusVersionLister { + return &milvusVersionLister{indexer: indexer} +} + +// List lists all MilvusVersions in the indexer. +func (s *milvusVersionLister) List(selector labels.Selector) (ret []*v1alpha1.MilvusVersion, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.MilvusVersion)) + }) + return ret, err +} + +// Get retrieves the MilvusVersion from the index for a given name. +func (s *milvusVersionLister) Get(name string) (*v1alpha1.MilvusVersion, error) { + obj, exists, err := s.indexer.GetByKey(name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("milvusversion"), name) + } + return obj.(*v1alpha1.MilvusVersion), nil +} diff --git a/client/listers/kubedb/v1alpha2/expansion_generated.go b/client/listers/kubedb/v1alpha2/expansion_generated.go index 6c9ce1373c..cb2cfdf095 100644 --- a/client/listers/kubedb/v1alpha2/expansion_generated.go +++ b/client/listers/kubedb/v1alpha2/expansion_generated.go @@ -138,6 +138,14 @@ type MemcachedListerExpansion interface{} // MemcachedNamespaceLister. type MemcachedNamespaceListerExpansion interface{} +// MilvusListerExpansion allows custom methods to be added to +// MilvusLister. +type MilvusListerExpansion interface{} + +// MilvusNamespaceListerExpansion allows custom methods to be added to +// MilvusNamespaceLister. +type MilvusNamespaceListerExpansion interface{} + // MongoDBListerExpansion allows custom methods to be added to // MongoDBLister. type MongoDBListerExpansion interface{} diff --git a/client/listers/kubedb/v1alpha2/milvus.go b/client/listers/kubedb/v1alpha2/milvus.go new file mode 100644 index 0000000000..682d38cc67 --- /dev/null +++ b/client/listers/kubedb/v1alpha2/milvus.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" +) + +// MilvusLister helps list Milvuses. +// All objects returned here must be treated as read-only. +type MilvusLister interface { + // List lists all Milvuses in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha2.Milvus, err error) + // Milvuses returns an object that can list and get Milvuses. + Milvuses(namespace string) MilvusNamespaceLister + MilvusListerExpansion +} + +// milvusLister implements the MilvusLister interface. +type milvusLister struct { + indexer cache.Indexer +} + +// NewMilvusLister returns a new MilvusLister. +func NewMilvusLister(indexer cache.Indexer) MilvusLister { + return &milvusLister{indexer: indexer} +} + +// List lists all Milvuses in the indexer. +func (s *milvusLister) List(selector labels.Selector) (ret []*v1alpha2.Milvus, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha2.Milvus)) + }) + return ret, err +} + +// Milvuses returns an object that can list and get Milvuses. +func (s *milvusLister) Milvuses(namespace string) MilvusNamespaceLister { + return milvusNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// MilvusNamespaceLister helps list and get Milvuses. +// All objects returned here must be treated as read-only. +type MilvusNamespaceLister interface { + // List lists all Milvuses in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha2.Milvus, err error) + // Get retrieves the Milvus from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha2.Milvus, error) + MilvusNamespaceListerExpansion +} + +// milvusNamespaceLister implements the MilvusNamespaceLister +// interface. +type milvusNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all Milvuses in the indexer for a given namespace. +func (s milvusNamespaceLister) List(selector labels.Selector) (ret []*v1alpha2.Milvus, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha2.Milvus)) + }) + return ret, err +} + +// Get retrieves the Milvus from the indexer for a given namespace and name. +func (s milvusNamespaceLister) Get(name string) (*v1alpha2.Milvus, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha2.Resource("milvus"), name) + } + return obj.(*v1alpha2.Milvus), nil +} diff --git a/client/listers/ops/v1alpha1/expansion_generated.go b/client/listers/ops/v1alpha1/expansion_generated.go index d06c2f308b..76d8cfba43 100644 --- a/client/listers/ops/v1alpha1/expansion_generated.go +++ b/client/listers/ops/v1alpha1/expansion_generated.go @@ -114,6 +114,14 @@ type MemcachedOpsRequestListerExpansion interface{} // MemcachedOpsRequestNamespaceLister. type MemcachedOpsRequestNamespaceListerExpansion interface{} +// MilvusOpsRequestListerExpansion allows custom methods to be added to +// MilvusOpsRequestLister. +type MilvusOpsRequestListerExpansion interface{} + +// MilvusOpsRequestNamespaceListerExpansion allows custom methods to be added to +// MilvusOpsRequestNamespaceLister. +type MilvusOpsRequestNamespaceListerExpansion interface{} + // MongoDBOpsRequestListerExpansion allows custom methods to be added to // MongoDBOpsRequestLister. type MongoDBOpsRequestListerExpansion interface{} diff --git a/client/listers/ops/v1alpha1/milvusopsrequest.go b/client/listers/ops/v1alpha1/milvusopsrequest.go new file mode 100644 index 0000000000..fca09e85b9 --- /dev/null +++ b/client/listers/ops/v1alpha1/milvusopsrequest.go @@ -0,0 +1,100 @@ +/* +Copyright AppsCode Inc. and Contributors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + v1alpha1 "kubedb.dev/apimachinery/apis/ops/v1alpha1" + + "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/client-go/tools/cache" +) + +// MilvusOpsRequestLister helps list MilvusOpsRequests. +// All objects returned here must be treated as read-only. +type MilvusOpsRequestLister interface { + // List lists all MilvusOpsRequests in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.MilvusOpsRequest, err error) + // MilvusOpsRequests returns an object that can list and get MilvusOpsRequests. + MilvusOpsRequests(namespace string) MilvusOpsRequestNamespaceLister + MilvusOpsRequestListerExpansion +} + +// milvusOpsRequestLister implements the MilvusOpsRequestLister interface. +type milvusOpsRequestLister struct { + indexer cache.Indexer +} + +// NewMilvusOpsRequestLister returns a new MilvusOpsRequestLister. +func NewMilvusOpsRequestLister(indexer cache.Indexer) MilvusOpsRequestLister { + return &milvusOpsRequestLister{indexer: indexer} +} + +// List lists all MilvusOpsRequests in the indexer. +func (s *milvusOpsRequestLister) List(selector labels.Selector) (ret []*v1alpha1.MilvusOpsRequest, err error) { + err = cache.ListAll(s.indexer, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.MilvusOpsRequest)) + }) + return ret, err +} + +// MilvusOpsRequests returns an object that can list and get MilvusOpsRequests. +func (s *milvusOpsRequestLister) MilvusOpsRequests(namespace string) MilvusOpsRequestNamespaceLister { + return milvusOpsRequestNamespaceLister{indexer: s.indexer, namespace: namespace} +} + +// MilvusOpsRequestNamespaceLister helps list and get MilvusOpsRequests. +// All objects returned here must be treated as read-only. +type MilvusOpsRequestNamespaceLister interface { + // List lists all MilvusOpsRequests in the indexer for a given namespace. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*v1alpha1.MilvusOpsRequest, err error) + // Get retrieves the MilvusOpsRequest from the indexer for a given namespace and name. + // Objects returned here must be treated as read-only. + Get(name string) (*v1alpha1.MilvusOpsRequest, error) + MilvusOpsRequestNamespaceListerExpansion +} + +// milvusOpsRequestNamespaceLister implements the MilvusOpsRequestNamespaceLister +// interface. +type milvusOpsRequestNamespaceLister struct { + indexer cache.Indexer + namespace string +} + +// List lists all MilvusOpsRequests in the indexer for a given namespace. +func (s milvusOpsRequestNamespaceLister) List(selector labels.Selector) (ret []*v1alpha1.MilvusOpsRequest, err error) { + err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) { + ret = append(ret, m.(*v1alpha1.MilvusOpsRequest)) + }) + return ret, err +} + +// Get retrieves the MilvusOpsRequest from the indexer for a given namespace and name. +func (s milvusOpsRequestNamespaceLister) Get(name string) (*v1alpha1.MilvusOpsRequest, error) { + obj, exists, err := s.indexer.GetByKey(s.namespace + "/" + name) + if err != nil { + return nil, err + } + if !exists { + return nil, errors.NewNotFound(v1alpha1.Resource("milvusopsrequest"), name) + } + return obj.(*v1alpha1.MilvusOpsRequest), nil +} diff --git a/crds/kubedb.com_milvuses.yaml b/crds/kubedb.com_milvuses.yaml index 29df368ecd..49cb240279 100644 --- a/crds/kubedb.com_milvuses.yaml +++ b/crds/kubedb.com_milvuses.yaml @@ -3952,6 +3952,125 @@ spec: - Durable - Ephemeral 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 + external: + properties: + mode: + enum: + - Disabled + - TLS + - mTLS + type: string + type: object + internal: + properties: + mode: + enum: + - Disabled + - TLS + - mTLS + type: string + type: object + issuerRef: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + type: object topology: properties: distributed: diff --git a/crds/ops.kubedb.com_milvusopsrequests.yaml b/crds/ops.kubedb.com_milvusopsrequests.yaml new file mode 100644 index 0000000000..0dc0d68b1b --- /dev/null +++ b/crds/ops.kubedb.com_milvusopsrequests.yaml @@ -0,0 +1,648 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + creationTimestamp: null + labels: + app.kubernetes.io/name: kubedb + name: milvusopsrequests.ops.kubedb.com +spec: + group: ops.kubedb.com + names: + categories: + - ops + - kubedb + - appscode + kind: MilvusOpsRequest + listKind: MilvusOpsRequestList + plural: milvusopsrequests + shortNames: + - mvops + singular: milvusopsrequest + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .spec.type + name: Type + type: string + - jsonPath: .status.phase + name: Status + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + properties: + apiVersion: + type: string + kind: + type: string + metadata: + type: object + spec: + properties: + apply: + default: IfReady + enum: + - IfReady + - Always + type: string + authentication: + properties: + secretRef: + properties: + apiGroup: + default: "" + type: string + kind: + default: Secret + type: string + name: + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + type: object + configuration: + properties: + applyConfig: + additionalProperties: + type: string + type: object + configSecret: + properties: + name: + default: "" + type: string + type: object + x-kubernetes-map-type: atomic + removeCustomConfig: + type: boolean + restart: + default: auto + enum: + - auto + - "true" + - "false" + type: string + type: object + databaseRef: + properties: + name: + default: "" + type: string + type: object + x-kubernetes-map-type: atomic + horizontalScaling: + properties: + topology: + properties: + dataNode: + format: int32 + type: integer + mixcoord: + format: int32 + type: integer + node: + format: int32 + type: integer + proxy: + format: int32 + type: integer + querynode: + format: int32 + type: integer + streamingnode: + format: int32 + type: integer + type: object + type: object + maxRetries: + default: 1 + format: int32 + type: integer + restart: + type: object + timeout: + 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 + external: + properties: + mode: + enum: + - Disabled + - TLS + - mTLS + type: string + type: object + internal: + properties: + mode: + enum: + - Disabled + - TLS + - mTLS + type: string + type: object + issuerRef: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + required: + - kind + - name + type: object + x-kubernetes-map-type: atomic + remove: + type: boolean + rotateCertificates: + type: boolean + type: object + type: + enum: + - UpdateVersion + - HorizontalScaling + - VerticalScaling + - VolumeExpansion + - Restart + - Reconfigure + - ReconfigureTLS + - RotateAuth + type: string + updateVersion: + properties: + targetVersion: + type: string + type: object + verticalScaling: + properties: + datanode: + properties: + nodeSelectionPolicy: + type: string + resources: + properties: + claims: + items: + properties: + name: + type: string + request: + 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 + topology: + properties: + key: + type: string + value: + type: string + required: + - key + - value + type: object + type: object + mixcoord: + properties: + nodeSelectionPolicy: + type: string + resources: + properties: + claims: + items: + properties: + name: + type: string + request: + 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 + topology: + properties: + key: + type: string + value: + type: string + required: + - key + - value + type: object + type: object + node: + properties: + nodeSelectionPolicy: + type: string + resources: + properties: + claims: + items: + properties: + name: + type: string + request: + 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 + topology: + properties: + key: + type: string + value: + type: string + required: + - key + - value + type: object + type: object + proxy: + properties: + nodeSelectionPolicy: + type: string + resources: + properties: + claims: + items: + properties: + name: + type: string + request: + 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 + topology: + properties: + key: + type: string + value: + type: string + required: + - key + - value + type: object + type: object + querynode: + properties: + nodeSelectionPolicy: + type: string + resources: + properties: + claims: + items: + properties: + name: + type: string + request: + 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 + topology: + properties: + key: + type: string + value: + type: string + required: + - key + - value + type: object + type: object + streamingnode: + properties: + nodeSelectionPolicy: + type: string + resources: + properties: + claims: + items: + properties: + name: + type: string + request: + 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 + topology: + properties: + key: + type: string + value: + type: string + required: + - key + - value + type: object + type: object + type: object + volumeExpansion: + properties: + mode: + enum: + - Offline + - Online + type: string + node: + 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 + streamingnode: + 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 + required: + - mode + type: object + required: + - databaseRef + - type + 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 + pausedBackups: + items: + properties: + apiGroup: + type: string + kind: + type: string + name: + type: string + namespace: + type: string + required: + - name + type: object + type: array + phase: + enum: + - Pending + - Progressing + - Successful + - WaitingForApproval + - Failed + - Approved + - Denied + - Skipped + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/pkg/webhooks/kubedb/v1alpha2/milvus.go b/pkg/webhooks/kubedb/v1alpha2/milvus.go index a413cc3314..c1d7ce7d9e 100644 --- a/pkg/webhooks/kubedb/v1alpha2/milvus.go +++ b/pkg/webhooks/kubedb/v1alpha2/milvus.go @@ -178,6 +178,21 @@ func (m *MilvusCustomWebhook) ValidateCreateOrUpdate(db *olddbapi.Milvus) field. } } + if db.Spec.TLS != nil { + if db.Spec.TLS.IssuerRef == nil { + allErr = append(allErr, field.Invalid( + field.NewPath("spec").Child("tls").Child("issuerRef"), + db.Name, + "spec.tls.issuerRef is required when TLS is configured", + )) + } + + if db.Spec.TLS.Internal != nil && db.Spec.TLS.Internal.Mode == olddbapi.TLSModeMTLS { + allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("tls").Child("internal").Child("mode"), + db.Name, "spec.tls.internal.mTLS is not allowed")) + } + } + if len(allErr) == 0 { return nil }