summaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2023-07-13 09:42:57 +0200
committerMartin Polden <mpolden@mpolden.no>2023-07-13 09:42:57 +0200
commitff24c1aa0e15597c1b610b26ee2d8d4f9ee61cb3 (patch)
tree4c8336a3797d7a642b7f495e036c7b1e59f7be26 /controller-server
parent97f0cf32edba5e6545dc027cdcdaaec125bad37d (diff)
Remove DNS records for zones that use A records
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicies.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicies.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicies.java
index 66fb1fe615b..b35e8e5a638 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicies.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/RoutingPolicies.java
@@ -16,7 +16,6 @@ import com.yahoo.vespa.hosted.controller.api.integration.dns.AliasTarget;
import com.yahoo.vespa.hosted.controller.api.integration.dns.DirectTarget;
import com.yahoo.vespa.hosted.controller.api.integration.dns.LatencyAliasTarget;
import com.yahoo.vespa.hosted.controller.api.integration.dns.Record;
-import com.yahoo.vespa.hosted.controller.api.integration.dns.Record.Type;
import com.yahoo.vespa.hosted.controller.api.integration.dns.RecordData;
import com.yahoo.vespa.hosted.controller.api.integration.dns.RecordName;
import com.yahoo.vespa.hosted.controller.api.integration.dns.VpcEndpointService.ChallengeState;
@@ -395,8 +394,8 @@ public class RoutingPolicies {
RoutingMethod routingMethod = controller.zoneRegistry().routingMethod(deploymentId.zoneId());
boolean addTokenEndpoint = controller.routing().tokenEndpointEnabled(deploymentId.applicationId());
for (var endpoint : policy.zoneEndpointsIn(controller.system(), routingMethod, addTokenEndpoint)) {
- var name = RecordName.from(endpoint.dnsName());
- var record = policy.canonicalName().isPresent() ?
+ RecordName name = RecordName.from(endpoint.dnsName());
+ Record record = policy.canonicalName().isPresent() ?
new Record(Record.Type.CNAME, name, RecordData.fqdn(policy.canonicalName().get().value())) :
new Record(Record.Type.A, name, RecordData.from(policy.ipAddress().orElseThrow()));
nameServiceForwarder(endpoint).createRecord(record, Priority.normal, ownerOf(deploymentId));
@@ -458,7 +457,7 @@ public class RoutingPolicies {
}
private void removeDnsChallenge(DnsChallenge challenge) {
- controller.nameServiceForwarder().removeRecords(Type.TXT, challenge.name(), Priority.normal, ownerOf(challenge.clusterId().deploymentId()));
+ controller.nameServiceForwarder().removeRecords(Record.Type.TXT, challenge.name(), Priority.normal, ownerOf(challenge.clusterId().deploymentId()));
db.deleteDnsChallenge(challenge.clusterId());
}
@@ -476,7 +475,8 @@ public class RoutingPolicies {
.not().matching(policy -> activeIds.contains(policy.id()));
for (var policy : removable) {
for (var endpoint : policy.zoneEndpointsIn(controller.system(), routingMethod, addTokenEndpoint)) {
- nameServiceForwarder(endpoint).removeRecords(Record.Type.CNAME,
+ Record.Type type = policy.canonicalName().isPresent() ? Record.Type.CNAME : Record.Type.A;
+ nameServiceForwarder(endpoint).removeRecords(type,
RecordName.from(endpoint.dnsName()),
Priority.normal,
ownerOf(allocation));