Skip to content

Commit

Permalink
Resolve reviewed changes
Browse files Browse the repository at this point in the history
Signed-off-by: Tapajit Chandra Paul <[email protected]>
  • Loading branch information
tapojit047 committed Jun 28, 2024
1 parent 0ae50af commit 6636900
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions apis/kubedb/v1alpha2/druid_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,9 @@ func (d *Druid) SetDefaults() {
if d.Spec.MetadataStorage == nil {
d.Spec.MetadataStorage = &MetadataStorage{}
}
if d.Spec.MetadataStorage.Namespace == "" {
d.Spec.MetadataStorage.Namespace = d.Namespace
}
if d.Spec.MetadataStorage.LinkedDB == "" {
d.Spec.MetadataStorage.LinkedDB = "druid"
}
Expand All @@ -535,15 +538,9 @@ func (d *Druid) SetDefaults() {
if d.Spec.MetadataStorage.ObjectReference == nil {
d.Spec.MetadataStorage.ObjectReference = &kmapi.ObjectReference{}
}
if d.Spec.MetadataStorage.Type == DruidMetadataStorageMySQL {
d.Spec.MetadataStorage.Name = d.GetMySQLName()
} else {
d.Spec.MetadataStorage.Name = d.GetPostgresName()
}
if d.Spec.MetadataStorage.Namespace == "" {
d.Spec.MetadataStorage.Namespace = d.Namespace
}
d.Spec.MetadataStorage.Name = d.GetMetadataStorageName()
}

if d.Spec.MetadataStorage.Version == nil {
var defaultVersion string
if d.Spec.MetadataStorage.Type == DruidMetadataStorageMySQL {
Expand Down Expand Up @@ -696,14 +693,13 @@ func (d *Druid) GetAppBinding(name string, namespace string) (*appcat.AppBinding
return appbinding, nil
}

func (d *Druid) GetMySQLName() string {
func (d *Druid) GetMetadataStorageName() string {
if d.Spec.MetadataStorage.Type == DruidMetadataStoragePostgreSQL {
return d.OffShootName() + "-pg-metadata"
}
return d.OffShootName() + "-mysql-metadata"
}

func (d *Druid) GetPostgresName() string {
return d.OffShootName() + "-pg-metadata"
}

func (d *Druid) GetZooKeeperName() string {
return d.OffShootName() + "-zk"
}
Expand Down

0 comments on commit 6636900

Please sign in to comment.