summaryrefslogtreecommitdiffstats
path: root/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/RoutingController.java
diff options
context:
space:
mode:
authorMartin Polden <mpolden@mpolden.no>2021-11-26 14:22:34 +0100
committerMartin Polden <mpolden@mpolden.no>2021-11-26 14:22:34 +0100
commite7f7f093676628e766d96564b69c11e4fc5f4553 (patch)
tree426faef673f95f130cebe6ba7719aef52745882d /controller-server/src/main/java/com/yahoo/vespa/hosted/controller/RoutingController.java
parentf09dd864789053767d31549cd9d0804514eebe6b (diff)
Remove ineffectual and unnecessary optional wrapping
Diffstat (limited to 'controller-server/src/main/java/com/yahoo/vespa/hosted/controller/RoutingController.java')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/RoutingController.java30
1 files changed, 14 insertions, 16 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/RoutingController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/RoutingController.java
index 1e3573091f2..6ef0df9f099 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/RoutingController.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/RoutingController.java
@@ -274,22 +274,20 @@ public class RoutingController {
}
// Register names in DNS
- Optional<Rotation> rotation = rotationRepository.getRotation(assignedRotation.rotationId());
- if (rotation.isPresent()) {
- for (var endpoint : rotationEndpoints) {
- controller.nameServiceForwarder().createCname(RecordName.from(endpoint.dnsName()),
- RecordData.fqdn(rotation.get().name()),
- Priority.normal);
- List<String> names = List.of(endpoint.dnsName(),
- // Include rotation ID as a valid name of this container endpoint
- // (required by global routing health checks)
- assignedRotation.rotationId().asString());
- containerEndpoints.add(new ContainerEndpoint(assignedRotation.clusterId().value(),
- asString(Endpoint.Scope.global),
- names,
- OptionalInt.empty(),
- endpoint.routingMethod()));
- }
+ Rotation rotation = rotationRepository.requireRotation(assignedRotation.rotationId());
+ for (var endpoint : rotationEndpoints) {
+ controller.nameServiceForwarder().createCname(RecordName.from(endpoint.dnsName()),
+ RecordData.fqdn(rotation.name()),
+ Priority.normal);
+ List<String> names = List.of(endpoint.dnsName(),
+ // Include rotation ID as a valid name of this container endpoint
+ // (required by global routing health checks)
+ assignedRotation.rotationId().asString());
+ containerEndpoints.add(new ContainerEndpoint(assignedRotation.clusterId().value(),
+ asString(Endpoint.Scope.global),
+ names,
+ OptionalInt.empty(),
+ endpoint.routingMethod()));
}
}
// Add endpoints not backed by a rotation (i.e. other routing methods so that the config server always knows