From dee5543bdd00236c98d122de2ba964d0fce9d2dd Mon Sep 17 00:00:00 2001 From: Mike Morris Date: Thu, 14 Apr 2022 13:33:03 -0400 Subject: [PATCH 1/6] api: rename ConditionRoute* to RouteCondition* for parity with ListnerCondition* --- apis/v1alpha2/shared_types.go | 4 ++-- conformance/utils/kubernetes/helpers.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apis/v1alpha2/shared_types.go b/apis/v1alpha2/shared_types.go index 99ff6cbc3e..79db7d5806 100644 --- a/apis/v1alpha2/shared_types.go +++ b/apis/v1alpha2/shared_types.go @@ -189,11 +189,11 @@ type RouteConditionType string const ( // This condition indicates whether the route has been accepted or rejected // by a Gateway, and why. - ConditionRouteAccepted RouteConditionType = "Accepted" + RouteConditionAccepted RouteConditionType = "Accepted" // This condition indicates whether the controller was able to resolve all // the object references for the Route. - ConditionRouteResolvedRefs RouteConditionType = "ResolvedRefs" + RouteConditionResolvedRefs RouteConditionType = "ResolvedRefs" ) // RouteParentStatus describes the status of a route with respect to an diff --git a/conformance/utils/kubernetes/helpers.go b/conformance/utils/kubernetes/helpers.go index d48449980c..d1e02a76e6 100644 --- a/conformance/utils/kubernetes/helpers.go +++ b/conformance/utils/kubernetes/helpers.go @@ -133,7 +133,7 @@ func GatewayAndHTTPRoutesMustBeReady(t *testing.T, c client.Client, controllerNa }, ControllerName: v1alpha2.GatewayController(controllerName), Conditions: []metav1.Condition{{ - Type: string(v1alpha2.ConditionRouteAccepted), + Type: string(v1alpha2.RouteConditionAccepted), Status: metav1.ConditionTrue, }}, }} From 3941c48861f670dcccad2725ac18f8a226cefa60 Mon Sep 17 00:00:00 2001 From: Mike Morris Date: Thu, 14 Apr 2022 13:38:35 -0400 Subject: [PATCH 2/6] api: add aliases for ConditionRoute* types for backwards compatibility --- apis/v1alpha2/shared_types.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apis/v1alpha2/shared_types.go b/apis/v1alpha2/shared_types.go index 79db7d5806..cd0b2f7a07 100644 --- a/apis/v1alpha2/shared_types.go +++ b/apis/v1alpha2/shared_types.go @@ -191,9 +191,15 @@ const ( // by a Gateway, and why. RouteConditionAccepted RouteConditionType = "Accepted" + // FIXME: alias for backwards compatibility in v1alpha2, remove in next release + ConditionRouteAccepted RouteConditionType = RouteConditionAccepted + // This condition indicates whether the controller was able to resolve all // the object references for the Route. RouteConditionResolvedRefs RouteConditionType = "ResolvedRefs" + + // FIXME: alias for backwards compatibility in v1alpha2, remove in next release + ConditionRouteResolvedRefs RouteConditionType = RouteConditionResolvedRefs ) // RouteParentStatus describes the status of a route with respect to an From af833e25234ea1e588ed36c77b20396bf3f8b627 Mon Sep 17 00:00:00 2001 From: Mike Morris Date: Thu, 14 Apr 2022 13:43:27 -0400 Subject: [PATCH 3/6] api: add RouteConditionReason with Accepted, ResolvedRefs and RefNotPermitted reasons --- apis/v1alpha2/shared_types.go | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/apis/v1alpha2/shared_types.go b/apis/v1alpha2/shared_types.go index cd0b2f7a07..e0c3951e73 100644 --- a/apis/v1alpha2/shared_types.go +++ b/apis/v1alpha2/shared_types.go @@ -186,9 +186,20 @@ type BackendRef struct { // RouteConditionType is a type of condition for a route. type RouteConditionType string +// RouteConditionReason is a reason for a route condition. +type RouteConditionReason string + const ( // This condition indicates whether the route has been accepted or rejected // by a Gateway, and why. + // + // Possible reasons for this condition to be true are: + // + // * "Accepted" + // + // Controllers may raise this condition with other reasons, + // but should prefer to use the reasons listed above to improve + // interoperability. RouteConditionAccepted RouteConditionType = "Accepted" // FIXME: alias for backwards compatibility in v1alpha2, remove in next release @@ -196,10 +207,36 @@ const ( // This condition indicates whether the controller was able to resolve all // the object references for the Route. + // + // Possible reasons for this condition to be true are: + // + // * "ResolvedRefs" + // + // Possible reasons for this condition to be False are: + // + // * "RefNotPermitted" + // + // Controllers may raise this condition with other reasons, + // but should prefer to use the reasons listed above to improve + // interoperability. RouteConditionResolvedRefs RouteConditionType = "ResolvedRefs" // FIXME: alias for backwards compatibility in v1alpha2, remove in next release ConditionRouteResolvedRefs RouteConditionType = RouteConditionResolvedRefs + + // This reason is used with the "Accepted" condition when the Route has been + // accepted by the Gateway. + RouteReasonAccepted RouteConditionReason = "Accepted" + + // This reason is used with the "ResolvedRefs" condition when the condition + // is true. + RouteReasonResolvedRefs RouteConditionReason = "ResolvedRefs" + + // This reason is used with the "ResolvedRefs" condition when + // one of the Listener's Routes has a BackendRef to an object in + // another namespace, where the object in the other namespace does + // not have a ReferencePolicy explicitly allowing the reference. + RouteReasonRefNotPermitted RouteConditionReason = "RefNotPermitted" ) // RouteParentStatus describes the status of a route with respect to an From 1a4906e41ff7bfcf8f86e21d4980009d9bd44b99 Mon Sep 17 00:00:00 2001 From: Mike Morris Date: Tue, 19 Apr 2022 14:53:17 -0400 Subject: [PATCH 4/6] fixup: remove backwards compat ConditionRoute* constants --- apis/v1alpha2/shared_types.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/apis/v1alpha2/shared_types.go b/apis/v1alpha2/shared_types.go index e0c3951e73..02073cc8c3 100644 --- a/apis/v1alpha2/shared_types.go +++ b/apis/v1alpha2/shared_types.go @@ -202,9 +202,6 @@ const ( // interoperability. RouteConditionAccepted RouteConditionType = "Accepted" - // FIXME: alias for backwards compatibility in v1alpha2, remove in next release - ConditionRouteAccepted RouteConditionType = RouteConditionAccepted - // This condition indicates whether the controller was able to resolve all // the object references for the Route. // @@ -221,9 +218,6 @@ const ( // interoperability. RouteConditionResolvedRefs RouteConditionType = "ResolvedRefs" - // FIXME: alias for backwards compatibility in v1alpha2, remove in next release - ConditionRouteResolvedRefs RouteConditionType = RouteConditionResolvedRefs - // This reason is used with the "Accepted" condition when the Route has been // accepted by the Gateway. RouteReasonAccepted RouteConditionReason = "Accepted" From 961f8e7c1b77cb782dcfd4f663c4761d143c524b Mon Sep 17 00:00:00 2001 From: Mike Morris Date: Tue, 19 Apr 2022 14:54:48 -0400 Subject: [PATCH 5/6] fixup: reorder RouteReasonAccepted --- apis/v1alpha2/shared_types.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apis/v1alpha2/shared_types.go b/apis/v1alpha2/shared_types.go index 02073cc8c3..441fc6397c 100644 --- a/apis/v1alpha2/shared_types.go +++ b/apis/v1alpha2/shared_types.go @@ -202,6 +202,10 @@ const ( // interoperability. RouteConditionAccepted RouteConditionType = "Accepted" + // This reason is used with the "Accepted" condition when the Route has been + // accepted by the Gateway. + RouteReasonAccepted RouteConditionReason = "Accepted" + // This condition indicates whether the controller was able to resolve all // the object references for the Route. // @@ -218,10 +222,6 @@ const ( // interoperability. RouteConditionResolvedRefs RouteConditionType = "ResolvedRefs" - // This reason is used with the "Accepted" condition when the Route has been - // accepted by the Gateway. - RouteReasonAccepted RouteConditionReason = "Accepted" - // This reason is used with the "ResolvedRefs" condition when the condition // is true. RouteReasonResolvedRefs RouteConditionReason = "ResolvedRefs" From 9637a0f344095784cfad735839b7d8a79113d484 Mon Sep 17 00:00:00 2001 From: Mike Morris Date: Tue, 19 Apr 2022 17:33:28 -0400 Subject: [PATCH 6/6] Update apis/v1alpha2/shared_types.go Co-authored-by: Rob Scott --- apis/v1alpha2/shared_types.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apis/v1alpha2/shared_types.go b/apis/v1alpha2/shared_types.go index 441fc6397c..faa4a2eb00 100644 --- a/apis/v1alpha2/shared_types.go +++ b/apis/v1alpha2/shared_types.go @@ -213,7 +213,7 @@ const ( // // * "ResolvedRefs" // - // Possible reasons for this condition to be False are: + // Possible reasons for this condition to be false are: // // * "RefNotPermitted" //