generated from kubernetes/kubernetes-template-project
-
Notifications
You must be signed in to change notification settings - Fork 509
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Standardize common route status fields.
All the route types share a common need to expose when they are successfully bound to a Gateway. To address this, we can hoist the `HTTPRouteStatus` fields into a generic struct and inline it into all the route types. Signed-off-by: James Peach <jpeach@vmware.com>
- Loading branch information
Showing
10 changed files
with
279 additions
and
150 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
core "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
// GatewayObjectReference identifies a Gateway object. | ||
type GatewayObjectReference struct { | ||
// Namespace is the namespace of the referent. | ||
// +optional | ||
Namespace string `json:"namespace,omitempty"` | ||
// Name is the name of the referent. | ||
// | ||
// +kubebuilder:validation:Required | ||
// +required | ||
Name string `json:"name"` | ||
} | ||
|
||
// RouteConditionType is a type of condition for a route. | ||
type RouteConditionType string | ||
|
||
const ( | ||
// ConditionRouteAdmitted indicates whether the route has been admitted | ||
// or rejected by a Gateway, and why. | ||
ConditionRouteAdmitted RouteConditionType = "Admitted" | ||
) | ||
|
||
// RouteCondition is a status condition for a given route. | ||
type RouteCondition struct { | ||
// Type indicates the type of condition. | ||
Type RouteConditionType `json:"type"` | ||
// Status describes the current state of this condition. Can be "True", | ||
// "False", or "Unknown". | ||
Status core.ConditionStatus `json:"status"` | ||
// Message is a human-understandable message describing the condition. | ||
// +optional | ||
Message string `json:"message,omitempty"` | ||
// Reason indicates why the condition is in this state. | ||
// +optional | ||
Reason string `json:"reason,omitempty"` | ||
// LastTransitionTime indicates the last time this condition changed. | ||
// +optional | ||
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"` | ||
} | ||
|
||
// RouteGatewayStatus describes the status of a route with respect to an | ||
// associated Gateway. | ||
type RouteGatewayStatus struct { | ||
// GatewayRef is a reference to a Gateway object that is associated with | ||
// the route. | ||
GatewayRef GatewayObjectReference `json:"gatewayRef"` | ||
// Conditions describes the status of the route with respect to the | ||
// Gateway. For example, the "Admitted" condition indicates whether the | ||
// route has been admitted or rejected by the Gateway, and why. Note | ||
// that the route's availability is also subject to the Gateway's own | ||
// status conditions and listener status. | ||
Conditions []RouteCondition `json:"conditions,omitempty"` | ||
} | ||
|
||
// RouteStatus defines the observed state that is required across | ||
// all route types. | ||
type RouteStatus struct { | ||
// Gateways is a list of the Gateways that are associated with the | ||
// route, and the status of the route with respect to each of these | ||
// Gateways. When a Gateway selects this route, the controller that | ||
// manages the Gateway should add an entry to this list when the | ||
// controller first sees the route and should update the entry as | ||
// appropriate when the route is modified. | ||
Gateways []RouteGatewayStatus `json:"gateways"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.