Skip to content

Commit 060b8d1

Browse files
authored
chore: remove udp and tcp_udp for LBWS (#3224)
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the Apache 2.0 License.
1 parent 7dfd222 commit 060b8d1

File tree

5 files changed

+12
-27
lines changed

5 files changed

+12
-27
lines changed

internal/pkg/cli/svc_deploy_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ func TestSvcDeployOpts_deploySvc(t *testing.T) {
645645
"fail to get public CIDR blocks": {
646646
inBuildRequire: false,
647647
inNLB: manifest.NetworkLoadBalancerConfiguration{
648-
Port: aws.String("443/udp"),
648+
Port: aws.String("443/tls"),
649649
},
650650
inEnvironment: &config.Environment{
651651
Name: mockEnvName,

internal/pkg/deploy/cloudformation/stack/transformers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const (
3434
defaultIAM = disabled
3535
defaultReadOnly = true
3636
defaultWritePermission = false
37-
defaultNLBProtocol = manifest.TCPUDP
37+
defaultNLBProtocol = manifest.TCP
3838
)
3939

4040
// Supported capacityproviders for Fargate services

internal/pkg/manifest/validate.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,11 @@ const (
3333
)
3434

3535
const (
36-
TCPUDP = "TCP_UDP"
37-
tcp = "TCP"
38-
udp = "UDP"
39-
tls = "TLS"
36+
TCP = "TCP"
37+
tls = "TLS"
4038
)
4139

42-
var validProtocols = []string{TCPUDP, tcp, udp, tls}
40+
var validProtocols = []string{TCP, tls}
4341

4442
var (
4543
intRangeBandRegexp = regexp.MustCompile(`^(\d+)-(\d+)$`)
@@ -671,7 +669,7 @@ func validateNLBPort(port *string) error {
671669
}
672670
}
673671
if !isValidProtocol {
674-
return fmt.Errorf(`unrecognized protocol %s`, protocolVal)
672+
return fmt.Errorf(`invalid protocol %s; valid protocols include %s`, protocolVal, english.WordSeries(validProtocols, "and"))
675673
}
676674
return nil
677675
}

internal/pkg/manifest/validate_test.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1102,32 +1102,34 @@ func TestNetworkLoadBalancerConfiguration_Validate(t *testing.T) {
11021102
Port: aws.String("443"),
11031103
},
11041104
},
1105-
"error if protocol is not recognized": {
1105+
"fail if protocol is not recognized": {
11061106
nlb: NetworkLoadBalancerConfiguration{
11071107
Port: aws.String("443/tps"),
11081108
},
11091109
wantedErrorMsgPrefix: `validate "nlb": `,
1110-
wantedError: fmt.Errorf(`validate "port": unrecognized protocol tps`),
1110+
wantedError: fmt.Errorf(`validate "port": invalid protocol tps; valid protocols include TCP and TLS`),
11111111
},
11121112
"success if tcp": {
11131113
nlb: NetworkLoadBalancerConfiguration{
11141114
Port: aws.String("443/tcp"),
11151115
},
11161116
},
1117-
"success if udp": {
1117+
"error if udp": {
11181118
nlb: NetworkLoadBalancerConfiguration{
11191119
Port: aws.String("161/udp"),
11201120
},
1121+
wantedError: fmt.Errorf(`validate "port": invalid protocol udp; valid protocols include TCP and TLS`),
11211122
},
11221123
"success if tls": {
11231124
nlb: NetworkLoadBalancerConfiguration{
11241125
Port: aws.String("443/tls"),
11251126
},
11261127
},
1127-
"success if tcp_udp": {
1128+
"error if tcp_udp": {
11281129
nlb: NetworkLoadBalancerConfiguration{
11291130
Port: aws.String("443/TCP_udp"),
11301131
},
1132+
wantedError: fmt.Errorf(`validate "port": invalid protocol TCP_udp; valid protocols include TCP and TLS`),
11311133
},
11321134
}
11331135

internal/pkg/template/templates/workloads/partials/cf/nlb.yml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ NLBTargetGroup:
5757
Value: {{ .NLB.Listener.Stickiness }}
5858
{{- end}}
5959
{{- end}}
60-
- Key: deregistration_delay.connection_termination.enabled {{/* It is recommended to have this enabled for UDP and TCP_UDP target groups */}}
61-
Value: {{- if or (eq $.NLB.Listener.Protocol "UDP") (eq $.NLB.Listener.Protocol "TCP_UDP") }} true {{- else}} false {{- end}}
6260
TargetType: ip
6361
VpcId:
6462
Fn::ImportValue:
@@ -72,24 +70,11 @@ NLBSecurityGroup:
7270
GroupDescription: Allow access from the network load balancer to service
7371
SecurityGroupIngress:
7472
{{range $cidr := .NLB.PublicSubnetCIDRs}}
75-
{{- if eq $.NLB.Listener.Protocol "TCP_UDP" }}
76-
- CidrIp: {{$cidr}}
77-
Description: Ingress to allow access from Network Load Balancer subnet
78-
FromPort: {{ $.NLB.Listener.TargetPort }}
79-
IpProtocol: TCP
80-
ToPort: {{ $.NLB.Listener.TargetPort }}
81-
- CidrIp: {{$cidr}}
82-
Description: Ingress to allow access from Network Load Balancer subnet
83-
FromPort: {{ $.NLB.Listener.TargetPort }}
84-
IpProtocol: UDP
85-
ToPort: {{ $.NLB.Listener.TargetPort }}
86-
{{- else }}
8773
- CidrIp: {{$cidr}}
8874
Description: Ingress to allow access from Network Load Balancer subnet
8975
FromPort: {{ $.NLB.Listener.TargetPort }}
9076
IpProtocol: {{- if eq $.NLB.Listener.Protocol "TLS" }} TCP {{- else }} {{ $.NLB.Listener.Protocol }} {{- end}}
9177
ToPort: {{ $.NLB.Listener.TargetPort }}
92-
{{- end }}
9378
{{- if $.NLB.Listener.HealthCheck.Port}}{{- if ne $.NLB.Listener.HealthCheck.Port $.NLB.Listener.Port}}
9479
- CidrIp: {{$cidr}}
9580
Description: Ingress to allow access from Network Load Balancer subnet for health check

0 commit comments

Comments
 (0)