Skip to content

Commit

Permalink
Merge pull request #839 from robscott/cleanup-v1alpha2
Browse files Browse the repository at this point in the history
Another round of v1alpha2 cleanup
  • Loading branch information
k8s-ci-robot authored Sep 7, 2021
2 parents 7789b91 + 58e1dd2 commit ff66fd9
Show file tree
Hide file tree
Showing 22 changed files with 422 additions and 380 deletions.
88 changes: 44 additions & 44 deletions apis/v1alpha2/gateway_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type Gateway struct {

// Status defines the current state of Gateway.
//
// +kubebuilder:default={conditions: {{type: "Scheduled", status: "False", reason:"NotReconciled", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"}}}
// +kubebuilder:default={conditions: {{type: "Scheduled", status: "Unknown", reason:"NotReconciled", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"}}}
Status GatewayStatus `json:"status,omitempty"`
}

Expand Down Expand Up @@ -72,6 +72,9 @@ type GatewaySpec struct {
// logical endpoints that are bound on this Gateway's addresses.
// At least one Listener MUST be specified.
//
// Each listener in a Gateway must have a unique combination of Hostname,
// Port, and Protocol.
//
// An implementation MAY group Listeners by Port and then collapse each
// group of Listeners into a single Listener if the implementation
// determines that the Listeners in the group are "compatible". An
Expand Down Expand Up @@ -142,10 +145,8 @@ type GatewaySpec struct {
Addresses []GatewayAddress `json:"addresses,omitempty"`
}

// Listener embodies the concept of a logical endpoint where a Gateway can
// accept network connections. Each listener in a Gateway must have a unique
// combination of Hostname, Port, and Protocol. This will be enforced by a
// validating webhook.
// Listener embodies the concept of a logical endpoint where a Gateway accepts
// network connections.
type Listener struct {
// Name is the name of the Listener.
//
Expand All @@ -157,10 +158,20 @@ type Listener struct {
// field is ignored for protocols that don't require hostname based
// matching.
//
// Implementations MUST apply Hostname matching appropriately for each of
// the following protocols:
//
// * TLS: The Listener Hostname MUST match the SNI.
// * HTTP: The Listener Hostname MUST match the Host header of the request.
// * HTTPS: The Listener Hostname SHOULD match at both the TLS and HTTP
// protocol layers as described above. If an implementation does not
// ensure that both the SNI and Host header match the Listener hostname,
// it MUST clearly document that.
//
// For HTTPRoute and TLSRoute resources, there is an interaction with the
// `spec.hostnames` array. When both listener and route specify hostnames,
// there must be an intersection between the values for a Route to be
// admitted. For more information, refer to the Route specific Hostnames
// there MUST be an intersection between the values for a Route to be
// accepted. For more information, refer to the Route specific Hostnames
// documentation.
//
// Support: Core
Expand All @@ -175,18 +186,6 @@ type Listener struct {
Port PortNumber `json:"port"`

// Protocol specifies the network protocol this listener expects to receive.
// The GatewayClass MUST apply the Hostname match appropriately for each
// protocol:
//
// * For the "TLS" protocol, the Hostname match MUST be
// applied to the [SNI](https://tools.ietf.org/html/rfc6066#section-3)
// server name offered by the client.
// * For the "HTTP" protocol, the Hostname match MUST be
// applied to the host portion of the
// [effective request URI](https://tools.ietf.org/html/rfc7230#section-5.5)
// or the [:authority pseudo-header](https://tools.ietf.org/html/rfc7540#section-8.1.2.3)
// * For the "HTTPS" protocol, the Hostname match MUST be
// applied at both the TLS and HTTP protocol layers.
//
// Support: Core
Protocol ProtocolType `json:"protocol"`
Expand Down Expand Up @@ -429,8 +428,6 @@ type RouteGroupKind struct {
type GatewayAddress struct {
// Type of the address.
//
// Support: Extended
//
// +optional
// +kubebuilder:default=IPAddress
Type *AddressType `json:"type,omitempty"`
Expand Down Expand Up @@ -506,7 +503,7 @@ type GatewayStatus struct {
// +listType=map
// +listMapKey=type
// +kubebuilder:validation:MaxItems=8
// +kubebuilder:default={{type: "Scheduled", status: "False", reason:"NotReconciled", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"}}
// +kubebuilder:default={{type: "Scheduled", status: "Unknown", reason:"NotReconciled", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"}}
Conditions []metav1.Condition `json:"conditions,omitempty"`

// Listeners provide status for each unique listener port defined in the Spec.
Expand Down Expand Up @@ -599,12 +596,11 @@ const (
// more Listeners are not ready to serve traffic.
GatewayReasonListenersNotReady GatewayConditionReason = "ListenersNotReady"

// This reason is used with the "Ready" condition when the requested
// address has not 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.
// 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"
)

Expand All @@ -614,17 +610,14 @@ type ListenerStatus struct {
Name SectionName `json:"name"`

// SupportedKinds is the list indicating the Kinds supported by this
// listener. When this is not specified on the Listener, this MUST represent
// the kinds an implementation supports for the specified protocol. When
// there are kinds specified on the Listener, this MUST represent the
// intersection of those kinds and the kinds supported by the implementation
// for the specified protocol.
//
// If kinds are specified in Spec that are not supported, an implementation
// MUST set the "ResolvedRefs" condition to "False" with the
// "InvalidRouteKinds" reason. If both valid and invalid Route kinds are
// specified, the implementation should support the valid Route kinds that
// have been specified.
// listener. This MUST represent the kinds an implementation supports for
// that Listener configuration.
//
// If kinds are specified in Spec that are not supported, they MUST NOT
// appear in this list and an implementation MUST set the "ResolvedRefs"
// condition to "False" with the "InvalidRouteKinds" reason. If both valid
// and invalid Route kinds are specified, the implementation MUST
// reference the valid Route kinds that have been specified.
//
// +kubebuilder:validation:MaxItems=8
SupportedKinds []RouteGroupKind `json:"supportedKinds"`
Expand Down Expand Up @@ -721,8 +714,12 @@ const (
// interoperability.
ListenerConditionDetached ListenerConditionType = "Detached"

// This reason is used with the "Detached" condition when the
// Listener requests a port that cannot be used on the Gateway.
// This reason is used with the "Detached" condition when the Listener
// requests a port that cannot be used on the Gateway. This reason could be
// used in a number of instances, including:
//
// * The port is already in use.
// * The port is not supported by the implementation.
ListenerReasonPortUnavailable ListenerConditionReason = "PortUnavailable"

// This reason is used with the "Detached" condition when the
Expand All @@ -736,9 +733,12 @@ const (
// protocol type is not supported.
ListenerReasonUnsupportedProtocol ListenerConditionReason = "UnsupportedProtocol"

// This reason is used with the "Detached" condition when
// the Listener could not be attached to the Gateway because the
// requested address is not supported.
// This reason is used with the "Detached" 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"

// This reason is used with the "Detached" condition when the condition is
Expand Down
40 changes: 18 additions & 22 deletions apis/v1alpha2/gatewayclass_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ type GatewayClass struct {

// Status defines the current state of GatewayClass.
//
// +kubebuilder:default={conditions: {{type: "Admitted", status: "False", message: "Waiting for controller", reason: "Waiting", lastTransitionTime: "1970-01-01T00:00:00Z"}}}
// +kubebuilder:default={conditions: {{type: "Accepted", status: "Unknown", message: "Waiting for controller", reason: "Waiting", lastTransitionTime: "1970-01-01T00:00:00Z"}}}
Status GatewayClassStatus `json:"status,omitempty"`
}

Expand All @@ -69,19 +69,15 @@ const (

// GatewayClassSpec reflects the configuration of a class of Gateways.
type GatewayClassSpec struct {
// Controller is a domain/path string that indicates the
// controller that is managing Gateways of this class.
// ControllerName is the name of the controller that is managing Gateways of
// this class. The value of this field MUST be a domain prefixed path.
//
// Example: "example.net/gateway-controller".
//
// This field is not mutable and cannot be empty.
//
// The format of this field is DOMAIN "/" PATH, where DOMAIN is a valid
// Kubernetes name (https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names)
// and PATH is a valid HTTP path as defined by RFC 3986.
//
// Support: Core
Controller GatewayController `json:"controller"`
ControllerName GatewayController `json:"controllerName"`

// ParametersRef is a reference to a resource that contains the configuration
// parameters corresponding to the GatewayClass. This is optional if the
Expand Down Expand Up @@ -130,8 +126,8 @@ type ParametersReference struct {
Scope *string `json:"scope,omitempty"`

// Namespace is the namespace of the referent.
// This field is required when scope is set to "Namespace" and ignored when
// scope is set to "Cluster".
// This field is required when scope is set to "Namespace" and must be unset
// when scope is set to "Cluster".
//
// +optional
Namespace *Namespace `json:"namespace,omitempty"`
Expand All @@ -147,19 +143,19 @@ type GatewayClassConditionType string
type GatewayClassConditionReason string

const (
// This condition indicates whether the GatewayClass has been admitted by
// This condition indicates whether the GatewayClass has been accepted by
// the controller requested in the `spec.controller` field.
//
// This condition defaults to False, and MUST be set by a controller when it
// sees a GatewayClass using its controller string. The status of this
// condition MUST be set to true if the controller will support provisioning
// This condition defaults to Unknown, and MUST be set by a controller when
// it sees a GatewayClass using its controller string. The status of this
// condition MUST be set to True if the controller will support provisioning
// Gateways using this class. Otherwise, this status MUST be set to False.
// If the status is set to False, the controller SHOULD set a Message and
// Reason as an explanation.
//
// Possible reasons for this condition to be true are:
//
// * "Admitted"
// * "Accepted"
//
// Possible reasons for this condition to be False are:
//
Expand All @@ -168,18 +164,18 @@ const (
//
// Controllers should prefer to use the values of GatewayClassConditionReason
// for the corresponding Reason, where appropriate.
GatewayClassConditionStatusAdmitted GatewayClassConditionType = "Admitted"
GatewayClassConditionStatusAccepted GatewayClassConditionType = "Accepted"

// This reason is used with the "Admitted" condition when the condition is
// This reason is used with the "Accepted" condition when the condition is
// true.
GatewayClassReasonAdmitted GatewayClassConditionReason = "Admitted"
GatewayClassReasonAccepted GatewayClassConditionReason = "Accepted"

// This reason is used with the "Admitted" condition when the
// GatewayClass was not admitted because the parametersRef field
// This reason is used with the "Accepted" condition when the
// GatewayClass was not accepted because the parametersRef field
// was invalid, with more detail in the message.
GatewayClassReasonInvalidParameters GatewayClassConditionReason = "InvalidParameters"

// This reason is used with the "Admitted" condition when the
// This reason is used with the "Accepted" condition when the
// requested controller has not yet made a decision about whether
// to admit the GatewayClass. It is the default Reason on a new
// GatewayClass.
Expand All @@ -198,7 +194,7 @@ type GatewayClassStatus struct {
// +listType=map
// +listMapKey=type
// +kubebuilder:validation:MaxItems=8
// +kubebuilder:default={{type: "Admitted", status: "False", message: "Waiting for controller", reason: "Waiting", lastTransitionTime: "1970-01-01T00:00:00Z"}}
// +kubebuilder:default={{type: "Accepted", status: "Unknown", message: "Waiting for controller", reason: "Waiting", lastTransitionTime: "1970-01-01T00:00:00Z"}}
Conditions []metav1.Condition `json:"conditions,omitempty"`
}

Expand Down
Loading

0 comments on commit ff66fd9

Please sign in to comment.