From 0f868a269f441c65988c535ad5db4ded55a3c7ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Kesser?= Date: Fri, 7 Jun 2024 14:16:31 +0200 Subject: [PATCH] fix: add engine version for dbinstance update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: André Kesser --- pkg/clients/rds/common.go | 1 + pkg/controller/rds/dbinstance/setup.go | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/pkg/clients/rds/common.go b/pkg/clients/rds/common.go index 052b90cc7c..c45dc65313 100644 --- a/pkg/clients/rds/common.go +++ b/pkg/clients/rds/common.go @@ -46,6 +46,7 @@ const ( ErrNoPasswordUpToDate = "cannot determine password up to date status" ErrGetCachedPassword = "cannot get cached password" ErrRetrievePasswordForUpdate = "cannot retrieve password for update" + ErrDescribe = "cannot describe dbinstance" ) const ( diff --git a/pkg/controller/rds/dbinstance/setup.go b/pkg/controller/rds/dbinstance/setup.go index b4909fa57a..f8cc82a768 100644 --- a/pkg/controller/rds/dbinstance/setup.go +++ b/pkg/controller/rds/dbinstance/setup.go @@ -269,6 +269,16 @@ func (e *custom) preUpdate(ctx context.Context, cr *svcapitypes.DBInstance, obj obj.StorageThroughput = nil } + input := GenerateDescribeDBInstancesInput(cr) + + out, err := e.client.DescribeDBInstancesWithContext(ctx, input) + if err != nil { + return errors.Wrap(err, dbinstance.ErrDescribe) + } + if !isEngineVersionUpToDate(cr, out) && cr.Spec.ForProvider.EngineVersion != nil { + obj.EngineVersion = cr.Spec.ForProvider.EngineVersion // add EngineVersion if changed and no downgrade + } + return nil }