mirror of
https://github.com/floci-io/floci.git
synced 2026-11-27 07:39:24 -05:00
fix: reject explicit ports on gateway load balancer listeners (#6462)
Reject explicit gateway listener ports before publication or mutation, preserving listener range validation and omitted-port updates. Signed-off-by: Andre Kurait <AndreKurait@gmail.com>
This commit is contained in:
1 parent
fad23ae0b9
commit
fe9dce4061
4 files changed
+100
-1
No files matched your search
@@ -604,7 +604,7 @@ public class ElbV2Service implements ResourceProvider, ServerCertificateReferenc
|
||||
List<Action> defaultActions, List<String> alpnPolicy,
|
||||
Map<String, String> initialTags) {
|
||||
validatePort(port, "port");
|
||||
requireLoadBalancer(region, lbArn);
|
||||
requireGatewayListenerPort(requireLoadBalancer(region, lbArn), port);
|
||||
|
||||
Map<String, Listener> regionListeners = listeners.computeIfAbsent(region, k -> new ConcurrentHashMap<>());
|
||||
|
||||
@@ -747,6 +747,7 @@ public class ElbV2Service implements ResourceProvider, ServerCertificateReferenc
|
||||
while (true) {
|
||||
Listener initial = requireListener(region, listenerArn);
|
||||
LoadBalancer initialLb = requireLoadBalancer(region, initial.getLoadBalancerArn());
|
||||
requireGatewayListenerPort(initialLb, port);
|
||||
ListenerState initialState = listenerState(initial, initialLb);
|
||||
requireAvailableListenerPort(listeners.getOrDefault(region, Map.of()), initial.getLoadBalancerArn(),
|
||||
listenerArn, port != null ? port : initialState.port());
|
||||
@@ -1229,6 +1230,13 @@ public class ElbV2Service implements ResourceProvider, ServerCertificateReferenc
|
||||
}
|
||||
}
|
||||
|
||||
private static void requireGatewayListenerPort(LoadBalancer loadBalancer, Integer port) {
|
||||
if (port != null && "gateway".equals(loadBalancer.getType())) {
|
||||
throw new AwsException("InvalidConfigurationRequest",
|
||||
"You can't specify a port for a Gateway Load Balancer.", 400);
|
||||
}
|
||||
}
|
||||
|
||||
private void requireCompatibleListenerProtocol(String listenerArn, Integer port, String protocol) {
|
||||
if (port == null) {
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user