diff --git a/internal/dag/gatewayapi_processor.go b/internal/dag/gatewayapi_processor.go index 3901159a1b4..4128a07f109 100644 --- a/internal/dag/gatewayapi_processor.go +++ b/internal/dag/gatewayapi_processor.go @@ -1459,14 +1459,14 @@ func (p *GatewayAPIProcessor) computeHTTPRouteForListener( gatewayapi_v1.RouteConditionAccepted, meta_v1.ConditionFalse, status.ReasonRouteRuleMatchConflict, - "HTTPRoute's Match has conflict with other HTTPRoute's Match", + status.MessageRouteRuleMatchConflict, ) } else if invalidRuleCnt > 0 { routeAccessor.AddCondition( gatewayapi_v1.RouteConditionPartiallyInvalid, meta_v1.ConditionTrue, status.ReasonRouteRuleMatchPartiallyConflict, - "Dropped Rule: HTTPRoute's rule(s) has(ve) been droped because of conflict against other HTTPRoute's rule(s)", + status.MessageRouteRuleMatchPartiallyConflict, ) } } diff --git a/internal/status/routeconditions.go b/internal/status/routeconditions.go index 2edeff3e50a..fa9bb809366 100644 --- a/internal/status/routeconditions.go +++ b/internal/status/routeconditions.go @@ -39,6 +39,9 @@ const ( ReasonInvalidGateway gatewayapi_v1.RouteConditionReason = "InvalidGateway" ReasonRouteRuleMatchConflict gatewayapi_v1.RouteConditionReason = "RuleMatchConflict" ReasonRouteRuleMatchPartiallyConflict gatewayapi_v1.RouteConditionReason = "RuleMatchPartiallyConflict" + + MessageRouteRuleMatchConflict string = "HTTPRoute's Match has conflict with other HTTPRoute's Match" + MessageRouteRuleMatchPartiallyConflict string = "Dropped Rule: HTTPRoute's rule(s) has(ve) been dropped because of conflict against other HTTPRoute's rule(s)" ) // RouteStatusUpdate represents an atomic update to a diff --git a/test/e2e/gatewayapi_predicates.go b/test/e2e/gatewayapi_predicates.go index 27501f81c3d..baf7e563922 100644 --- a/test/e2e/gatewayapi_predicates.go +++ b/test/e2e/gatewayapi_predicates.go @@ -130,7 +130,7 @@ func HTTPRouteNotAcceptedDueToConflict(route *gatewayapi_v1.HTTPRoute) bool { } for _, gw := range route.Status.Parents { - if conditionExistsWithAllKeys(gw.Conditions, string(gatewayapi_v1.RouteConditionAccepted), meta_v1.ConditionFalse, string(status.ReasonRouteRuleMatchConflict), "HTTPRoute's Match has conflict with other HTTPRoute's Match") { + if conditionExistsWithAllKeys(gw.Conditions, string(gatewayapi_v1.RouteConditionAccepted), meta_v1.ConditionFalse, string(status.ReasonRouteRuleMatchConflict), status.MessageRouteRuleMatchConflict) { return false } } @@ -147,7 +147,7 @@ func HTTPRoutePartiallyAccepted(route *gatewayapi_v1.HTTPRoute) bool { } for _, gw := range route.Status.Parents { - if conditionExistsWithAllKeys(gw.Conditions, string(gatewayapi_v1.RouteConditionPartiallyInvalid), meta_v1.ConditionTrue, string(status.ReasonRouteRuleMatchPartiallyConflict), "Dropped Rule: HTTPRoute's rule(s) has(ve) been droped because of conflict against other HTTPRoute's rule(s)") { + if conditionExistsWithAllKeys(gw.Conditions, string(gatewayapi_v1.RouteConditionPartiallyInvalid), meta_v1.ConditionTrue, string(status.ReasonRouteRuleMatchPartiallyConflict), status.MessageRouteRuleMatchPartiallyConflict) { return false } }