Skip to content

Commit

Permalink
Update address route matches.
Browse files Browse the repository at this point in the history
Signed-off-by: James Peach <[email protected]>
  • Loading branch information
jpeach authored and shaneutt committed Jan 12, 2022
1 parent 1b6f12b commit 9f92464
Show file tree
Hide file tree
Showing 8 changed files with 300 additions and 325 deletions.
25 changes: 16 additions & 9 deletions apis/v1alpha2/shared_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -400,24 +400,31 @@ type AnnotationKey string
// +kubebuilder:validation:MaxLength=4096
type AnnotationValue string

// AddressRouteMatches defines AddressMatch rules for inbound traffic according to
// AddressRouteMatch defines NetworkAddress rules for inbound traffic according to
// source and/or destination address of a packet or connection.
type AddressRouteMatches struct {
// Multiple match fields are ANDed together, i.e. the match will
// evaluate to true only if all conditions are satisfied.
// At least one match field is required.
type AddressRouteMatch struct {
// SourceAddresses indicates the originating (source) network
// addresses which are valid for routing traffic.
//
// Support: Core
SourceAddresses []AddressMatch `json:"sourceAddresses"`
//
// +optional
SourceAddress *NetworkAddress `json:"sourceAddresses"`

// DestinationAddresses indicates the destination network addresses
// which are valid for routing traffic.
//
// Support: Core
DestinationAddresses []AddressMatch `json:"destinationAddresses"`
//
// +optional
DestinationAddress *NetworkAddress `json:"destinationAddresses"`
}

// AddressMatch defines matching rules for network addresses by type.
type AddressMatch struct {
// NetworkAddress defines matching rules for network addresses by type.
type NetworkAddress struct {
// Type of the address, either IPAddress or NamedAddress.
//
// If NamedAddress is used this is a custom and specific value for each
Expand All @@ -430,7 +437,7 @@ type AddressMatch struct {
// Support: Custom (NamedAddress)
//
// +optional
Type *L4AddressType `json:"type,omitempty"`
Type *NetworkAddressType `json:"type,omitempty"`

// Value of the address. The validity of the values will depend
// on the type and support by the controller.
Expand All @@ -449,8 +456,8 @@ type AddressMatch struct {
Value string `json:"value"`
}

// L4AddressType defines how a network address is represented as a text string.
// NetworkAddressType defines how a network address is represented as a text string.
//
// +kubebuilder:validation:Enum=IPAddress;NamedAddress
// +kubebuilder:default=IPAddress
type L4AddressType string
type NetworkAddressType string
4 changes: 3 additions & 1 deletion apis/v1alpha2/tcproute_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@ type TCPRouteStatus struct {
// TCPRouteRule is the configuration for a given rule.
type TCPRouteRule struct {
// Matches are rules for routing traffic to backends based on addresses.
// Each match is independent, i.e. this rule will be matched
// if **any** one of the matches is satisfied.
//
// +optional
// +kubebuilder:validation:MaxItems=16
Matches []AddressRouteMatches `json:"matches,omitempty"`
Matches []AddressRouteMatch `json:"matches,omitempty"`

// BackendRefs defines the backend(s) where matching requests should be
// sent. If unspecified or invalid (refers to a non-existent resource or a
Expand Down
4 changes: 3 additions & 1 deletion apis/v1alpha2/udproute_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@ type UDPRouteStatus struct {
// UDPRouteRule is the configuration for a given rule.
type UDPRouteRule struct {
// Matches add rules for filtering traffic to backends based on addresses.
// Each match is independent, i.e. this rule will be matched
// if **any** one of the matches is satisfied.
//
// +optional
// +kubebuilder:validation:MaxItems=16
Matches []AddressRouteMatches `json:"matches,omitempty"`
Matches []AddressRouteMatch `json:"matches,omitempty"`

// BackendRefs defines the backend(s) where matching requests should be
// sent. If unspecified or invalid (refers to a non-existent resource or a
Expand Down
72 changes: 34 additions & 38 deletions apis/v1alpha2/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

130 changes: 61 additions & 69 deletions config/crd/experimental/gateway.networking.k8s.io_tcproutes.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 9f92464

Please sign in to comment.