-
Notifications
You must be signed in to change notification settings - Fork 723
/
types.go
82 lines (65 loc) · 2.36 KB
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package v1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// RouteTable is a specification for a Gloo RouteTable resource
type RouteTable struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec RouteTableSpec `json:"spec"`
}
type RouteTableSpec struct {
Routes []Route `json:"routes,omitempty"`
}
type Route struct {
Matchers []Matcher `json:"matchers,omitempty"`
Action RouteAction `json:"routeAction,omitempty"`
InheritablePathMatchers bool `json:"inheritablePathMatchers,omitempty"`
}
type Matcher struct {
Headers []HeaderMatcher `json:"headers,omitempty"`
QueryParameterMatchers []QueryParameterMatcher `json:"queryParameters,omitempty"`
Methods []string `json:"methods,omitempty"`
}
type HeaderMatcher struct {
Name string `json:"name,omitempty"`
Value string `json:"value,omitempty"`
Regex bool `json:"regex,omitempty"`
InvertMatch bool `json:"invertMatch,omitempty"`
}
type QueryParameterMatcher struct {
Name string `json:"name,omitempty"`
Value string `json:"value,omitempty"`
Regex bool `json:"regex,omitempty"`
}
type RouteAction struct {
Destination MultiDestination `json:"multi,omitempty"`
}
type MultiDestination struct {
Destinations []WeightedDestination `json:"destinations,omitempty"`
}
// WeightedDestination attaches a weight to a single destination.
type WeightedDestination struct {
Destination Destination `json:"destination,omitempty"`
// Weight must be greater than zero
// Routing to each destination will be balanced by the ratio of the destination's weight to the total weight on a route
Weight uint32 `json:"weight,omitempty"`
}
// Destinations define routable destinations for proxied requests
type Destination struct {
Upstream ResourceRef `json:"upstream"`
}
// ResourceRef references resources across namespaces
type ResourceRef struct {
Name string `json:"name,omitempty"`
Namespace string `json:"namespace,omitempty"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// RouteTableList is a list of RouteTable resources
type RouteTableList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata"`
Items []RouteTable `json:"items"`
}