From 0f10cfa981a2f9dcc3f9b05234f0a4353904bec2 Mon Sep 17 00:00:00 2001 From: Samuel Chen Date: Mon, 6 Feb 2023 17:17:23 +0800 Subject: [PATCH] fix: postgresql not deleted with harborcluster MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit add ownerReference to expectCR in PostgreSQLController.Update before comparing. Origin expectCR have no OwnerReference . Signed-off-by: 陈伟 --- pkg/cluster/controllers/database/update.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/cluster/controllers/database/update.go b/pkg/cluster/controllers/database/update.go index 8a5ac428b..63e89252b 100644 --- a/pkg/cluster/controllers/database/update.go +++ b/pkg/cluster/controllers/database/update.go @@ -35,7 +35,9 @@ func (p *PostgreSQLController) Update(ctx context.Context, harborcluster *goharb FromUnstructured(expectUnstructuredCR.UnstructuredContent(), &expectCR); err != nil { return databaseNotReadyStatus(DefaultUnstructuredConverterError, err.Error()), err } - + + expectCR.SetOwnerReferences(actualCR.GetOwnerReferences()) + if !common.Equals(ctx, p.Scheme, harborcluster, &actualCR) { p.Log.Info( "Update Database resource",