From 3d6d7b74d2ca1c6a0dc814ecf5d7a6a147a4369a Mon Sep 17 00:00:00 2001 From: Anh Le Date: Fri, 4 Oct 2024 22:32:05 +0000 Subject: [PATCH] Fix redis cluster delete error due to not honoring AllowPartial flag --- .../direct/redis/cluster/rediscluster_controller.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/controller/direct/redis/cluster/rediscluster_controller.go b/pkg/controller/direct/redis/cluster/rediscluster_controller.go index 9686fe42a8..6aae8291dd 100644 --- a/pkg/controller/direct/redis/cluster/rediscluster_controller.go +++ b/pkg/controller/direct/redis/cluster/rediscluster_controller.go @@ -18,6 +18,7 @@ import ( "context" "fmt" "reflect" + "strings" api "cloud.google.com/go/redis/cluster/apiv1" pb "cloud.google.com/go/redis/cluster/apiv1/clusterpb" @@ -187,11 +188,15 @@ func (a *redisClusterAdapter) Delete(ctx context.Context, deleteOp *directbase.D if direct.IsNotFound(err) { return false, nil } - return false, fmt.Errorf("deleting redisCluster %s: %w", a.fullyQualifiedName(), err) + if !strings.Contains(err.Error(), "missing \"value\" field") { + return false, fmt.Errorf("deleting redisCluster %s: %w", a.fullyQualifiedName(), err) + } } if err := op.Wait(ctx); err != nil { - return false, fmt.Errorf("waiting for redisCluster delete %s: %w", a.fullyQualifiedName(), err) + if !strings.Contains(err.Error(), "missing \"value\" field") { + return false, fmt.Errorf("waiting for redisCluster delete %s: %w", a.fullyQualifiedName(), err) + } } return true, nil