Skip to content

Commit

Permalink
fix(GatewayAPI): don't share HTTPRoute conditions between parentRefs
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbeaumont committed Apr 14, 2023
1 parent 433f90b commit b80c33b
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

"github.com/go-logr/logr"
"github.com/pkg/errors"
"golang.org/x/exp/slices"
kube_core "k8s.io/api/core/v1"
kube_apierrs "k8s.io/apimachinery/pkg/api/errors"
kube_apimeta "k8s.io/apimachinery/pkg/api/meta"
Expand Down Expand Up @@ -119,6 +120,8 @@ func (r *HTTPRouteReconciler) gapiToKumaRoutes(
return nil, nil, errors.Wrapf(err, "unable to check parent ref %d", i)
}

refConditions := slices.Clone(routeConditions)

switch refAttachment {
case attachment.Unknown:
// We don't care about this ref
Expand All @@ -141,16 +144,16 @@ func (r *HTTPRouteReconciler) gapiToKumaRoutes(
reason = string(gatewayapi.RouteReasonNoMatchingParent)
}

if !kube_apimeta.IsStatusConditionFalse(routeConditions, string(gatewayapi.RouteConditionAccepted)) {
kube_apimeta.SetStatusCondition(&routeConditions, kube_meta.Condition{
if !kube_apimeta.IsStatusConditionFalse(refConditions, string(gatewayapi.RouteConditionAccepted)) {
kube_apimeta.SetStatusCondition(&refConditions, kube_meta.Condition{
Type: string(gatewayapi.RouteConditionAccepted),
Status: kube_meta.ConditionFalse,
Reason: reason,
})
}
}

conditions[ref] = routeConditions
conditions[ref] = refConditions
}

var kumaRoute *mesh_proto.MeshGatewayRoute
Expand Down

0 comments on commit b80c33b

Please sign in to comment.