From 22c450929f3defbee12ee04bb7d7f7de18f0d5f8 Mon Sep 17 00:00:00 2001 From: Shane Utt Date: Wed, 12 Jan 2022 14:06:18 -0500 Subject: [PATCH] fix: update examples for spec change --- apis/v1alpha2/gateway_types.go | 14 ++++++-------- apis/v1alpha2/shared_types.go | 8 +------- apis/v1alpha2/zz_generated.deepcopy.go | 4 ++-- .../gateway.networking.k8s.io_tcproutes.yaml | 5 ++++- .../gateway.networking.k8s.io_udproutes.yaml | 5 ++++- .../gateway.networking.k8s.io_tcproutes.yaml | 5 ++++- .../gateway.networking.k8s.io_udproutes.yaml | 5 ++++- examples/v1alpha2/traffic-matching-tcp.yaml | 9 ++++++--- 8 files changed, 31 insertions(+), 24 deletions(-) diff --git a/apis/v1alpha2/gateway_types.go b/apis/v1alpha2/gateway_types.go index 398b122d84..52443d1175 100644 --- a/apis/v1alpha2/gateway_types.go +++ b/apis/v1alpha2/gateway_types.go @@ -450,7 +450,7 @@ type GatewayAddress struct { // // +optional // +kubebuilder:default=IPAddress - Type *GatewayAddressType `json:"type,omitempty"` + Type *AddressType `json:"type,omitempty"` // Value of the address. The validity of the values will depend // on the type and support by the controller. @@ -462,16 +462,14 @@ type GatewayAddress struct { Value string `json:"value"` } -// GatewayAddressType defines how a network address is represented as a text -// string, specifically in the context of listener addresses for Gateways and -// includes options over the base AddressType type such as Hostname. +// AddressType defines how a network address is represented as a text string. // // If the requested address is unsupported, the controller // should raise the "Detached" listener status condition on // the Gateway with the "UnsupportedAddress" reason. // // +kubebuilder:validation:Enum=IPAddress;Hostname;NamedAddress -type GatewayAddressType string +type AddressType string const ( // A textual representation of a numeric IP address. IPv4 @@ -484,7 +482,7 @@ const ( // IPAddress). // // Support: Extended - IPAddressType GatewayAddressType = "IPAddress" + IPAddressType AddressType = "IPAddress" // A Hostname represents a DNS based ingress point. This is similar to the // corresponding hostname field in Kubernetes load balancer status. For @@ -492,14 +490,14 @@ const ( // name is used to expose a load balancer. // // Support: Extended - HostnameAddressType GatewayAddressType = "Hostname" + HostnameAddressType AddressType = "Hostname" // A NamedAddress provides a way to reference a specific IP address by name. // For example, this may be a name or other unique identifier that refers // to a resource on a cloud provider such as a static IP. // // Support: Implementation-Specific - NamedAddressType GatewayAddressType = "NamedAddress" + NamedAddressType AddressType = "NamedAddress" ) // GatewayStatus defines the observed state of Gateway. diff --git a/apis/v1alpha2/shared_types.go b/apis/v1alpha2/shared_types.go index 19f7e3524c..008547b8ec 100644 --- a/apis/v1alpha2/shared_types.go +++ b/apis/v1alpha2/shared_types.go @@ -437,7 +437,7 @@ type NetworkAddress struct { // Support: Custom (NamedAddress) // // +optional - Type *NetworkAddressType `json:"type,omitempty"` + Type *AddressType `json:"type,omitempty"` // Value of the address. The validity of the values will depend // on the type and support by the controller. @@ -455,9 +455,3 @@ type NetworkAddress struct { // +kubebuilder:validation:MaxLength=253 Value string `json:"value"` } - -// NetworkAddressType defines how a network address is represented as a text string. -// -// +kubebuilder:validation:Enum=IPAddress;NamedAddress -// +kubebuilder:default=IPAddress -type NetworkAddressType string diff --git a/apis/v1alpha2/zz_generated.deepcopy.go b/apis/v1alpha2/zz_generated.deepcopy.go index 0d688c46b5..e3b1dff70a 100644 --- a/apis/v1alpha2/zz_generated.deepcopy.go +++ b/apis/v1alpha2/zz_generated.deepcopy.go @@ -188,7 +188,7 @@ func (in *GatewayAddress) DeepCopyInto(out *GatewayAddress) { *out = *in if in.Type != nil { in, out := &in.Type, &out.Type - *out = new(GatewayAddressType) + *out = new(AddressType) **out = **in } } @@ -970,7 +970,7 @@ func (in *NetworkAddress) DeepCopyInto(out *NetworkAddress) { *out = *in if in.Type != nil { in, out := &in.Type, &out.Type - *out = new(NetworkAddressType) + *out = new(AddressType) **out = **in } } diff --git a/config/crd/experimental/gateway.networking.k8s.io_tcproutes.yaml b/config/crd/experimental/gateway.networking.k8s.io_tcproutes.yaml index e972986ebd..42a7b36a6a 100644 --- a/config/crd/experimental/gateway.networking.k8s.io_tcproutes.yaml +++ b/config/crd/experimental/gateway.networking.k8s.io_tcproutes.yaml @@ -220,7 +220,8 @@ spec: type: array matches: description: Matches are rules for routing traffic to backends - based on addresses. + based on addresses. Each match is independent, i.e. this rule + will be matched if **any** one of the matches is satisfied. items: description: AddressRouteMatch defines NetworkAddress rules for inbound traffic according to source and/or destination @@ -244,6 +245,7 @@ spec: (IPAddress) Support: Custom (NamedAddress)" enum: - IPAddress + - Hostname - NamedAddress type: string value: @@ -276,6 +278,7 @@ spec: (IPAddress) Support: Custom (NamedAddress)" enum: - IPAddress + - Hostname - NamedAddress type: string value: diff --git a/config/crd/experimental/gateway.networking.k8s.io_udproutes.yaml b/config/crd/experimental/gateway.networking.k8s.io_udproutes.yaml index e1056c68f6..577356c2b6 100644 --- a/config/crd/experimental/gateway.networking.k8s.io_udproutes.yaml +++ b/config/crd/experimental/gateway.networking.k8s.io_udproutes.yaml @@ -220,7 +220,8 @@ spec: type: array matches: description: Matches add rules for filtering traffic to backends - based on addresses. + based on addresses. Each match is independent, i.e. this rule + will be matched if **any** one of the matches is satisfied. items: description: AddressRouteMatch defines NetworkAddress rules for inbound traffic according to source and/or destination @@ -244,6 +245,7 @@ spec: (IPAddress) Support: Custom (NamedAddress)" enum: - IPAddress + - Hostname - NamedAddress type: string value: @@ -276,6 +278,7 @@ spec: (IPAddress) Support: Custom (NamedAddress)" enum: - IPAddress + - Hostname - NamedAddress type: string value: diff --git a/config/crd/stable/gateway.networking.k8s.io_tcproutes.yaml b/config/crd/stable/gateway.networking.k8s.io_tcproutes.yaml index 07e63e848a..54a37370f9 100644 --- a/config/crd/stable/gateway.networking.k8s.io_tcproutes.yaml +++ b/config/crd/stable/gateway.networking.k8s.io_tcproutes.yaml @@ -220,7 +220,8 @@ spec: type: array matches: description: Matches are rules for routing traffic to backends - based on addresses. + based on addresses. Each match is independent, i.e. this rule + will be matched if **any** one of the matches is satisfied. items: description: AddressRouteMatch defines NetworkAddress rules for inbound traffic according to source and/or destination @@ -244,6 +245,7 @@ spec: (IPAddress) Support: Custom (NamedAddress)" enum: - IPAddress + - Hostname - NamedAddress type: string value: @@ -276,6 +278,7 @@ spec: (IPAddress) Support: Custom (NamedAddress)" enum: - IPAddress + - Hostname - NamedAddress type: string value: diff --git a/config/crd/stable/gateway.networking.k8s.io_udproutes.yaml b/config/crd/stable/gateway.networking.k8s.io_udproutes.yaml index 0b216b9ec3..b8e0e8a6ed 100644 --- a/config/crd/stable/gateway.networking.k8s.io_udproutes.yaml +++ b/config/crd/stable/gateway.networking.k8s.io_udproutes.yaml @@ -220,7 +220,8 @@ spec: type: array matches: description: Matches add rules for filtering traffic to backends - based on addresses. + based on addresses. Each match is independent, i.e. this rule + will be matched if **any** one of the matches is satisfied. items: description: AddressRouteMatch defines NetworkAddress rules for inbound traffic according to source and/or destination @@ -244,6 +245,7 @@ spec: (IPAddress) Support: Custom (NamedAddress)" enum: - IPAddress + - Hostname - NamedAddress type: string value: @@ -276,6 +278,7 @@ spec: (IPAddress) Support: Custom (NamedAddress)" enum: - IPAddress + - Hostname - NamedAddress type: string value: diff --git a/examples/v1alpha2/traffic-matching-tcp.yaml b/examples/v1alpha2/traffic-matching-tcp.yaml index 0d5095640a..a9d2154083 100644 --- a/examples/v1alpha2/traffic-matching-tcp.yaml +++ b/examples/v1alpha2/traffic-matching-tcp.yaml @@ -6,10 +6,13 @@ spec: rules: - matches: - sourceAddresses: - - value: "192.168.1.1" - - value: "FE80::0202:B3FF:FE1E:8329" + value: "192.168.1.1" destinationAddresses: - - value: "10.96.0.1" + value: "10.96.0.1" + - sourceAddresses: + value: "FE80::0202:B3FF:FE1E:8329" + destinationAddresses: + value: "10.96.0.1" backendRefs: - name: my-service port: 8080