From 01bf17350f30d7aa174eaea48c7fa84b129f068b Mon Sep 17 00:00:00 2001 From: leandrorichardtoledo <169929015+leandrorichardtoledo@users.noreply.github.com> Date: Tue, 3 Dec 2024 10:10:55 -0300 Subject: [PATCH] PTEUDO-1989 - Fix migration trigger check. (#369) --- pkg/databaseclaim/databaseclaim.go | 2 +- pkg/hostparams/hostparams.go | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/pkg/databaseclaim/databaseclaim.go b/pkg/databaseclaim/databaseclaim.go index ead2665e..6013735e 100644 --- a/pkg/databaseclaim/databaseclaim.go +++ b/pkg/databaseclaim/databaseclaim.go @@ -461,7 +461,7 @@ func (r *DatabaseClaimReconciler) reconcileUseExistingDB(ctx context.Context, re err = r.manageUserAndExtensions(ctx, reqInfo, logr, dbClient, &dbClaim.Status.NewDB, dbName, dbClaim.Spec.Username, operationalMode) if err != nil { - logr.Error(err, "unable to update users, user credents not persisted to status object") + logr.Error(err, "unable to update users, user credentials not persisted to status object") return err } if err = r.updateClientStatus(ctx, dbClaim); err != nil { diff --git a/pkg/hostparams/hostparams.go b/pkg/hostparams/hostparams.go index 2d028596..6a3ef42e 100644 --- a/pkg/hostparams/hostparams.go +++ b/pkg/hostparams/hostparams.go @@ -144,11 +144,10 @@ func New(config *viper.Viper, dbClaim *v1.DatabaseClaim) (*HostParams, error) { } if hostParams.DBVersion == "" { - if dbClaim.Status.ActiveDB.DBVersion != "" { - //for an existing (Status.ActiveDB NOT empty) it picks up the Status DBVersion, so no update is triggered. + if dbClaim.Spec.UseExistingSource != nil && *dbClaim.Spec.UseExistingSource { hostParams.DBVersion = dbClaim.Status.ActiveDB.DBVersion - } else { - //for a new Claim (Status.ActiveDB empty) it assumes 15 only + } + if hostParams.DBVersion == "" { hostParams.IsDefaultVersion = true hostParams.DBVersion = defaultMajorVersion }