From 4e45bca990ca47af41f3ba20535c17c22ac38d5e Mon Sep 17 00:00:00 2001 From: Harald Musum Date: Tue, 22 Sep 2020 14:49:18 +0200 Subject: Use feature flag use-config-server-vip --- .../vespa/hosted/controller/restapi/zone/v2/ZoneApiHandler.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'controller-server/src') diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/zone/v2/ZoneApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/zone/v2/ZoneApiHandler.java index 7c44ae6d1a5..f5e6354da05 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/zone/v2/ZoneApiHandler.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/zone/v2/ZoneApiHandler.java @@ -11,6 +11,8 @@ import com.yahoo.restapi.Path; import com.yahoo.restapi.SlimeJsonResponse; import com.yahoo.slime.Cursor; import com.yahoo.slime.Slime; +import com.yahoo.vespa.flags.BooleanFlag; +import com.yahoo.vespa.flags.Flags; import com.yahoo.vespa.hosted.controller.Controller; import com.yahoo.vespa.hosted.controller.api.integration.ServiceRegistry; import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneRegistry; @@ -33,12 +35,14 @@ public class ZoneApiHandler extends AuditLoggingRequestHandler { private final ZoneRegistry zoneRegistry; private final ConfigServerRestExecutor proxy; + private final BooleanFlag useConfigServerVip; public ZoneApiHandler(LoggingRequestHandler.Context parentCtx, ServiceRegistry serviceRegistry, ConfigServerRestExecutor proxy, Controller controller) { super(parentCtx, controller.auditLogger()); this.zoneRegistry = serviceRegistry.zoneRegistry(); this.proxy = proxy; + this.useConfigServerVip = Flags.USE_CONFIG_SERVER_VIP.bindTo(controller.flagSource()); } @Override @@ -108,8 +112,8 @@ public class ZoneApiHandler extends AuditLoggingRequestHandler { } private ProxyRequest proxyRequest(ZoneId zoneId, String path, HttpRequest request) { - // TODO: Use config server VIP for all zones that have one - if (zoneId.region().value().startsWith("aws-") || zoneId.region().value().contains("-aws-")) { + // TODO: Still need to hardcode AWS since flag cannot be set until flag has been rolled out + if (zoneId.region().value().startsWith("aws-") || useConfigServerVip.value()) { return ProxyRequest.tryOne(zoneRegistry.getConfigServerVipUri(zoneId), path, request); } return ProxyRequest.tryAll(zoneRegistry.getConfigServerUris(zoneId), path, request); -- cgit v1.2.3