diff --git a/apis/kubedb/v1alpha2/druid_helpers.go b/apis/kubedb/v1alpha2/druid_helpers.go index db03e2582c..e3a6e30784 100644 --- a/apis/kubedb/v1alpha2/druid_helpers.go +++ b/apis/kubedb/v1alpha2/druid_helpers.go @@ -803,3 +803,26 @@ func (d *Druid) CertSecretVolumeName(alias DruidCertificateAlias) string { func (d *Druid) CertSecretVolumeMountPath(configDir string, cert string) string { return filepath.Join(configDir, cert) } + +type DruidBind struct { + *Druid +} + +var _ DBBindInterface = &DruidBind{} + +func (d *DruidBind) ServiceNames() (string, string) { + return d.ServiceName(), d.ServiceName() +} + +func (d *DruidBind) Ports() (int, int) { + p := int(d.DruidNodeContainerPort(DruidNodeRoleRouters)) + return p, p +} + +func (d *DruidBind) SecretName() string { + return d.GetAuthSecretName() +} + +func (d *DruidBind) CertSecretName() string { + return d.GetCertSecretName(DruidClientCert) +} diff --git a/apis/kubedb/v1alpha2/openapi_generated.go b/apis/kubedb/v1alpha2/openapi_generated.go index 3ee0308431..a2ca7b52c8 100644 --- a/apis/kubedb/v1alpha2/openapi_generated.go +++ b/apis/kubedb/v1alpha2/openapi_generated.go @@ -524,6 +524,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.DeepStorageSpec": schema_apimachinery_apis_kubedb_v1alpha2_DeepStorageSpec(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.Druid": schema_apimachinery_apis_kubedb_v1alpha2_Druid(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.DruidApp": schema_apimachinery_apis_kubedb_v1alpha2_DruidApp(ref), + "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.DruidBind": schema_apimachinery_apis_kubedb_v1alpha2_DruidBind(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.DruidClusterTopology": schema_apimachinery_apis_kubedb_v1alpha2_DruidClusterTopology(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.DruidDataNode": schema_apimachinery_apis_kubedb_v1alpha2_DruidDataNode(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.DruidList": schema_apimachinery_apis_kubedb_v1alpha2_DruidList(ref), @@ -629,6 +630,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.ProxySQLSpec": schema_apimachinery_apis_kubedb_v1alpha2_ProxySQLSpec(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.ProxySQLStatus": schema_apimachinery_apis_kubedb_v1alpha2_ProxySQLStatus(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.RabbitMQ": schema_apimachinery_apis_kubedb_v1alpha2_RabbitMQ(ref), + "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.RabbitMQBind": schema_apimachinery_apis_kubedb_v1alpha2_RabbitMQBind(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.RabbitMQList": schema_apimachinery_apis_kubedb_v1alpha2_RabbitMQList(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.RabbitMQSpec": schema_apimachinery_apis_kubedb_v1alpha2_RabbitMQSpec(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.RabbitMQStatus": schema_apimachinery_apis_kubedb_v1alpha2_RabbitMQStatus(ref), @@ -651,6 +653,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.SecretReference": schema_apimachinery_apis_kubedb_v1alpha2_SecretReference(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.SemiSyncSpec": schema_apimachinery_apis_kubedb_v1alpha2_SemiSyncSpec(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.Singlestore": schema_apimachinery_apis_kubedb_v1alpha2_Singlestore(ref), + "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.SinglestoreBind": schema_apimachinery_apis_kubedb_v1alpha2_SinglestoreBind(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.SinglestoreList": schema_apimachinery_apis_kubedb_v1alpha2_SinglestoreList(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.SinglestoreNode": schema_apimachinery_apis_kubedb_v1alpha2_SinglestoreNode(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.SinglestoreSpec": schema_apimachinery_apis_kubedb_v1alpha2_SinglestoreSpec(ref), @@ -658,6 +661,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.SinglestoreTopology": schema_apimachinery_apis_kubedb_v1alpha2_SinglestoreTopology(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.Solr": schema_apimachinery_apis_kubedb_v1alpha2_Solr(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.SolrApp": schema_apimachinery_apis_kubedb_v1alpha2_SolrApp(ref), + "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.SolrBind": schema_apimachinery_apis_kubedb_v1alpha2_SolrBind(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.SolrClusterTopology": schema_apimachinery_apis_kubedb_v1alpha2_SolrClusterTopology(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.SolrList": schema_apimachinery_apis_kubedb_v1alpha2_SolrList(ref), "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.SolrNode": schema_apimachinery_apis_kubedb_v1alpha2_SolrNode(ref), @@ -26862,6 +26866,26 @@ func schema_apimachinery_apis_kubedb_v1alpha2_DruidApp(ref common.ReferenceCallb } } +func schema_apimachinery_apis_kubedb_v1alpha2_DruidBind(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "Druid": { + SchemaProps: spec.SchemaProps{ + Ref: ref("kubedb.dev/apimachinery/apis/kubedb/v1alpha2.Druid"), + }, + }, + }, + Required: []string{"Druid"}, + }, + }, + Dependencies: []string{ + "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.Druid"}, + } +} + func schema_apimachinery_apis_kubedb_v1alpha2_DruidClusterTopology(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -33101,6 +33125,26 @@ func schema_apimachinery_apis_kubedb_v1alpha2_RabbitMQ(ref common.ReferenceCallb } } +func schema_apimachinery_apis_kubedb_v1alpha2_RabbitMQBind(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "RabbitMQ": { + SchemaProps: spec.SchemaProps{ + Ref: ref("kubedb.dev/apimachinery/apis/kubedb/v1alpha2.RabbitMQ"), + }, + }, + }, + Required: []string{"RabbitMQ"}, + }, + }, + Dependencies: []string{ + "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.RabbitMQ"}, + } +} + func schema_apimachinery_apis_kubedb_v1alpha2_RabbitMQList(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -34410,6 +34454,26 @@ func schema_apimachinery_apis_kubedb_v1alpha2_Singlestore(ref common.ReferenceCa } } +func schema_apimachinery_apis_kubedb_v1alpha2_SinglestoreBind(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "Singlestore": { + SchemaProps: spec.SchemaProps{ + Ref: ref("kubedb.dev/apimachinery/apis/kubedb/v1alpha2.Singlestore"), + }, + }, + }, + Required: []string{"Singlestore"}, + }, + }, + Dependencies: []string{ + "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.Singlestore"}, + } +} + func schema_apimachinery_apis_kubedb_v1alpha2_SinglestoreList(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -34758,6 +34822,26 @@ func schema_apimachinery_apis_kubedb_v1alpha2_SolrApp(ref common.ReferenceCallba } } +func schema_apimachinery_apis_kubedb_v1alpha2_SolrBind(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "Solr": { + SchemaProps: spec.SchemaProps{ + Ref: ref("kubedb.dev/apimachinery/apis/kubedb/v1alpha2.Solr"), + }, + }, + }, + Required: []string{"Solr"}, + }, + }, + Dependencies: []string{ + "kubedb.dev/apimachinery/apis/kubedb/v1alpha2.Solr"}, + } +} + func schema_apimachinery_apis_kubedb_v1alpha2_SolrClusterTopology(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ diff --git a/apis/kubedb/v1alpha2/rabbitmq_helpers.go b/apis/kubedb/v1alpha2/rabbitmq_helpers.go index ae3ae78086..d61cb0e58d 100644 --- a/apis/kubedb/v1alpha2/rabbitmq_helpers.go +++ b/apis/kubedb/v1alpha2/rabbitmq_helpers.go @@ -422,3 +422,31 @@ func (r *RabbitMQ) ReplicasAreReady(lister pslister.PetSetLister) (bool, string, expectedItems := 1 return checkReplicasOfPetSet(lister.PetSets(r.Namespace), labels.SelectorFromSet(r.OffshootLabels()), expectedItems) } + +type RabbitMQBind struct { + *RabbitMQ +} + +var _ DBBindInterface = &RabbitMQBind{} + +func (d *RabbitMQBind) ServiceNames() (string, string) { + return d.ServiceName(), d.DashboardServiceName() +} + +func (d *RabbitMQBind) Ports() (int, int) { + dbPort := kubedb.RabbitMQAMQPPort + uiPort := kubedb.RabbitMQManagementUIPort + if d.Spec.TLS != nil { + dbPort = kubedb.RabbitMQAMQPSPort + uiPort = kubedb.RabbitMQManagementUIPortWithSSL + } + return dbPort, uiPort +} + +func (d *RabbitMQBind) SecretName() string { + return d.GetAuthSecretName() +} + +func (d *RabbitMQBind) CertSecretName() string { + return d.GetCertSecretName(RabbitmqClientCert) +} diff --git a/apis/kubedb/v1alpha2/singlestore_helpers.go b/apis/kubedb/v1alpha2/singlestore_helpers.go index 617317a658..1702ca52a3 100644 --- a/apis/kubedb/v1alpha2/singlestore_helpers.go +++ b/apis/kubedb/v1alpha2/singlestore_helpers.go @@ -519,3 +519,25 @@ func (s *Singlestore) ReplicasAreReady(lister pslister.PetSetLister) (bool, stri } return checkReplicasOfPetSet(lister.PetSets(s.Namespace), labels.SelectorFromSet(s.OffshootLabels()), expectedItems) } + +type SinglestoreBind struct { + *Singlestore +} + +var _ DBBindInterface = &SinglestoreBind{} + +func (d *SinglestoreBind) ServiceNames() (string, string) { + return d.ServiceName(), d.ServiceName() +} + +func (d *SinglestoreBind) Ports() (int, int) { + return kubedb.SinglestoreDatabasePort, kubedb.SinglestoreStudioPort +} + +func (d *SinglestoreBind) SecretName() string { + return d.DefaultUserCredSecretName("root") +} + +func (d *SinglestoreBind) CertSecretName() string { + return d.GetCertSecretName(SinglestoreClientCert) +} diff --git a/apis/kubedb/v1alpha2/solr_helpers.go b/apis/kubedb/v1alpha2/solr_helpers.go index 265e7fb481..c37ccd3b5a 100644 --- a/apis/kubedb/v1alpha2/solr_helpers.go +++ b/apis/kubedb/v1alpha2/solr_helpers.go @@ -518,3 +518,25 @@ func (s *Solr) CertSecretVolumeName(alias SolrCertificateAlias) string { func (s *Solr) CertSecretVolumeMountPath(configDir string, cert string) string { return filepath.Join(configDir, cert) } + +type SolrBind struct { + *Solr +} + +var _ DBBindInterface = &SolrBind{} + +func (d *SolrBind) ServiceNames() (string, string) { + return d.ServiceName(), d.ServiceName() +} + +func (d *SolrBind) Ports() (int, int) { + return kubedb.SolrRestPort, kubedb.SolrRestPort +} + +func (d *SolrBind) SecretName() string { + return d.GetAuthSecretName() +} + +func (d *SolrBind) CertSecretName() string { + return d.GetCertSecretName(SolrClientCert) +} diff --git a/apis/kubedb/v1alpha2/types.go b/apis/kubedb/v1alpha2/types.go index 3a8aab79e1..049bd950c3 100644 --- a/apis/kubedb/v1alpha2/types.go +++ b/apis/kubedb/v1alpha2/types.go @@ -255,3 +255,10 @@ type ArchiverRecovery struct { FullDBRepository *kmapi.ObjectReference `json:"fullDBRepository,omitempty"` ReplicationStrategy *PITRReplicationStrategy `json:"replicationStrategy,omitempty"` } + +type DBBindInterface interface { + ServiceNames() (string, string) // (DBServiceName, UIServiceName) + Ports() (int, int) // (DBPort, UIPort) + SecretName() string + CertSecretName() string +} diff --git a/apis/kubedb/v1alpha2/zz_generated.deepcopy.go b/apis/kubedb/v1alpha2/zz_generated.deepcopy.go index 392318a88d..b8e82155b0 100644 --- a/apis/kubedb/v1alpha2/zz_generated.deepcopy.go +++ b/apis/kubedb/v1alpha2/zz_generated.deepcopy.go @@ -884,6 +884,27 @@ func (in *DruidApp) DeepCopy() *DruidApp { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DruidBind) DeepCopyInto(out *DruidBind) { + *out = *in + if in.Druid != nil { + in, out := &in.Druid, &out.Druid + *out = new(Druid) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DruidBind. +func (in *DruidBind) DeepCopy() *DruidBind { + if in == nil { + return nil + } + out := new(DruidBind) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DruidClusterTopology) DeepCopyInto(out *DruidClusterTopology) { *out = *in @@ -4547,6 +4568,27 @@ func (in *RabbitMQ) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *RabbitMQBind) DeepCopyInto(out *RabbitMQBind) { + *out = *in + if in.RabbitMQ != nil { + in, out := &in.RabbitMQ, &out.RabbitMQ + *out = new(RabbitMQ) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new RabbitMQBind. +func (in *RabbitMQBind) DeepCopy() *RabbitMQBind { + if in == nil { + return nil + } + out := new(RabbitMQBind) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *RabbitMQList) DeepCopyInto(out *RabbitMQList) { *out = *in @@ -5220,6 +5262,27 @@ func (in *Singlestore) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SinglestoreBind) DeepCopyInto(out *SinglestoreBind) { + *out = *in + if in.Singlestore != nil { + in, out := &in.Singlestore, &out.Singlestore + *out = new(Singlestore) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SinglestoreBind. +func (in *SinglestoreBind) DeepCopy() *SinglestoreBind { + if in == nil { + return nil + } + out := new(SinglestoreBind) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SinglestoreList) DeepCopyInto(out *SinglestoreList) { *out = *in @@ -5456,6 +5519,27 @@ func (in *SolrApp) DeepCopy() *SolrApp { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SolrBind) DeepCopyInto(out *SolrBind) { + *out = *in + if in.Solr != nil { + in, out := &in.Solr, &out.Solr + *out = new(Solr) + (*in).DeepCopyInto(*out) + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SolrBind. +func (in *SolrBind) DeepCopy() *SolrBind { + if in == nil { + return nil + } + out := new(SolrBind) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SolrClusterTopology) DeepCopyInto(out *SolrClusterTopology) { *out = *in