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

Update Gateway/Listener status for consistency #1888

Merged
merged 3 commits into from
Mar 30, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
159 changes: 73 additions & 86 deletions apis/v1beta1/gateway_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,8 @@ const (
//
// * "Invalid"
// * "Pending"
// * "NoResources"
// * "AddressNotAssigned"
//
// Possible reasons for this condition to be Unknown are:
//
Expand All @@ -550,9 +552,20 @@ const (
// true.
GatewayReasonProgrammed GatewayConditionReason = "Programmed"

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

// This reason is used with the "Programmed" condition when the
// Gateway is not scheduled because insufficient infrastructure
// resources are available.
GatewayReasonNoResources GatewayConditionReason = "NoResources"

// This reason is used with the "Programmed" condition when none of the requested
// addresses have been assigned to the Gateway. This reason can be used to
// express a range of circumstances, including (but not limited to) IPAM
// address exhaustion, address not yet allocated, or a named address not being found.
GatewayReasonAddressNotAssigned GatewayConditionReason = "AddressNotAssigned"
)

const (
Expand All @@ -564,11 +577,14 @@ const (
// Possible reasons for this condition to be True are:
//
// * "Accepted"
// * "ListenersNotValid"
//
// Possible reasons for this condition to be False are:
//
// * "Invalid"
// * "NotReconciled"
// * "NoResources"
// * "UnsupportedAddress"
// * "ListenersNotValid"
//
// Possible reasons for this condition to be Unknown are:
//
Expand All @@ -579,76 +595,65 @@ const (
// interoperability.
GatewayConditionAccepted GatewayConditionType = "Accepted"

// Deprecated: use "Accepted" instead.
GatewayConditionScheduled GatewayConditionType = "Scheduled"

// This reason is used with the "Accepted" condition when the condition is
// True.
GatewayReasonAccepted GatewayConditionReason = "Accepted"

// This reason is used with the "Accepted" condition when one or
// more Listeners have an invalid or unsupported configuration
// and cannot be configured on the Gateway.
// This can be the reason when "Accepted" is "True" or "False", depending on whether
// the listener being invalid causes the entire Gateway to not be accepted.
GatewayReasonListenersNotValid GatewayConditionReason = "ListenersNotValid"

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

// This reason is used with the "Accepted" condition when the Gateway could not be configured
// because the requested address is not supported. This reason could be used in a number of
// instances, including:
//
// * The address is already in use.
// * The type of address is not supported by the implementation.
GatewaReasonUnsupportedAddress GatewayConditionReason = "UnsupportedAddress"
)

const (
// Deprecated: use "Accepted" instead.
GatewayConditionScheduled GatewayConditionType = "Scheduled"

// This reason is used with the "Scheduled" condition when the condition is
// True.
//
// Deprecated: use the "Accepted" condition with reason "Accepted" instead.
GatewayReasonScheduled GatewayConditionReason = "Scheduled"

// 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.
GatewayReasonNotReconciled GatewayConditionReason = "NotReconciled"

// This reason is used with the "Accepted" condition when the
// Gateway is not scheduled because insufficient infrastructure
// resources are available.
GatewayReasonNoResources GatewayConditionReason = "NoResources"
)

const (
// 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
// "ListenersNotValid" reason.
// "Ready" is a reserved condition type for future use. It should not be used by implementations.
// Note: This condition is not really "deprecated", but rather "reserved"; however, deprecated triggers Go linters
// to alert about usage.
//
// Possible reasons for this condition to be true are:
//
// * "Ready"
// If used in the future, "Ready" will represent the final state where all configuration is confirmed good
// _and has completely propagated to the data plane_. That is, it is a _guarantee_ that, as soon as something
// sees the Condition as `true`, then connections will be correctly routed _immediately_.
//
// Possible reasons for this condition to be False are:
//
// * "ListenersNotValid"
// * "ListenersNotReady"
// * "AddressNotAssigned"
// This is a very strong guarantee, and to date no implementation has satisfied it enough to implement it.
// This reservation can be discussed in the future if necessary.
//
// Controllers may raise this condition with other reasons,
// but should prefer to use the reasons listed above to improve
// interoperability.
// Deprecated: Ready is reserved for future use
shaneutt marked this conversation as resolved.
Show resolved Hide resolved
GatewayConditionReady GatewayConditionType = "Ready"

// This reason is used with the "Ready" condition when the condition is
// true.
// Deprecated: Ready is reserved for future use
GatewayReasonReady GatewayConditionReason = "Ready"

// This reason is used with the "Ready" condition when one or
// more Listeners have an invalid or unsupported configuration
// and cannot be configured on the Gateway.
GatewayReasonListenersNotValid GatewayConditionReason = "ListenersNotValid"

// This reason is used with the "Ready" condition when one or
// more Listeners are not ready to serve traffic.
// Deprecated: Ready is reserved for future use
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like it should move to "Programmed"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mentioned this in #1832 but left it out since it seemed controversial.

I will add it if folks want

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I liked the way you specified it in #1832 (comment). I think it could be fine as long as we have the "can be present when Accepted is True" caveat.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added it back

GatewayReasonListenersNotReady GatewayConditionReason = "ListenersNotReady"

// This reason is used with the "Ready" condition when none of the requested
// addresses have been assigned to the Gateway. This reason can be used to
// express a range of circumstances, including (but not limited to) IPAM
// address exhaustion, invalid or unsupported address requests, or a named
// address not being found.
GatewayReasonAddressNotAssigned GatewayConditionReason = "AddressNotAssigned"
)

// ListenerStatus is the status associated with a Listener.
Expand Down Expand Up @@ -745,7 +750,6 @@ const (
//
// * "PortUnavailable"
// * "UnsupportedProtocol"
// * "UnsupportedAddress"
//
// Possible reasons for this condition to be Unknown are:
//
Expand Down Expand Up @@ -781,14 +785,6 @@ const (
// Listener could not be attached to be Gateway because its
// protocol type is not supported.
ListenerReasonUnsupportedProtocol ListenerConditionReason = "UnsupportedProtocol"

// This reason is used with the "Accepted" condition when the Listener could
// not be attached to the Gateway because the requested address is not
// supported. This reason could be used in a number of instances, including:
//
// * The address is already in use.
// * The type of address is not supported by the implementation.
ListenerReasonUnsupportedAddress ListenerConditionReason = "UnsupportedAddress"
)

const (
Expand Down Expand Up @@ -870,34 +866,6 @@ const (
// 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"
//
// 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.
ListenerConditionReady ListenerConditionType = "Ready"

// This reason is used with the "Ready" condition when the condition is
// true.
ListenerReasonReady ListenerConditionReason = "Ready"

// This reason is used with the "Ready" and "Programmed" conditions when the
// Listener is syntactically or semantically invalid.
Expand All @@ -908,3 +876,22 @@ const (
// online and ready to accept client traffic.
ListenerReasonPending ListenerConditionReason = "Pending"
)

const (
// "Ready" is a reserved condition type for future use. It should not be used by implementations.
// Note: This condition is not really "deprecated", but rather "reserved"; however, deprecated triggers Go linters
// to alert about usage.
//
// If used in the future, "Ready" will represent the final state where all configuration is confirmed good
// _and has completely propagated to the data plane_. That is, it is a _guarantee_ that, as soon as something
// sees the Condition as `true`, then connections will be correctly routed _immediately_.
//
// This is a very strong guarantee, and to date no implementation has satisfied it enough to implement it.
// This reservation can be discussed in the future if necessary.
//
// Deprecated: Ready is reserved for future use
ListenerConditionReady ListenerConditionType = "Ready"

// Deprecated: Ready is reserved for future use
ListenerReasonReady ListenerConditionReason = "Ready"
)