mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
fix(elbv2): publish resolvable local ALB DNS names (#1492)
This commit is contained in:
1 parent
113c7d7e7d
commit
94468ba56f
5 files changed
+48
-4
No files matched your search
@@ -1,9 +1,11 @@
|
||||
package io.github.hectorvent.floci.services.elbv2;
|
||||
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import io.github.hectorvent.floci.config.EmulatorConfig;
|
||||
import io.github.hectorvent.floci.core.common.AwsArnUtils;
|
||||
import io.github.hectorvent.floci.core.common.AwsException;
|
||||
import io.github.hectorvent.floci.core.common.RegionResolver;
|
||||
import io.github.hectorvent.floci.core.common.dns.EmbeddedDnsServer;
|
||||
import io.github.hectorvent.floci.core.storage.StorageBackedMap;
|
||||
import io.github.hectorvent.floci.core.storage.StorageFactory;
|
||||
import io.github.hectorvent.floci.services.ec2.Ec2Service;
|
||||
@@ -36,6 +38,9 @@ public class ElbV2Service {
|
||||
@Inject
|
||||
StorageFactory storageFactory;
|
||||
|
||||
@Inject
|
||||
EmulatorConfig config;
|
||||
|
||||
private static final String CANONICAL_HOSTED_ZONE_ID = "Z35SXDOTRQ7X7K";
|
||||
|
||||
// region → ARN → resource
|
||||
@@ -157,7 +162,7 @@ public class ElbV2Service {
|
||||
String typePrefix = lbTypePrefix(lbType);
|
||||
String id = randomHex16();
|
||||
String arn = AwsArnUtils.Arn.of("elasticloadbalancing", region, regionResolver.getAccountId(), "loadbalancer/" + typePrefix + "/" + name + "/" + id).toString();
|
||||
String dnsName = name + "-" + id + ".elb.localhost";
|
||||
String dnsName = name + "-" + id + ".elb." + loadBalancerDnsSuffix();
|
||||
String vpcId = resolveSubnetVpcId(region, lbType, subnets);
|
||||
|
||||
LoadBalancer lb = new LoadBalancer();
|
||||
@@ -184,6 +189,13 @@ public class ElbV2Service {
|
||||
return lb;
|
||||
}
|
||||
|
||||
private String loadBalancerDnsSuffix() {
|
||||
if (config == null) {
|
||||
return EmbeddedDnsServer.DEFAULT_SUFFIX;
|
||||
}
|
||||
return config.hostname().orElse(EmbeddedDnsServer.DEFAULT_SUFFIX);
|
||||
}
|
||||
|
||||
public List<LoadBalancer> describeLoadBalancers(String region, List<String> arns, List<String> names,
|
||||
String marker, Integer pageSize) {
|
||||
Map<String, LoadBalancer> regionLbs = loadBalancers.getOrDefault(region, Map.of());
|
||||
|
||||
Reference in new issue
Block a user