Skip to content

Commit

Permalink
restore order to deployment predicate
Browse files Browse the repository at this point in the history
Signed-off-by: Karol Szwaj <karol.szwaj@gmail.com>
  • Loading branch information
cnvergence committed Oct 18, 2023
1 parent 08cd2d3 commit b0ec017
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions internal/provider/kubernetes/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -1295,16 +1295,16 @@ func (r *gatewayAPIReconciler) watchResources(ctx context.Context, mgr manager.M
if err := c.Watch(
source.Kind(mgr.GetCache(), &gwapiv1b1.GatewayClass{}),
handler.EnqueueRequestsFromMapFunc(r.enqueueClass),
predicate.NewPredicateFuncs(r.hasMatchingController),
predicate.GenerationChangedPredicate{},
predicate.NewPredicateFuncs(r.hasMatchingController),
); err != nil {
return err
}

// Only enqueue EnvoyProxy objects that match this Envoy Gateway's GatewayClass.
epPredicates := []predicate.Predicate{
predicate.ResourceVersionChangedPredicate{},
predicate.GenerationChangedPredicate{},
predicate.ResourceVersionChangedPredicate{},
predicate.NewPredicateFuncs(r.hasManagedClass),
}
if len(r.namespaceLabels) != 0 {
Expand All @@ -1320,8 +1320,8 @@ func (r *gatewayAPIReconciler) watchResources(ctx context.Context, mgr manager.M

// Watch Gateway CRUDs and reconcile affected GatewayClass.
gPredicates := []predicate.Predicate{
predicate.NewPredicateFuncs(r.validateGatewayForReconcile),
predicate.GenerationChangedPredicate{},
predicate.NewPredicateFuncs(r.validateGatewayForReconcile),
}
if len(r.namespaceLabels) != 0 {
gPredicates = append(gPredicates, predicate.NewPredicateFuncs(r.hasMatchingNamespaceLabels))
Expand Down Expand Up @@ -1419,8 +1419,8 @@ func (r *gatewayAPIReconciler) watchResources(ctx context.Context, mgr manager.M

// Watch Service CRUDs and process affected *Route objects.
servicePredicates := []predicate.Predicate{
predicate.NewPredicateFuncs(r.validateServiceForReconcile),
predicate.GenerationChangedPredicate{},
predicate.NewPredicateFuncs(r.validateServiceForReconcile),
}
if len(r.namespaceLabels) != 0 {
servicePredicates = append(servicePredicates, predicate.NewPredicateFuncs(r.hasMatchingNamespaceLabels))
Expand All @@ -1443,6 +1443,7 @@ func (r *gatewayAPIReconciler) watchResources(ctx context.Context, mgr manager.M
if err := c.Watch(
source.Kind(mgr.GetCache(), &mcsapi.ServiceImport{}),
handler.EnqueueRequestsFromMapFunc(r.enqueueClass),
predicate.GenerationChangedPredicate{},
predicate.NewPredicateFuncs(r.validateServiceImportForReconcile)); err != nil {
// ServiceImport is not available in the cluster, skip the watch and not throw error.
r.log.Info("unable to watch ServiceImport: %s", err.Error())
Expand All @@ -1465,8 +1466,8 @@ func (r *gatewayAPIReconciler) watchResources(ctx context.Context, mgr manager.M
// Watch Node CRUDs to update Gateway Address exposed by Service of type NodePort.
// Node creation/deletion and ExternalIP updates would require update in the Gateway
nPredicates := []predicate.Predicate{
predicate.NewPredicateFuncs(r.handleNode),
predicate.GenerationChangedPredicate{},
predicate.NewPredicateFuncs(r.handleNode),
}
if len(r.namespaceLabels) != 0 {
nPredicates = append(nPredicates, predicate.NewPredicateFuncs(r.hasMatchingNamespaceLabels))
Expand All @@ -1482,8 +1483,8 @@ func (r *gatewayAPIReconciler) watchResources(ctx context.Context, mgr manager.M

// Watch Secret CRUDs and process affected Gateways.
secretPredicates := []predicate.Predicate{
predicate.NewPredicateFuncs(r.validateSecretForReconcile),
predicate.GenerationChangedPredicate{},
predicate.NewPredicateFuncs(r.validateSecretForReconcile),
}
if len(r.namespaceLabels) != 0 {
secretPredicates = append(secretPredicates, predicate.NewPredicateFuncs(r.hasMatchingNamespaceLabels))
Expand Down Expand Up @@ -1530,8 +1531,8 @@ func (r *gatewayAPIReconciler) watchResources(ctx context.Context, mgr manager.M

// Watch AuthenticationFilter CRUDs and enqueue associated HTTPRoute objects.
afPredicates := []predicate.Predicate{
predicate.NewPredicateFuncs(r.httpRoutesForAuthenticationFilter),
predicate.GenerationChangedPredicate{},
predicate.NewPredicateFuncs(r.httpRoutesForAuthenticationFilter),
}
if len(r.namespaceLabels) != 0 {
afPredicates = append(afPredicates, predicate.NewPredicateFuncs(r.hasMatchingNamespaceLabels))
Expand Down

0 comments on commit b0ec017

Please sign in to comment.