Skip to content

Commit d0b8494

Browse files
committed
Merge remote-tracking branch 'origin/release-v2-dev' into feat/support_multi_ingress_class
Signed-off-by: ashing <[email protected]>
2 parents 48f02ae + b50f98e commit d0b8494

File tree

8 files changed

+790
-8
lines changed

8 files changed

+790
-8
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
package v1alpha1
2+
3+
import (
4+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5+
6+
gatewayv1alpha2 "sigs.k8s.io/gateway-api/apis/v1alpha2"
7+
)
8+
9+
// +kubebuilder:object:root=true
10+
// +kubebuilder:subresource:status
11+
type BackendTrafficPolicy struct {
12+
metav1.TypeMeta `json:",inline"`
13+
metav1.ObjectMeta `json:"metadata,omitempty"`
14+
15+
Spec BackendTrafficPolicySpec `json:"spec,omitempty"`
16+
Status gatewayv1alpha2.PolicyStatus `json:"status,omitempty"`
17+
}
18+
19+
type BackendTrafficPolicySpec struct {
20+
// TargetRef identifies an API object to apply policy to.
21+
// Currently, Backends (i.e. Service, ServiceImport, or any
22+
// implementation-specific backendRef) are the only valid API
23+
// target references.
24+
// +listType=map
25+
// +listMapKey=group
26+
// +listMapKey=kind
27+
// +listMapKey=name
28+
// +kubebuilder:validation:MinItems=1
29+
// +kubebuilder:validation:MaxItems=16
30+
TargetRefs []gatewayv1alpha2.LocalPolicyTargetReferenceWithSectionName `json:"targetRefs"`
31+
// LoadBalancer represents the load balancer configuration for Kubernetes Service.
32+
// The default strategy is round robin.
33+
LoadBalancer *LoadBalancer `json:"loadbalancer,omitempty" yaml:"loadbalancer,omitempty"`
34+
// The scheme used to talk with the upstream.
35+
//
36+
// +kubebuilder:validation:Enum=http;https;grpc;grpcs;
37+
// +kubebuilder:default=http
38+
Scheme string `json:"scheme,omitempty" yaml:"scheme,omitempty"`
39+
40+
// How many times that the proxy (Apache APISIX) should do when
41+
// errors occur (error, timeout or bad http status codes like 500, 502).
42+
// +optional
43+
Retries *int `json:"retries,omitempty" yaml:"retries,omitempty"`
44+
45+
// Timeout settings for the read, send and connect to the upstream.
46+
Timeout *Timeout `json:"timeout,omitempty" yaml:"timeout,omitempty"`
47+
48+
// Configures the host when the request is forwarded to the upstream.
49+
// Can be one of pass, node or rewrite.
50+
//
51+
// +kubebuilder:validation:Enum=pass;node;rewrite;
52+
// +kubebuilder:default=pass
53+
PassHost string `json:"pass_host,omitempty" yaml:"pass_host,omitempty"`
54+
55+
// Specifies the host of the Upstream request. This is only valid if
56+
// the pass_host is set to rewrite
57+
Host Hostname `json:"upstream_host,omitempty" yaml:"upstream_host,omitempty"`
58+
}
59+
60+
// LoadBalancer describes the load balancing parameters.
61+
// +kubebuilder:validation:XValidation:rule="!(has(self.key) && self.type != 'chash')"
62+
type LoadBalancer struct {
63+
// +kubebuilder:validation:Enum=roundrobin;chash;ewma;least_conn;
64+
// +kubebuilder:default=roundrobin
65+
// +kubebuilder:validation:Required
66+
Type string `json:"type" yaml:"type"`
67+
// The HashOn and Key fields are required when Type is "chash".
68+
// HashOn represents the key fetching scope.
69+
// +kubebuilder:validation:Enum=vars;header;cookie;consumer;vars_combinations;
70+
// +kubebuilder:default=vars
71+
HashOn string `json:"hashOn,omitempty" yaml:"hashOn,omitempty"`
72+
// Key represents the hash key.
73+
Key string `json:"key,omitempty" yaml:"key,omitempty"`
74+
}
75+
76+
type Timeout struct {
77+
Connect metav1.Duration `json:"connect,omitempty" yaml:"connect,omitempty"`
78+
Send metav1.Duration `json:"send,omitempty" yaml:"send,omitempty"`
79+
Read metav1.Duration `json:"read,omitempty" yaml:"read,omitempty"`
80+
}
81+
82+
// +kubebuilder:object:root=true
83+
type BackendTrafficPolicyList struct {
84+
metav1.TypeMeta `json:",inline"`
85+
metav1.ListMeta `json:"metadata,omitempty"`
86+
Items []BackendTrafficPolicy `json:"items"`
87+
}
88+
89+
func init() {
90+
SchemeBuilder.Register(&BackendTrafficPolicy{}, &BackendTrafficPolicyList{})
91+
}

api/v1alpha1/consumer_types.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,6 @@ type SecretReference struct {
4646
Namespace *string `json:"namespace,omitempty"`
4747
}
4848

49-
type Status struct {
50-
Conditions []metav1.Condition `json:"conditions,omitempty"`
51-
}
52-
5349
// +kubebuilder:object:root=true
5450
type ConsumerList struct {
5551
metav1.TypeMeta `json:",inline"`

api/v1alpha1/types.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package v1alpha1
2+
3+
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
4+
5+
// +kubebuilder:validation:MinLength=1
6+
// +kubebuilder:validation:MaxLength=253
7+
// +kubebuilder:validation:Pattern=`^(\*\.)?[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$`
8+
type Hostname string
9+
10+
type Status struct {
11+
Conditions []metav1.Condition `json:"conditions,omitempty"`
12+
}

api/v1alpha1/zz_generated.deepcopy.go

Lines changed: 134 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)