Skip to content

Commit

Permalink
Merge pull request kubernetes-sigs#212 from jpeach/align-conditions
Browse files Browse the repository at this point in the history
Align Conditions with KEP-1623.
  • Loading branch information
k8s-ci-robot authored Jun 15, 2020
2 parents 4b7d35b + d066ba2 commit 349d79b
Show file tree
Hide file tree
Showing 8 changed files with 427 additions and 156 deletions.
26 changes: 26 additions & 0 deletions api/v1alpha1/gateway_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,23 +381,36 @@ const (
// GatewayCondition is an error status for a given route.
type GatewayCondition struct {
// Type indicates the type of condition.
//
// +required
Type GatewayConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=GatewayConditionType"`
// Status describes the current state of this condition. Can be "True",
// "False", or "Unknown".
//
// +required
Status core.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
// Message is a human-understandable message describing the condition.
// This field may be empty.
//
// +required
Message string `json:"message,omitempty" protobuf:"bytes,3,opt,name=message"`
// Reason indicates why the condition is in this state.
// This field must not be empty.
//
// +required
Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
// LastTransitionTime indicates the last time this condition changed.
// This should be when the underlying condition changed.
// If that is not known, then using the time when the API field changed is acceptable.
//
// +required
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,5,opt,name=lastTransitionTime"`
// If set, this represents the .metadata.generation that the condition was set based upon.
// For instance, if .metadata.generation is currently 12, but the .status.condition[x].observedGeneration is 9, the condition is out of date
// with respect to the current state of the instance.
//
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,6,opt,name=observedGeneration"`
}

// ListenerStatus is the status associated with each listener block.
Expand Down Expand Up @@ -445,23 +458,36 @@ const (
// ListenerCondition is an error status for a given listener.
type ListenerCondition struct {
// Type indicates the type of condition.
//
// +required
Type ListenerConditionType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=ListenerConditionType"`
// Status describes the current state of this condition. Can be "True",
// "False", or "Unknown".
//
// +required
Status core.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status,casttype=k8s.io/api/core/v1.ConditionStatus"`
// Message is a human-understandable message describing the condition.
// This field may be empty.
//
// +required
Message string `json:"message,omitempty" protobuf:"bytes,3,opt,name=message"`
// Reason indicates why the condition is in this state.
// This field must not be empty.
//
// +required
Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
// LastTransitionTime indicates the last time this condition changed.
// This should be when the underlying condition changed.
// If that is not known, then using the time when the API field changed is acceptable.
//
// +required
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,5,opt,name=lastTransitionTime"`
// If set, this represents the .metadata.generation that the condition was set based upon.
// For instance, if .metadata.generation is currently 12, but the .status.condition[x].observedGeneration is 9, the condition is out of date
// with respect to the current state of the instance.
//
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,6,opt,name=observedGeneration"`
}

func init() {
Expand Down
16 changes: 11 additions & 5 deletions api/v1alpha1/gatewayclass_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,6 @@ const (
GatewayClassConditionStatusInvalidParameters GatewayClassConditionType = "InvalidParameters"
)

// GatewayClassConditionStatus is the status for a condition.
type GatewayClassConditionStatus = core.ConditionStatus

// GatewayClassStatus is the current status for the GatewayClass.
type GatewayClassStatus struct {
// Conditions is the current status from the controller for
Expand All @@ -160,12 +157,13 @@ type GatewayClassStatus struct {
// Support: Core, unless otherwise specified.
type GatewayClassCondition struct {
// Type of this condition.
//
// +required
Type GatewayClassConditionType `json:"type" protobuf:"bytes,1,opt,name=type"`
// Status of this condition.
//
// +required
Status GatewayClassConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status"`

Status core.ConditionStatus `json:"status" protobuf:"bytes,2,opt,name=status"`
// Reason is a machine consumable string for the last
// transition. It should be a one-word, CamelCase
// string. Reason will be defined by the controller.
Expand All @@ -181,9 +179,17 @@ type GatewayClassCondition struct {
// +required
Message string `json:"message,omitempty" protobuf:"bytes,4,opt,name=message"`
// LastTransitionTime is the time of the last change to this condition.
// This should be when the underlying condition changed.
// If that is not known, then using the time when the API field changed is acceptable.
//
// +required
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,5,opt,name=lastTransitionTime"`
// If set, this represents the .metadata.generation that the condition was set based upon.
// For instance, if .metadata.generation is currently 12, but the .status.condition[x].observedGeneration is 9, the condition is out of date
// with respect to the current state of the instance.
//
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty" protobuf:"varint,6,opt,name=observedGeneration"`
}

// +kubebuilder:object:root=true
Expand Down
Loading

0 comments on commit 349d79b

Please sign in to comment.