summaryrefslogtreecommitdiffstats
path: root/controller-server/src/main
diff options
context:
space:
mode:
authorMorten Tokle <mortent@yahooinc.com>2023-09-29 14:36:38 +0200
committerGitHub <noreply@github.com>2023-09-29 14:36:38 +0200
commitb2a8b42f2bb85c8c1037c66798d68099d158bec5 (patch)
treef0d1edf050f6213a928fc124264db934ebaf8512 /controller-server/src/main
parenteb4d4bee35b5152f9b461f33e2467978d8486e24 (diff)
parent75d04deb315883c308e3a2b42cf41513e1f4ace3 (diff)
Merge pull request #28729 from vespa-engine/mpolden/legacy-endpoints-flag
Add flag for controlling presence of legacy endpoints
Diffstat (limited to 'controller-server/src/main')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/RoutingController.java30
1 files changed, 24 insertions, 6 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 8231040f7d8..b1ffce65852 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
@@ -82,7 +82,8 @@ public class RoutingController {
private final Controller controller;
private final RoutingPolicies routingPolicies;
private final RotationRepository rotationRepository;
- private final BooleanFlag randomizedEndpoints;
+ private final BooleanFlag generatedEndpoints;
+ private final BooleanFlag legacyEndpoints;
public RoutingController(Controller controller, RotationsConfig rotationsConfig) {
this.controller = Objects.requireNonNull(controller, "controller must be non-null");
@@ -90,7 +91,8 @@ public class RoutingController {
this.rotationRepository = new RotationRepository(Objects.requireNonNull(rotationsConfig, "rotationsConfig must be non-null"),
controller.applications(),
controller.curator());
- this.randomizedEndpoints = Flags.RANDOMIZED_ENDPOINT_NAMES.bindTo(controller.flagSource());
+ this.generatedEndpoints = Flags.RANDOMIZED_ENDPOINT_NAMES.bindTo(controller.flagSource());
+ this.legacyEndpoints = Flags.LEGACY_ENDPOINTS.bindTo(controller.flagSource());
}
/** Create a routing context for given deployment */
@@ -235,7 +237,7 @@ public class RoutingController {
}
}
}
- return EndpointList.copyOf(endpoints);
+ return filterEndpoints(deployment.applicationId(), EndpointList.copyOf(endpoints));
}
/** Read routing policies and return zone- and region-scoped endpoints for given deployment */
@@ -269,7 +271,7 @@ public class RoutingController {
endpoints.add(builder.generatedFrom(ge).authMethod(ge.authMethod()).in(controller.system()));
}
}
- return EndpointList.copyOf(endpoints);
+ return filterEndpoints(routingId.instance(), EndpointList.copyOf(endpoints));
}
/** Returns application endpoints pointing to given deployments */
@@ -425,6 +427,13 @@ public class RoutingController {
Optional.of(application.id())));
}
+ private EndpointList filterEndpoints(ApplicationId instance, EndpointList endpoints) {
+ if (generatedEndpointsEnabled(instance) && !legacyEndpointsEnabled(instance)) {
+ return endpoints.generated();
+ }
+ return endpoints;
+ }
+
private void registerRotationEndpointsInDns(PreparedEndpoints prepared) {
TenantAndApplicationId owner = TenantAndApplicationId.from(prepared.deployment().applicationId());
EndpointList globalEndpoints = prepared.endpoints().scope(Scope.global);
@@ -542,8 +551,17 @@ public class RoutingController {
}
public boolean generatedEndpointsEnabled(ApplicationId instance) {
- return randomizedEndpoints.with(FetchVector.Dimension.INSTANCE_ID, instance.serializedForm())
- .with(FetchVector.Dimension.TENANT_ID, instance.tenant().value()).value();
+ return generatedEndpoints.with(FetchVector.Dimension.INSTANCE_ID, instance.serializedForm())
+ .with(FetchVector.Dimension.TENANT_ID, instance.tenant().value())
+ .with(FetchVector.Dimension.APPLICATION_ID, TenantAndApplicationId.from(instance).serialized())
+ .value();
+ }
+
+ public boolean legacyEndpointsEnabled(ApplicationId instance) {
+ return legacyEndpoints.with(FetchVector.Dimension.INSTANCE_ID, instance.serializedForm())
+ .with(FetchVector.Dimension.TENANT_ID, instance.tenant().value())
+ .with(FetchVector.Dimension.APPLICATION_ID, TenantAndApplicationId.from(instance).serialized())
+ .value();
}
private static void requireGeneratedEndpoints(GeneratedEndpointList generatedEndpoints, boolean declared) {