forked from envoyproxy/gateway
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat BackendTrafficPolicy (envoyproxy#2053)
* feat BackendTrafficPolicy Takes PR envoyproxy#1961 forward Signed-off-by: Arko Dasgupta <[email protected]> * lint Signed-off-by: Arko Dasgupta <[email protected]> * k8s status Signed-off-by: Arko Dasgupta <[email protected]> * k8s watch Signed-off-by: Arko Dasgupta <[email protected]> * Update site/content/en/latest/design/backend-traffic-policy.md Co-authored-by: zirain <[email protected]> Signed-off-by: Arko Dasgupta <[email protected]> * Update site/content/en/latest/design/backend-traffic-policy.md Co-authored-by: zirain <[email protected]> Signed-off-by: Arko Dasgupta <[email protected]> --------- Signed-off-by: Arko Dasgupta <[email protected]> Signed-off-by: Arko Dasgupta <[email protected]> Co-authored-by: zirain <[email protected]>
- Loading branch information
Showing
19 changed files
with
1,507 additions
and
49 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// Copyright Envoy Gateway Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// The full text of the Apache license is available in the LICENSE file at | ||
// the root of the repo. | ||
|
||
package v1alpha1 | ||
|
||
import ( | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
gwapiv1a2 "sigs.k8s.io/gateway-api/apis/v1alpha2" | ||
) | ||
|
||
const ( | ||
// KindBackendTrafficPolicy is the name of the BackendTrafficPolicy kind. | ||
KindBackendTrafficPolicy = "BackendTrafficPolicy" | ||
) | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:resource:shortName=btpolicy | ||
// +kubebuilder:subresource:status | ||
// +kubebuilder:subresource:overrideStrategy | ||
// +kubebuilder:printcolumn:name="Status",type=string,JSONPath=`.status.conditions[?(@.type=="Accepted")].reason` | ||
// +kubebuilder:printcolumn:name="Age",type=date,JSONPath=`.metadata.creationTimestamp` | ||
// | ||
// BackendTrafficPolicy allows the user to configure the behavior of the connection | ||
// between the downstream client and Envoy Proxy listener. | ||
type BackendTrafficPolicy struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
|
||
// spec defines the desired state of BackendTrafficPolicy. | ||
Spec BackendTrafficPolicySpec `json:"spec"` | ||
|
||
// status defines the current status of BackendTrafficPolicy. | ||
Status BackendTrafficPolicyStatus `json:"status,omitempty"` | ||
} | ||
|
||
// spec defines the desired state of BackendTrafficPolicy. | ||
type BackendTrafficPolicySpec struct { | ||
|
||
// +kubebuilder:validation:XValidation:rule="self.kind == 'Gateway' || self.kind == 'HTTPRoute' || self.kind == 'GRPCRoute' || self.kind == 'UDPRoute' || self.kind == 'TCPRoute' || self.kind == 'TLSRoute'", message="this policy can only have a targetRef.kind of Gateway/HTTPRoute/GRPCRoute/TCPRoute/UDPRoute/TLSRoute" | ||
// | ||
// targetRef is the name of the resource this policy | ||
// is being attached to. | ||
// This Policy and the TargetRef MUST be in the same namespace | ||
// for this Policy to have effect and be applied to the Gateway. | ||
TargetRef gwapiv1a2.PolicyTargetReferenceWithSectionName `json:"targetRef"` | ||
} | ||
|
||
// BackendTrafficPolicyStatus defines the state of BackendTrafficPolicy | ||
type BackendTrafficPolicyStatus struct { | ||
// Conditions describe the current conditions of the BackendTrafficPolicy. | ||
// | ||
// +optional | ||
// +listType=map | ||
// +listMapKey=type | ||
// +kubebuilder:validation:MaxItems=8 | ||
Conditions []metav1.Condition `json:"conditions,omitempty"` | ||
} | ||
|
||
// +kubebuilder:object:root=true | ||
// BackendTrafficPolicyList contains a list of BackendTrafficPolicy resources. | ||
type BackendTrafficPolicyList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
Items []BackendTrafficPolicy `json:"items"` | ||
} | ||
|
||
func init() { | ||
SchemeBuilder.Register(&BackendTrafficPolicy{}, &BackendTrafficPolicyList{}) | ||
} |
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.