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

API Review for v0.6.0 release #1538

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
617 changes: 186 additions & 431 deletions apis/v1alpha2/gateway_types.go

Large diffs are not rendered by default.

104 changes: 21 additions & 83 deletions apis/v1alpha2/gatewayclass_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,16 @@ package v1alpha2

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"sigs.k8s.io/gateway-api/apis/v1beta1"
)

// +genclient
// +genclient:nonNamespaced
// +kubebuilder:object:root=true
// +kubebuilder:resource:categories=gateway-api,scope=Cluster,shortName=gc
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
// +kubebuilder:deprecatedversion:warning="The v1alpha2 version of GatewayClass has been deprecated and will be removed in a future release of the API. Please upgrade to v1beta1."
// +kubebuilder:printcolumn:name="Controller",type=string,JSONPath=`.spec.controllerName`
// +kubebuilder:printcolumn:name="Accepted",type=string,JSONPath=`.status.conditions[?(@.type=="Accepted")].status`
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp`
Expand All @@ -48,18 +50,7 @@ import (
// Gateway is not deleted while in use.
//
// GatewayClass is a Cluster level resource.
type GatewayClass struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

// Spec defines the desired state of GatewayClass.
Spec GatewayClassSpec `json:"spec"`

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

const (
// GatewayClassFinalizerGatewaysExist should be added as a finalizer to the
Expand All @@ -69,71 +60,24 @@ const (
)

// GatewayClassSpec reflects the configuration of a class of Gateways.
type GatewayClassSpec struct {
// 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.
//
// Support: Core
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
// controller does not require any additional configuration.
//
// ParametersRef can reference a standard Kubernetes resource, i.e. ConfigMap,
// or an implementation-specific custom resource. The resource can be
// cluster-scoped or namespace-scoped.
//
// If the referent cannot be found, the GatewayClass's "InvalidParameters"
// status condition will be true.
//
// Support: Custom
//
// +optional
ParametersRef *ParametersReference `json:"parametersRef,omitempty"`

// Description helps describe a GatewayClass with more details.
//
// +kubebuilder:validation:MaxLength=64
// +optional
Description *string `json:"description,omitempty"`
}
// +k8s:deepcopy-gen=false
type GatewayClassSpec = v1beta1.GatewayClassSpec

// ParametersReference identifies an API object containing controller-specific
// configuration resource within the cluster.
type ParametersReference struct {
// Group is the group of the referent.
Group Group `json:"group"`

// Kind is kind of the referent.
Kind Kind `json:"kind"`

// Name is the name of the referent.
//
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
Name string `json:"name"`

// Namespace is the namespace of the referent.
// This field is required when referring to a Namespace-scoped resource and
// MUST be unset when referring to a Cluster-scoped resource.
//
// +optional
Namespace *Namespace `json:"namespace,omitempty"`
}
// +k8s:deepcopy-gen=false
type ParametersReference = v1beta1.ParametersReference

// GatewayClassConditionType is the type for status conditions on
// Gateway resources. This type should be used with the
// GatewayClassStatus.Conditions field.
type GatewayClassConditionType string
// +k8s:deepcopy-gen=false
type GatewayClassConditionType = v1beta1.GatewayClassConditionType

// GatewayClassConditionReason defines the set of reasons that explain why a
// particular GatewayClass condition type has been raised.
type GatewayClassConditionReason string
// +k8s:deepcopy-gen=false
type GatewayClassConditionReason = v1beta1.GatewayClassConditionReason

const (
// This condition indicates whether the GatewayClass has been accepted by
Expand All @@ -153,7 +97,10 @@ const (
// Possible reasons for this condition to be False are:
//
// * "InvalidParameters"
// * "Waiting"
//
// Possible reasons for this condition to be Unknown are:
//
// * "Pending"
//
// Controllers should prefer to use the values of GatewayClassConditionReason
// for the corresponding Reason, where appropriate.
Expand All @@ -172,24 +119,15 @@ const (
// requested controller has not yet made a decision about whether
// to admit the GatewayClass. It is the default Reason on a new
// GatewayClass.
GatewayClassReasonPending GatewayClassConditionReason = "Pending"

// Deprecated: Use "Pending" instead.
GatewayClassReasonWaiting GatewayClassConditionReason = "Waiting"
)

// GatewayClassStatus is the current status for the GatewayClass.
type GatewayClassStatus struct {
// Conditions is the current status from the controller for
// this GatewayClass.
//
// Controllers should prefer to publish conditions using values
// of GatewayClassConditionType for the type of each Condition.
//
// +optional
// +listType=map
// +listMapKey=type
// +kubebuilder:validation:MaxItems=8
// +kubebuilder:default={{type: "Accepted", status: "Unknown", message: "Waiting for controller", reason: "Waiting", lastTransitionTime: "1970-01-01T00:00:00Z"}}
Conditions []metav1.Condition `json:"conditions,omitempty"`
}
// +k8s:deepcopy-gen=false
type GatewayClassStatus = v1beta1.GatewayClassStatus

// +kubebuilder:object:root=true

Expand Down
Loading