Skip to content

Commit 5a2b306

Browse files
authored
fix GMC crashes in e2e (#395)
* 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]>
1 parent 0f5cef1 commit 5a2b306

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

microservices-connector/internal/controller/gmconnector_controller.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -474,6 +474,9 @@ func (r *GMConnectorReconciler) deleteRecordedResource(key string, ctx context.C
474474
}
475475

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

885894
return ctrl.NewControllerManagedBy(mgr).

0 commit comments

Comments
 (0)