Skip to content

Commit

Permalink
fix(GatewayAPI): only enqueue Gateway reconciliations from routes if …
Browse files Browse the repository at this point in the history
…parent is a Gateway (#10316)

For example, in GAMMA, the parentRef can also be a Service.

Signed-off-by: 罗泽轩 <spacewanderlzx@gmail.com>
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
Co-authored-by: Mike Beaumont <mjboamail@gmail.com>
  • Loading branch information
spacewander and michaelbeaumont authored May 28, 2024
1 parent 9fe1039 commit e90fc3d
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ func gatewaysForRoute(l logr.Logger) kube_handler.MapFunc {

var requests []kube_reconcile.Request
for _, parentRef := range route.Spec.ParentRefs {
// parentRef.Group & Kind won't be nil as they have a default value
if *parentRef.Group != gatewayapi.GroupName || *parentRef.Kind != "Gateway" {
continue
}

namespace := route.Namespace
if parentRef.Namespace != nil {
namespace = string(*parentRef.Namespace)
Expand Down Expand Up @@ -350,6 +355,11 @@ func (r *GatewayReconciler) SetupWithManager(mgr kube_ctrl.Manager) error {
var names []string

for _, parentRef := range route.Spec.ParentRefs {
// parentRef.Group & Kind won't be nil as they have a default value
if *parentRef.Group != gatewayapi.GroupName || *parentRef.Kind != "Gateway" {
continue
}

namespace := route.Namespace
if parentRef.Namespace != nil {
namespace = string(*parentRef.Namespace)
Expand Down

0 comments on commit e90fc3d

Please sign in to comment.