File tree Expand file tree Collapse file tree 1 file changed +6
-10
lines changed
Expand file tree Collapse file tree 1 file changed +6
-10
lines changed Original file line number Diff line number Diff line change @@ -59,20 +59,16 @@ func Delete(request Request) {
5959 log .Error (err )
6060 }
6161 // delete the pgreplica CRD
62- if err := request .Clientset .
63- CrunchydataV1 ().Pgreplicas (request .Namespace ).
62+ if err := request .Clientset .CrunchydataV1 ().Pgreplicas (request .Namespace ).
6463 Delete (ctx , request .ReplicaName , metav1.DeleteOptions {}); err != nil {
65- // If the name of the replica being deleted matches the scope for the cluster, then
66- // we assume it was the original primary and the pgreplica deletion will fail with
67- // a not found error. In this case we allow the rmdata process to continue despite
68- // the error. This allows for the original primary to be scaled down once it is
69- // is no longer a primary, and has become a replica.
70- if ! (request .ReplicaName == request .ClusterPGHAScope && kerror .IsNotFound (err )) {
64+ // if the pgreplica is not found, assume we're scaling down the original primary and
65+ // continue with removing the replica
66+ if ! kerror .IsNotFound (err ) {
7167 log .Error (err )
7268 return
69+ } else {
70+ log .Debug ("pgreplica not found, assuming scale down of original primary" )
7371 }
74- log .Debug ("replica name matches PGHA scope, assuming scale down of original primary" +
75- "and therefore ignoring error attempting to delete nonexistent pgreplica" )
7672 }
7773
7874 err = removeReplica (request )
You can’t perform that action at this time.
0 commit comments