Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "Programmed" Gateway condition, move "Ready" to extended conformance #1499

Merged
merged 8 commits into from
Nov 11, 2022
106 changes: 89 additions & 17 deletions apis/v1alpha2/gateway_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,47 @@ type GatewayConditionType = v1beta1.GatewayConditionType
type GatewayConditionReason = v1beta1.GatewayConditionReason

const (
// This condition is true when the controller managing the
// Gateway has scheduled the Gateway to the underlying network
// infrastructure.
// This condition indicates whether a Gateway have generated some
LCaparelli marked this conversation as resolved.
Show resolved Hide resolved
LCaparelli marked this conversation as resolved.
Show resolved Hide resolved
// configuration that will soon be ready in the underlying data plane.
//
// It is a positive-polarity summary condition, and so should always be
// present on the resource with ObservedGeneration set.
//
// It should be set to Unknown if the controller performs updates to the
// status before it has all the information it needs to be able to determine
// if the condition is true.
//
// Possible reasons for this condition to be True are:
//
// * "Programmed"
//
// Possible reasons for this condition to be False are:
//
// * "Invalid"
// * "Pending"
//
// Possible reasons for this condition to be Unknown are:
//
// * "Pending"
//
// Controllers may raise this condition with other reasons,
// but should prefer to use the reasons listed above to improve
// interoperability.
GatewayConditionProgrammed GatewayConditionType = "Programmed"

// This reason is used with the "Programmed" condition when the condition is
// true.
GatewayReasonProgrammed GatewayConditionReason = "Programmed"

// This reason is used with the "Programmed" condition when the Listener is
// syntactically or semantically invalid.
GatewayReasonInvalid GatewayConditionReason = "Invalid"
)

const (
// This condition is true when the controller managing the Gateway is
// syntactically and semantically valid enough to produce some configuration
// in the underlying data plane, though it has not necessarily configured it yet.
//
// Possible reasons for this condition to be True are:
//
Expand Down Expand Up @@ -231,8 +269,9 @@ const (
// Deprecated: use the "Accepted" condition with reason "Accepted" instead.
GatewayReasonScheduled GatewayConditionReason = "Scheduled"

// This reason is used with the "Accepted" condition when no controller has
// reconciled the Gateway.
// This reason is used with the "Accepted", "Programmed" and "Ready"
// conditions when the status is "Unknown" and no controller has reconciled
// the Gateway.
GatewayReasonPending GatewayConditionReason = "Pending"

// Deprecated: Use "Pending" instead.
Expand All @@ -245,11 +284,9 @@ const (
)

const (
// This condition is true when the Gateway is expected to be able
// to serve traffic. Note that this does not indicate that the
// Gateway configuration is current or even complete (e.g. the
// controller may still not have reconciled the latest version,
// or some parts of the configuration could be missing).
// Ready is an optional Condition that has Extended support. When it's set,
// the condition indicates whether the Gateway has been completely configured
// and traffic is ready to flow through the data plane immediately.
//
// If both the "ListenersNotValid" and "ListenersNotReady"
// reasons are true, the Gateway controller should prefer the
Expand Down Expand Up @@ -455,10 +492,45 @@ const (
)

const (
// This condition indicates whether the Listener has been
// configured on the Gateway.
// This condition indicates whether a Listener has generated some
// configuration that will soon be ready in the underlying data plane.
//
// Possible reasons for this condition to be true are:
// It is a positive-polarity summary condition, and so should always be
// present on the resource with ObservedGeneration set.
//
// It should be set to Unknown if the controller performs updates to the
// status before it has all the information it needs to be able to determine
// if the condition is true.
//
// Possible reasons for this condition to be True are:
//
// * "Programmed"
//
// Possible reasons for this condition to be False are:
//
// * "Invalid"
// * "Pending"
//
// Possible reasons for this condition to be Unknown are:
//
// * "Pending"
//
// Controllers may raise this condition with other reasons,
// but should prefer to use the reasons listed above to improve
// interoperability.
ListenerConditionProgrammed ListenerConditionType = "Programmed"

// This reason is used with the "Programmed" condition when the condition is
// true.
ListenerReasonProgrammed ListenerConditionReason = "Programmed"
)

const (
// Ready is an optional Condition that has Extended support. When it's set,
// the condition indicates whether the Listener has been configured on the
// Gateway and traffic is ready to flow through the data plane immediately.
//
// Possible reasons for this condition to be True are:
//
// * "Ready"
//
Expand All @@ -480,12 +552,12 @@ const (
// true.
ListenerReasonReady ListenerConditionReason = "Ready"

// This reason is used with the "Ready" condition when the
// This reason is used with the "Ready" and "Programmed" conditions when the
// Listener is syntactically or semantically invalid.
ListenerReasonInvalid ListenerConditionReason = "Invalid"

// This reason is used with the "Accepted" and "Ready" conditions when the
// Listener is either not yet reconciled or not yet not online and ready to
// accept client traffic.
// This reason is used with the "Accepted", "Ready" and "Programmed"
// conditions when the Listener is either not yet reconciled or not yet not
// online and ready to accept client traffic.
ListenerReasonPending ListenerConditionReason = "Pending"
LCaparelli marked this conversation as resolved.
Show resolved Hide resolved
)
106 changes: 89 additions & 17 deletions apis/v1beta1/gateway_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -516,9 +516,47 @@ type GatewayConditionType string
type GatewayConditionReason string

const (
// This condition is true when the controller managing the
// Gateway has scheduled the Gateway to the underlying network
// infrastructure.
// This condition indicates whether a Gateway have generated some
LCaparelli marked this conversation as resolved.
Show resolved Hide resolved
// configuration that will soon be ready in the underlying data plane.
//
// It is a positive-polarity summary condition, and so should always be
// present on the resource with ObservedGeneration set.
//
// It should be set to Unknown if the controller performs updates to the
// status before it has all the information it needs to be able to determine
// if the condition is true.
//
// Possible reasons for this condition to be True are:
//
// * "Programmed"
//
// Possible reasons for this condition to be False are:
//
// * "Invalid"
// * "Pending"
//
// Possible reasons for this condition to be Unknown are:
//
// * "Pending"
//
// Controllers may raise this condition with other reasons,
// but should prefer to use the reasons listed above to improve
// interoperability.
GatewayConditionProgrammed GatewayConditionType = "Programmed"

// This reason is used with the "Programmed" condition when the condition is
// true.
GatewayReasonProgrammed GatewayConditionReason = "Programmed"

// This reason is used with the "Programmed" condition when the Listener is
// syntactically or semantically invalid.
GatewayReasonInvalid GatewayConditionReason = "Invalid"
)

const (
// This condition is true when the controller managing the Gateway is
// syntactically and semantically valid enough to produce some configuration
// in the underlying data plane, though it has not necessarily configured it yet.
//
// Possible reasons for this condition to be True are:
//
Expand Down Expand Up @@ -551,8 +589,9 @@ const (
// Deprecated: use the "Accepted" condition with reason "Accepted" instead.
GatewayReasonScheduled GatewayConditionReason = "Scheduled"

// This reason is used with the "Accepted" condition when no controller has
// reconciled the Gateway.
// This reason is used with the "Accepted", "Programmed" and "Ready"
// conditions when the status is "Unknown" and no controller has reconciled
// the Gateway.
GatewayReasonPending GatewayConditionReason = "Pending"

// Deprecated: Use "Pending" instead.
Expand All @@ -565,11 +604,9 @@ const (
)

const (
// This condition is true when the Gateway is expected to be able
// to serve traffic. Note that this does not indicate that the
// Gateway configuration is current or even complete (e.g. the
// controller may still not have reconciled the latest version,
// or some parts of the configuration could be missing).
// Ready is an optional Condition that has Extended support. When it's set,
// the condition indicates whether the Gateway has been completely configured
// and traffic is ready to flow through the data plane immediately.
//
// If both the "ListenersNotValid" and "ListenersNotReady"
// reasons are true, the Gateway controller should prefer the
Expand Down Expand Up @@ -799,10 +836,45 @@ const (
)

const (
// This condition indicates whether the Listener has been
// configured on the Gateway.
// This condition indicates whether a Listener has generated some
// configuration that will soon be ready in the underlying data plane.
//
// Possible reasons for this condition to be true are:
// It is a positive-polarity summary condition, and so should always be
// present on the resource with ObservedGeneration set.
//
// It should be set to Unknown if the controller performs updates to the
// status before it has all the information it needs to be able to determine
// if the condition is true.
//
// Possible reasons for this condition to be True are:
//
// * "Programmed"
//
// Possible reasons for this condition to be False are:
//
// * "Invalid"
// * "Pending"
//
// Possible reasons for this condition to be Unknown are:
//
// * "Pending"
//
// Controllers may raise this condition with other reasons,
// but should prefer to use the reasons listed above to improve
// interoperability.
ListenerConditionProgrammed ListenerConditionType = "Programmed"

// This reason is used with the "Programmed" condition when the condition is
// true.
ListenerReasonProgrammed ListenerConditionReason = "Programmed"
)

const (
// Ready is an optional Condition that has Extended support. When it's set,
// the condition indicates whether the Listener has been configured on the
// Gateway and traffic is ready to flow through the data plane immediately.
//
// Possible reasons for this condition to be True are:
//
// * "Ready"
//
Expand All @@ -824,12 +896,12 @@ const (
// true.
ListenerReasonReady ListenerConditionReason = "Ready"

// This reason is used with the "Ready" condition when the
// This reason is used with the "Ready" and "Programmed" conditions when the
// Listener is syntactically or semantically invalid.
ListenerReasonInvalid ListenerConditionReason = "Invalid"

// This reason is used with the "Accepted" and "Ready" conditions when the
// Listener is either not yet reconciled or not yet not online and ready to
// accept client traffic.
// This reason is used with the "Accepted", "Ready" and "Programmed"
// conditions when the Listener is either not yet reconciled or not yet not
// online and ready to accept client traffic.
ListenerReasonPending ListenerConditionReason = "Pending"
)
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func init() {

var GatewaySecretMissingReferenceGrant = suite.ConformanceTest{
ShortName: "GatewaySecretMissingReferenceGrant",
Description: "A Gateway in the gateway-conformance-infra namespace should fail to become ready if the Gateway has a certificateRef for a Secret in the gateway-conformance-web-backend namespace and a ReferenceGrant granting permission to the Secret does not exist",
Description: "A Gateway in the gateway-conformance-infra namespace should fail to become programmed if the Gateway has a certificateRef for a Secret in the gateway-conformance-web-backend namespace and a ReferenceGrant granting permission to the Secret does not exist",
Features: []suite.SupportedFeature{suite.SupportReferenceGrant},
Manifests: []string{"tests/gateway-secret-missing-reference-grant.yaml"},
Test: func(t *testing.T, s *suite.ConformanceTestSuite) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ func init() {

var GatewaySecretReferenceGrantAllInNamespace = suite.ConformanceTest{
ShortName: "GatewaySecretReferenceGrantAllInNamespace",
Description: "A Gateway in the gateway-conformance-infra namespace should become ready if the Gateway has a certificateRef for a Secret in the gateway-conformance-web-backend namespace and a ReferenceGrant granting permission to all Secrets in the namespace exists",
Description: "A Gateway in the gateway-conformance-infra namespace should become programmed if the Gateway has a certificateRef for a Secret in the gateway-conformance-web-backend namespace and a ReferenceGrant granting permission to all Secrets in the namespace exists",
Features: []suite.SupportedFeature{suite.SupportReferenceGrant},
Manifests: []string{"tests/gateway-secret-reference-grant-all-in-namespace.yaml"},
Test: func(t *testing.T, s *suite.ConformanceTestSuite) {
gwNN := types.NamespacedName{Name: "gateway-secret-reference-grant", Namespace: "gateway-conformance-infra"}

t.Run("Gateway listener should have a true ResolvedRefs condition and a true Ready condition", func(t *testing.T) {
t.Run("Gateway listener should have a true ResolvedRefs condition and a true Programmed condition", func(t *testing.T) {
listeners := []v1beta1.ListenerStatus{{
Name: v1beta1.SectionName("https"),
SupportedKinds: []v1beta1.RouteGroupKind{{
Expand All @@ -48,9 +48,9 @@ var GatewaySecretReferenceGrantAllInNamespace = suite.ConformanceTest{
}},
Conditions: []metav1.Condition{
{
Type: string(v1beta1.ListenerConditionReady),
Type: string(v1beta1.ListenerConditionProgrammed),
Status: metav1.ConditionTrue,
Reason: string(v1beta1.ListenerReasonReady),
Reason: string(v1beta1.ListenerConditionProgrammed),
},
},
}}
Expand Down
8 changes: 4 additions & 4 deletions conformance/tests/gateway-secret-reference-grant-specific.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ func init() {

var GatewaySecretReferenceGrantSpecific = suite.ConformanceTest{
ShortName: "GatewaySecretReferenceGrantSpecific",
Description: "A Gateway in the gateway-conformance-infra namespace should become ready if the Gateway has a certificateRef for a Secret in the gateway-conformance-web-backend namespace and a ReferenceGrant granting permission to the specific Secret exists",
Description: "A Gateway in the gateway-conformance-infra namespace should become programmed if the Gateway has a certificateRef for a Secret in the gateway-conformance-web-backend namespace and a ReferenceGrant granting permission to the specific Secret exists",
Features: []suite.SupportedFeature{suite.SupportReferenceGrant},
Manifests: []string{"tests/gateway-secret-reference-grant-specific.yaml"},
Test: func(t *testing.T, s *suite.ConformanceTestSuite) {
gwNN := types.NamespacedName{Name: "gateway-secret-reference-grant", Namespace: "gateway-conformance-infra"}

t.Run("Gateway listener should have a true ResolvedRefs condition and a true Ready condition", func(t *testing.T) {
t.Run("Gateway listener should have a true ResolvedRefs condition and a true Programmed condition", func(t *testing.T) {
listeners := []v1beta1.ListenerStatus{{
Name: v1beta1.SectionName("https"),
SupportedKinds: []v1beta1.RouteGroupKind{{
Expand All @@ -48,9 +48,9 @@ var GatewaySecretReferenceGrantSpecific = suite.ConformanceTest{
}},
Conditions: []metav1.Condition{
{
Type: string(v1beta1.ListenerConditionReady),
Type: string(v1beta1.ListenerConditionProgrammed),
Status: metav1.ConditionTrue,
Reason: string(v1beta1.ListenerReasonReady),
Reason: string(v1beta1.ListenerReasonProgrammed),
},
},
}}
Expand Down
2 changes: 1 addition & 1 deletion conformance/tests/httproute-cross-namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var HTTPRouteCrossNamespace = suite.ConformanceTest{
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
routeNN := types.NamespacedName{Name: "cross-namespace", Namespace: "gateway-conformance-web-backend"}
gwNN := types.NamespacedName{Name: "backend-namespaces", Namespace: "gateway-conformance-infra"}
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeReady(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN)
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN)

t.Run("Simple HTTP request should reach web-backend", func(t *testing.T) {
http.MakeRequestAndExpectEventuallyConsistentResponse(t, suite.RoundTripper, suite.TimeoutConfig, gwAddr, http.ExpectedResponse{
Expand Down
2 changes: 1 addition & 1 deletion conformance/tests/httproute-disallowed-kind.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var HTTPRouteDisallowedKind = suite.ConformanceTest{
Test: func(t *testing.T, suite *suite.ConformanceTestSuite) {
// This test creates an additional Gateway in the gateway-conformance-infra
// namespace so we have to wait for it to be ready.
kubernetes.NamespacesMustBeReady(t, suite.Client, suite.TimeoutConfig, []string{"gateway-conformance-infra"})
kubernetes.NamespacesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, []string{"gateway-conformance-infra"})

routeName := types.NamespacedName{Name: "disallowed-kind", Namespace: "gateway-conformance-infra"}
gwName := types.NamespacedName{Name: "tlsroutes-only", Namespace: "gateway-conformance-infra"}
Expand Down
2 changes: 1 addition & 1 deletion conformance/tests/httproute-exact-path-matching.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var HTTPExactPathMatching = suite.ConformanceTest{
ns := "gateway-conformance-infra"
routeNN := types.NamespacedName{Name: "exact-matching", Namespace: ns}
gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns}
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeReady(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN)
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN)

testCases := []http.ExpectedResponse{
{
Expand Down
2 changes: 1 addition & 1 deletion conformance/tests/httproute-header-matching.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ var HTTPRouteHeaderMatching = suite.ConformanceTest{
ns := "gateway-conformance-infra"
routeNN := types.NamespacedName{Name: "header-matching", Namespace: ns}
gwNN := types.NamespacedName{Name: "same-namespace", Namespace: ns}
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeReady(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN)
gwAddr := kubernetes.GatewayAndHTTPRoutesMustBeAccepted(t, suite.Client, suite.TimeoutConfig, suite.ControllerName, kubernetes.NewGatewayRef(gwNN), routeNN)

testCases := []http.ExpectedResponse{{
Request: http.Request{Path: "/", Headers: map[string]string{"Version": "one"}},
Expand Down
Loading