This repository has been archived by the owner on Mar 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
tcproute_types.go
111 lines (95 loc) · 4.33 KB
/
tcproute_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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
/*
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 v1alpha1pre1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// TCPRouteSpec defines the desired state of TCPRoute
type TCPRouteSpec struct {
// Rules are a list of TCP matchers and actions.
Rules []TCPRouteRule `json:"rules" protobuf:"bytes,1,rep,name=rules"`
}
// TCPRouteStatus defines the observed state of TCPRoute
type TCPRouteStatus struct {
GatewayRefs []GatewayObjectReference `json:"gatewayRefs" protobuf:"bytes,1,rep,name=gatewayRefs"`
}
// +genclient
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
// TCPRoute is the Schema for the tcproutes API
type TCPRoute struct {
metav1.TypeMeta `json:",inline" protobuf:"bytes,1,opt,name=typeMeta"`
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,2,opt,name=metadata"`
Spec TCPRouteSpec `json:"spec,omitempty" protobuf:"bytes,3,opt,name=spec"`
Status TCPRouteStatus `json:"status,omitempty" protobuf:"bytes,4,opt,name=status"`
}
// TCPRouteRule is the configuration for a given rule.
type TCPRouteRule struct {
// Match defines which connections match this rule.
//
// +optional
Match *TCPRouteMatch `json:"match" protobuf:"bytes,1,opt,name=match"`
// Action defines what happens to the connection.
//
// +optional
Action *TCPRouteAction `json:"action" protobuf:"bytes,2,opt,name=action"`
}
// TCPRouteAction is the action for a given rule.
type TCPRouteAction struct {
// ForwardTo sends requests to the referenced object. The
// resource may be "services" (omit or use the empty string for the
// group), or an implementation may support other resources (for
// example, resource "myroutetargets" in group "networking.acme.io").
// Omitting or specifying the empty string for both the resource and
// group indicates that the resource is "services". If the referent
// cannot be found, the "InvalidRoutes" status condition on any Gateway
// that includes the TCPRoute will be true.
ForwardTo *ForwardToTarget `json:"forwardTo" protobuf:"bytes,1,opt,name=forwardTo"`
// ExtensionRef is an optional, implementation-specific extension to the
// "action" behavior. The resource may be "configmaps" (use the empty
// string for the group) or an implementation-defined resource (for
// example, resource "myrouteactions" in group "networking.acme.io").
// Omitting or specifying the empty string for both the resource and
// group indicates that the resource is "configmaps". If the referent
// cannot be found, the "InvalidRoutes" status condition on any Gateway
// that includes the TCPRoute will be true.
//
// Support: custom
//
// +optional
ExtensionRef *RouteActionExtensionObjectReference `json:"extensionRef" protobuf:"bytes,2,opt,name=extensionRef"`
}
// TCPRouteMatch defines the predicate used to match connections to a
// given action.
type TCPRouteMatch struct {
// ExtensionRef is an optional, implementation-specific extension to the
// "match" behavior. The resource may be "configmap" (use the empty
// string for the group) or an implementation-defined resource (for
// example, resource "myroutematchers" in group "networking.acme.io").
// Omitting or specifying the empty string for both the resource and
// group indicates that the resource is "configmaps". If the referent
// cannot be found, the "InvalidRoutes" status condition on any Gateway
// that includes the TCPRoute will be true.
//
// Support: custom
//
// +optional
ExtensionRef *RouteMatchExtensionObjectReference `json:"extensionRef" protobuf:"bytes,1,opt,name=extensionRef"`
}
// +kubebuilder:object:root=true
// TCPRouteList contains a list of TCPRoute
type TCPRouteList struct {
metav1.TypeMeta `json:",inline" protobuf:"bytes,1,opt,name=typeMeta"`
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,2,opt,name=metadata"`
Items []TCPRoute `json:"items" protobuf:"bytes,3,rep,name=items"`
}