Skip to content

Commit

Permalink
The database name must always be fixed, this changes should make it c…
Browse files Browse the repository at this point in the history
…onsistent
  • Loading branch information
jlarriba committed Mar 8, 2024
1 parent 03a0dde commit 58fbe55
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
12 changes: 3 additions & 9 deletions controllers/aodh_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,25 +151,19 @@ func (r *AutoscalingReconciler) reconcileInitAodh(
// create service DB instance
//
db := mariadbv1.NewDatabaseWithNamespace(
// instance.Name
// TODO: We might want to change the db name.
// The mariadb-operator is currently implemented
// in a way, that the db name needs to be the
// same as the user
instance.Spec.Aodh.DatabaseUser,
autoscaling.DatabaseName,
instance.Spec.Aodh.DatabaseUser,
instance.Spec.Aodh.Secret,
map[string]string{
"dbName": instance.Spec.Aodh.DatabaseInstance,
"dbName": autoscaling.DatabaseName,
},
autoscaling.ServiceName,
instance.Namespace,
)
// create or patch the DB
ctrlResult, err = db.CreateOrPatchDBByName(
ctrlResult, err = db.CreateOrPatchAll(
ctx,
helper,
instance.Spec.Aodh.DatabaseInstance,
)
if err != nil {
instance.Status.Conditions.Set(condition.FalseCondition(
Expand Down
2 changes: 1 addition & 1 deletion controllers/autoscaling_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ func (r *AutoscalingReconciler) generateServiceConfig(
cmLabels := labels.GetLabels(instance, labels.GetGroupLabel(autoscaling.ServiceName), map[string]string{})

// the aodh controller currently creates the db with the user
db, err := mariadbv1.GetDatabaseByName(ctx, h, instance.Spec.Aodh.DatabaseUser)
db, err := mariadbv1.GetDatabaseByName(ctx, h, autoscaling.DatabaseName)
if err != nil {
return err
}
Expand Down

0 comments on commit 58fbe55

Please sign in to comment.