Skip to content

Commit

Permalink
add dsn and port to generated secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
adamcooke committed Mar 6, 2023
1 parent 1cfca7e commit b0e62ed
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/controller/mysql_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ func (r *MySQLDatabaseReconciler) Reconcile(ctx context.Context, req ctrl.Reques
return ctrl.Result{}, row.Err()
}
log.Info("deleted database", "database", databaseNameWithNamespace)

log.Info("removing finalizer")
controllerutil.RemoveFinalizer(&database, finalizerName)
if err := r.Update(ctx, &database); err != nil {
Expand Down Expand Up @@ -183,6 +182,8 @@ func (r *MySQLDatabaseReconciler) Reconcile(ctx context.Context, req ctrl.Reques
connectionDetailsSecret.StringData["username"] = databaseNameWithNamespace
connectionDetailsSecret.StringData["password"] = databasePassword
connectionDetailsSecret.StringData["host"] = server.Spec.Host
connectionDetailsSecret.StringData["port"] = fmt.Sprintf("%d", server.Spec.Port)
connectionDetailsSecret.StringData["dsn"] = fmt.Sprintf("%s:%s@%s:%d/%s", databaseNameWithNamespace, databasePassword, server.Spec.Host, server.Spec.Port, databaseNameWithNamespace)

if newSecret {
err = r.Create(ctx, &connectionDetailsSecret)
Expand Down

0 comments on commit b0e62ed

Please sign in to comment.