Skip to content

Commit 6449b4a

Browse files
committed
Requeue instead of throwing an error when onwer of kind can't be found
1 parent aa3252d commit 6449b4a

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

controllers/utils/base_reconciler.go

+3
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,9 @@ func (r *ReconcilerBase) InitFromMgr(mgr ctrl.Manager, client cloud.Client) {
464464
func (r *ReconciliationRunner) GetParent(child client.Object, parent client.Object) CloudStackReconcilerMethod {
465465
return func() (ctrl.Result, error) {
466466
err := GetOwnerOfKind(r.RequestCtx, r.K8sClient, child, parent)
467+
if err != nil && strings.Contains(err.Error(), "couldn't find owner of kind") {
468+
return r.RequeueWithMessage(err.Error())
469+
}
467470
return ctrl.Result{}, err
468471
}
469472
}

test/e2e/common.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ func CheckAffinityGroupInProject(client *cloudstack.CloudStackClient, clusterNam
361361

362362
for _, affinity := range vm.Affinitygroup {
363363
affinityIds = append(affinityIds, affinity.Id)
364-
affinity, _, _ := client.AffinityGroup.GetAffinityGroupByID(affinity.Id, cloudstack.WithProject(project))
364+
affinity, _, err := client.AffinityGroup.GetAffinityGroupByID(affinity.Id, cloudstack.WithProject(project))
365365
if err != nil {
366366
Fail("Failed to get affinity group for " + affinity.Id + " : " + err.Error())
367367
}

0 commit comments

Comments
 (0)