Skip to content

Commit 7cba6b9

Browse files
zac-nixonniclask25
authored and
niclask25
committed
[feat: gw api] subnet discovery that works for both ALB / NLB
1 parent 93a600d commit 7cba6b9

22 files changed

+2085
-184
lines changed

apis/gateway/v1beta1/loadbalancerconfig_types.go

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,6 @@ const (
2626
LoadBalancerIpAddressTypeDualstackWithoutPublicIpv4 LoadBalancerIpAddressType = "dualstack-without-public-ipv4"
2727
)
2828

29-
// +kubebuilder:validation:Enum=on;off
30-
// EnablePrefixForIpv6SourceNatEnum defines the enum values for EnablePrefixForIpv6SourceNat
31-
type EnablePrefixForIpv6SourceNatEnum string
32-
33-
const (
34-
EnablePrefixForIpv6SourceNatEnumOn EnablePrefixForIpv6SourceNatEnum = "on"
35-
EnablePrefixForIpv6SourceNatEnumOff EnablePrefixForIpv6SourceNatEnum = "off"
36-
)
37-
3829
// LoadBalancerAttribute defines LB attribute.
3930
type LoadBalancerAttribute struct {
4031
// The key of the attribute.
@@ -64,20 +55,25 @@ type LoadBalancerTag struct {
6455

6556
// SubnetConfiguration defines the subnet settings for a Load Balancer.
6657
type SubnetConfiguration struct {
67-
// identifier name or id for the subnet
58+
// identifier [Application LoadBalancer / Network LoadBalancer] name or id for the subnet
59+
// +optional
6860
Identifier string `json:"identifier"`
6961

70-
// eipAllocation the EIP name for this subnet.
62+
// eipAllocation [Network LoadBalancer] the EIP name for this subnet.
7163
// +optional
7264
EIPAllocation *string `json:"eipAllocation,omitempty"`
7365

74-
// privateIPv4Allocation the private ipv4 address to assign to this subnet.
66+
// privateIPv4Allocation [Network LoadBalancer] the private ipv4 address to assign to this subnet.
7567
// +optional
7668
PrivateIPv4Allocation *string `json:"privateIPv4Allocation,omitempty"`
7769

78-
// privateIPv6Allocation the private ipv6 address to assign to this subnet.
70+
// IPv6Allocation [Network LoadBalancer] the ipv6 address to assign to this subnet.
7971
// +optional
80-
PrivateIPv6Allocation *string `json:"privateIPv6Allocation,omitempty"`
72+
IPv6Allocation *string `json:"ipv6Allocation,omitempty"`
73+
74+
// SourceNatIPv6Prefix [Network LoadBalancer] The IPv6 prefix to use for source NAT. Specify an IPv6 prefix (/80 netmask) from the subnet CIDR block or auto_assigned to use an IPv6 prefix selected at random from the subnet CIDR block.
75+
// +optional
76+
SourceNatIPv6Prefix *string `json:"sourceNatIPv6Prefix,omitempty"`
8177
}
8278

8379
// +kubebuilder:validation:Enum=HTTP1Only;HTTP2Only;HTTP2Optional;HTTP2Preferred;None
@@ -183,10 +179,6 @@ type LoadBalancerConfigurationSpec struct {
183179
// +optional
184180
IpAddressType *LoadBalancerIpAddressType `json:"ipAddressType,omitempty"`
185181

186-
// enablePrefixForIpv6SourceNat indicates whether to use an IPv6 prefix from each subnet for source NAT for Network Load Balancers with UDP listeners.
187-
// +optional
188-
EnablePrefixForIpv6SourceNat *EnablePrefixForIpv6SourceNatEnum `json:"enablePrefixForIpv6SourceNat,omitempty"`
189-
190182
// enforceSecurityGroupInboundRulesOnPrivateLinkTraffic Indicates whether to evaluate inbound security group rules for traffic sent to a Network Load Balancer through Amazon Web Services PrivateLink.
191183
// +optional
192184
EnforceSecurityGroupInboundRulesOnPrivateLinkTraffic *string `json:"enforceSecurityGroupInboundRulesOnPrivateLinkTraffic,omitempty"`
@@ -196,9 +188,16 @@ type LoadBalancerConfigurationSpec struct {
196188
CustomerOwnedIpv4Pool *string `json:"customerOwnedIpv4Pool,omitempty"`
197189

198190
// loadBalancerSubnets is an optional list of subnet configurations to be used in the LB
191+
// This value takes precedence over loadBalancerSubnetsSelector if both are selected.
199192
// +optional
200193
LoadBalancerSubnets *[]SubnetConfiguration `json:"loadBalancerSubnets,omitempty"`
201194

195+
// LoadBalancerSubnetsSelector specifies subnets in the load balancer's VPC where each
196+
// tag specified in the map key contains one of the values in the corresponding
197+
// value list.
198+
// +optional
199+
LoadBalancerSubnetsSelector *map[string][]string `json:"loadBalancerSubnetsSelector,omitempty"`
200+
202201
// listenerConfigurations is an optional list of configurations for each listener on LB
203202
// +optional
204203
ListenerConfigurations *[]ListenerConfiguration `json:"listenerConfigurations,omitempty"`

apis/gateway/v1beta1/zz_generated.deepcopy.go

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

config/crd/gateway/gateway-crds.yaml

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,6 @@ spec:
4848
description: customerOwnedIpv4Pool is the ID of the customer-owned
4949
address for Application Load Balancers on Outposts pool.
5050
type: string
51-
enablePrefixForIpv6SourceNat:
52-
description: enablePrefixForIpv6SourceNat indicates whether to use
53-
an IPv6 prefix from each subnet for source NAT for Network Load
54-
Balancers with UDP listeners.
55-
enum:
56-
- "on"
57-
- "off"
58-
type: string
5951
enforceSecurityGroupInboundRulesOnPrivateLinkTraffic:
6052
description: enforceSecurityGroupInboundRulesOnPrivateLinkTraffic
6153
Indicates whether to evaluate inbound security group rules for traffic
@@ -178,30 +170,48 @@ spec:
178170
minLength: 1
179171
type: string
180172
loadBalancerSubnets:
181-
description: loadBalancerSubnets is an optional list of subnet configurations
182-
to be used in the LB
173+
description: |-
174+
loadBalancerSubnets is an optional list of subnet configurations to be used in the LB
175+
This value takes precedence over loadBalancerSubnetsSelector if both are selected.
183176
items:
184177
description: SubnetConfiguration defines the subnet settings for
185178
a Load Balancer.
186179
properties:
187180
eipAllocation:
188-
description: eipAllocation the EIP name for this subnet.
181+
description: eipAllocation [Network LoadBalancer] the EIP name
182+
for this subnet.
189183
type: string
190184
identifier:
191-
description: identifier name or id for the subnet
185+
description: identifier [Application LoadBalancer / Network
186+
LoadBalancer] name or id for the subnet
187+
type: string
188+
ipv6Allocation:
189+
description: IPv6Allocation [Network LoadBalancer] the ipv6
190+
address to assign to this subnet.
192191
type: string
193192
privateIPv4Allocation:
194-
description: privateIPv4Allocation the private ipv4 address
195-
to assign to this subnet.
193+
description: privateIPv4Allocation [Network LoadBalancer] the
194+
private ipv4 address to assign to this subnet.
196195
type: string
197-
privateIPv6Allocation:
198-
description: privateIPv6Allocation the private ipv6 address
199-
to assign to this subnet.
196+
sourceNatIPv6Prefix:
197+
description: SourceNatIPv6Prefix [Network LoadBalancer] The
198+
IPv6 prefix to use for source NAT. Specify an IPv6 prefix
199+
(/80 netmask) from the subnet CIDR block or auto_assigned
200+
to use an IPv6 prefix selected at random from the subnet CIDR
201+
block.
200202
type: string
201-
required:
202-
- identifier
203203
type: object
204204
type: array
205+
loadBalancerSubnetsSelector:
206+
additionalProperties:
207+
items:
208+
type: string
209+
type: array
210+
description: |-
211+
LoadBalancerSubnetsSelector specifies subnets in the load balancer's VPC where each
212+
tag specified in the map key contains one of the values in the corresponding
213+
value list.
214+
type: object
205215
scheme:
206216
description: scheme defines the type of LB to provision. If unspecified,
207217
it will be automatically inferred.

config/crd/gateway/gateway.k8s.aws_loadbalancerconfigurations.yaml

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,6 @@ spec:
4949
description: customerOwnedIpv4Pool is the ID of the customer-owned
5050
address for Application Load Balancers on Outposts pool.
5151
type: string
52-
enablePrefixForIpv6SourceNat:
53-
description: enablePrefixForIpv6SourceNat indicates whether to use
54-
an IPv6 prefix from each subnet for source NAT for Network Load
55-
Balancers with UDP listeners.
56-
enum:
57-
- "on"
58-
- "off"
59-
type: string
6052
enforceSecurityGroupInboundRulesOnPrivateLinkTraffic:
6153
description: enforceSecurityGroupInboundRulesOnPrivateLinkTraffic
6254
Indicates whether to evaluate inbound security group rules for traffic
@@ -179,30 +171,48 @@ spec:
179171
minLength: 1
180172
type: string
181173
loadBalancerSubnets:
182-
description: loadBalancerSubnets is an optional list of subnet configurations
183-
to be used in the LB
174+
description: |-
175+
loadBalancerSubnets is an optional list of subnet configurations to be used in the LB
176+
This value takes precedence over loadBalancerSubnetsSelector if both are selected.
184177
items:
185178
description: SubnetConfiguration defines the subnet settings for
186179
a Load Balancer.
187180
properties:
188181
eipAllocation:
189-
description: eipAllocation the EIP name for this subnet.
182+
description: eipAllocation [Network LoadBalancer] the EIP name
183+
for this subnet.
190184
type: string
191185
identifier:
192-
description: identifier name or id for the subnet
186+
description: identifier [Application LoadBalancer / Network
187+
LoadBalancer] name or id for the subnet
188+
type: string
189+
ipv6Allocation:
190+
description: IPv6Allocation [Network LoadBalancer] the ipv6
191+
address to assign to this subnet.
193192
type: string
194193
privateIPv4Allocation:
195-
description: privateIPv4Allocation the private ipv4 address
196-
to assign to this subnet.
194+
description: privateIPv4Allocation [Network LoadBalancer] the
195+
private ipv4 address to assign to this subnet.
197196
type: string
198-
privateIPv6Allocation:
199-
description: privateIPv6Allocation the private ipv6 address
200-
to assign to this subnet.
197+
sourceNatIPv6Prefix:
198+
description: SourceNatIPv6Prefix [Network LoadBalancer] The
199+
IPv6 prefix to use for source NAT. Specify an IPv6 prefix
200+
(/80 netmask) from the subnet CIDR block or auto_assigned
201+
to use an IPv6 prefix selected at random from the subnet CIDR
202+
block.
201203
type: string
202-
required:
203-
- identifier
204204
type: object
205205
type: array
206+
loadBalancerSubnetsSelector:
207+
additionalProperties:
208+
items:
209+
type: string
210+
type: array
211+
description: |-
212+
LoadBalancerSubnetsSelector specifies subnets in the load balancer's VPC where each
213+
tag specified in the map key contains one of the values in the corresponding
214+
value list.
215+
type: object
206216
scheme:
207217
description: scheme defines the type of LB to provision. If unspecified,
208218
it will be automatically inferred.

0 commit comments

Comments
 (0)