Skip to content

Commit

Permalink
fix GMC crashes in e2e (#395)
Browse files Browse the repository at this point in the history
* add debug message

Signed-off-by: KfreeZ <[email protected]>

* ignore create/delete func

Signed-off-by: KfreeZ <[email protected]>

* add protection

Signed-off-by: KfreeZ <[email protected]>

---------

Signed-off-by: KfreeZ <[email protected]>
  • Loading branch information
KfreeZ authored Sep 4, 2024
1 parent 0f5cef1 commit 5a2b306
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,9 @@ func (r *GMConnectorReconciler) deleteRecordedResource(key string, ctx context.C
}

func (r *GMConnectorReconciler) collectResourceStatus(graph *mcv1alpha3.GMConnector, ctx context.Context) error {
if graph == nil || len(graph.Status.Annotations) == 0 {
return errors.New("graph is empty or no annotations")
}
var totalCnt uint = 0
var readyCnt uint = 0
for resName := range graph.Status.Annotations {
Expand Down Expand Up @@ -880,6 +883,12 @@ func (r *GMConnectorReconciler) SetupWithManager(mgr ctrl.Manager) error {
// Predicate to only trigger on status changes for Deployment
deploymentFilter := predicate.Funcs{
UpdateFunc: isDeploymentStatusChanged,
//ignore create and delete events, otherwise it will trigger the nested reconcile which is meaningless
CreateFunc: func(e event.CreateEvent) bool {
return false
}, DeleteFunc: func(e event.DeleteEvent) bool {
return false
},
}

return ctrl.NewControllerManagedBy(mgr).
Expand Down

0 comments on commit 5a2b306

Please sign in to comment.