From 9d8f687feb26c02f0c010c856d2e2506c451d9b1 Mon Sep 17 00:00:00 2001 From: HÃ¥kon Hallingstad Date: Mon, 14 Jan 2019 13:46:05 +0100 Subject: Remove healthmonitor-monitorinfra, dupermodel-contains-infra, dupermodel-use-configserverconfig, proxyhost-uses-real-orchestrator, and confighost-uses-real-orchestrator flags --- .../service/duper/ConfigServerApplication.java | 14 -------- .../vespa/service/duper/DuperModelManager.java | 41 +++------------------- .../vespa/service/health/HealthMonitorManager.java | 29 ++++----------- 3 files changed, 10 insertions(+), 74 deletions(-) (limited to 'service-monitor/src/main/java/com/yahoo') diff --git a/service-monitor/src/main/java/com/yahoo/vespa/service/duper/ConfigServerApplication.java b/service-monitor/src/main/java/com/yahoo/vespa/service/duper/ConfigServerApplication.java index 88c2c0d4469..91759b32086 100644 --- a/service-monitor/src/main/java/com/yahoo/vespa/service/duper/ConfigServerApplication.java +++ b/service-monitor/src/main/java/com/yahoo/vespa/service/duper/ConfigServerApplication.java @@ -1,16 +1,10 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.service.duper; -import com.yahoo.cloud.config.ConfigserverConfig; -import com.yahoo.config.model.api.ApplicationInfo; import com.yahoo.config.provision.ClusterSpec; -import com.yahoo.config.provision.HostName; import com.yahoo.config.provision.NodeType; import com.yahoo.vespa.applicationmodel.ServiceType; -import java.util.List; -import java.util.stream.Collectors; - /** * A service/application model of the config server with health status. */ @@ -21,12 +15,4 @@ public class ConfigServerApplication extends ConfigServerLikeApplication { public ConfigServerApplication() { super("zone-config-servers", NodeType.config, ClusterSpec.Type.admin, ServiceType.CONFIG_SERVER); } - - public ApplicationInfo makeApplicationInfoFromConfig(ConfigserverConfig config) { - List hostnames = config.zookeeperserver().stream() - .map(ConfigserverConfig.Zookeeperserver::hostname) - .map(HostName::from) - .collect(Collectors.toList()); - return makeApplicationInfo(hostnames); - } } diff --git a/service-monitor/src/main/java/com/yahoo/vespa/service/duper/DuperModelManager.java b/service-monitor/src/main/java/com/yahoo/vespa/service/duper/DuperModelManager.java index 57c206ee570..ce99126c481 100644 --- a/service-monitor/src/main/java/com/yahoo/vespa/service/duper/DuperModelManager.java +++ b/service-monitor/src/main/java/com/yahoo/vespa/service/duper/DuperModelManager.java @@ -11,7 +11,6 @@ import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.HostName; import com.yahoo.log.LogLevel; import com.yahoo.vespa.flags.FlagSource; -import com.yahoo.vespa.flags.Flags; import com.yahoo.vespa.service.monitor.DuperModelInfraApi; import com.yahoo.vespa.service.monitor.InfraApplicationApi; @@ -36,8 +35,7 @@ public class DuperModelManager implements DuperModelInfraApi { private final ProxyHostApplication proxyHostApplication = new ProxyHostApplication(); private final ControllerApplication controllerApplication = new ControllerApplication(); private final ControllerHostApplication controllerHostApplication = new ControllerHostApplication(); - // this must be static to be referenced in this(). Remove static once legacy config server from config is gone. - private static final ConfigServerApplication configServerApplication = new ConfigServerApplication(); + private final ConfigServerApplication configServerApplication = new ConfigServerApplication(); private final Map supportedInfraApplications = Stream.of( configServerApplication, @@ -47,8 +45,6 @@ public class DuperModelManager implements DuperModelInfraApi { controllerHostApplication) .collect(Collectors.toMap(InfraApplication::getApplicationId, Function.identity())); - private final boolean containsInfra; - private final boolean useConfigserverConfig; private final boolean multitenant; private final Object monitor = new Object(); @@ -58,31 +54,14 @@ public class DuperModelManager implements DuperModelInfraApi { @Inject public DuperModelManager(ConfigserverConfig configServerConfig, FlagSource flagSource, SuperModelProvider superModelProvider) { - this( - Flags.DUPERMODEL_CONTAINS_INFRA.bindTo(flagSource).value(), - Flags.DUPERMODEL_USE_CONFIGSERVERCONFIG.bindTo(flagSource).value(), - configServerConfig.multitenant(), - configServerApplication.makeApplicationInfoFromConfig(configServerConfig), - superModelProvider, - new DuperModel()); + this(configServerConfig.multitenant(), superModelProvider, new DuperModel()); } /** For testing */ - public DuperModelManager(boolean containsInfra, - boolean useConfigserverConfig, - boolean multitenant, - ApplicationInfo configServerApplicationInfoFromConfig, - SuperModelProvider superModelProvider, - DuperModel duperModel) { - this.containsInfra = containsInfra; - this.useConfigserverConfig = useConfigserverConfig; + public DuperModelManager(boolean multitenant, SuperModelProvider superModelProvider, DuperModel duperModel) { this.multitenant = multitenant; this.duperModel = duperModel; - if (isConfigServerFromConfigInDuperModel()) { - duperModel.add(configServerApplicationInfoFromConfig); - } - superModelProvider.registerListener(new SuperModelListener() { @Override public void applicationActivated(SuperModel superModel, ApplicationInfo application) { @@ -183,22 +162,11 @@ public class DuperModelManager implements DuperModelInfraApi { } } - private boolean isConfigServerFromConfigInDuperModel() { - return multitenant && useConfigserverConfig; - } - private boolean infraApplicationBelongsInDuperModel(ApplicationId applicationId) { - // At most 1 of the following 3 applications can be in the duper model: - // - config server built from ConfigserverConfig (legacy on both controller and config server) - // - config server - // - controller + // At most 1 of the config server and controller applications can be in the duper model. // The problem of allowing more than 1 is that orchestration will fail since hostname -> application lookup // will not be unique. - if (!containsInfra) { - return false; - } if (applicationId.equals(controllerApplication.getApplicationId())) { - if (isConfigServerFromConfigInDuperModel()) return false; if (!multitenant) return false; if (duperModel.contains(configServerApplication.getApplicationId())) { logger.log(LogLevel.ERROR, "Refusing to add controller application to duper model " + @@ -207,7 +175,6 @@ public class DuperModelManager implements DuperModelInfraApi { } return true; } else if (applicationId.equals(configServerApplication.getApplicationId())) { - if (isConfigServerFromConfigInDuperModel()) return false; if (!multitenant) return false; if (duperModel.contains(controllerApplication.getApplicationId())) { logger.log(LogLevel.ERROR, "Refusing to add config server application to duper model " + diff --git a/service-monitor/src/main/java/com/yahoo/vespa/service/health/HealthMonitorManager.java b/service-monitor/src/main/java/com/yahoo/vespa/service/health/HealthMonitorManager.java index 682f677a626..71938a9f1dc 100644 --- a/service-monitor/src/main/java/com/yahoo/vespa/service/health/HealthMonitorManager.java +++ b/service-monitor/src/main/java/com/yahoo/vespa/service/health/HealthMonitorManager.java @@ -8,9 +8,7 @@ import com.yahoo.vespa.applicationmodel.ClusterId; import com.yahoo.vespa.applicationmodel.ConfigId; import com.yahoo.vespa.applicationmodel.ServiceStatus; import com.yahoo.vespa.applicationmodel.ServiceType; -import com.yahoo.vespa.flags.BooleanFlag; import com.yahoo.vespa.flags.FlagSource; -import com.yahoo.vespa.flags.Flags; import com.yahoo.vespa.service.duper.DuperModelManager; import com.yahoo.vespa.service.duper.ZoneApplication; import com.yahoo.vespa.service.executor.RunletExecutorImpl; @@ -50,26 +48,19 @@ public class HealthMonitorManager implements MonitorManager { private final ConcurrentHashMap healthMonitors = new ConcurrentHashMap<>(); private final DuperModelManager duperModel; private final ApplicationHealthMonitorFactory applicationHealthMonitorFactory; - private final BooleanFlag monitorInfra; @Inject public HealthMonitorManager(DuperModelManager duperModel, FlagSource flagSource) { - this(duperModel, - Flags.HEALTHMONITOR_MONITOR_INFRA.bindTo(flagSource), - new StateV1HealthModel(TARGET_HEALTH_STALENESS, HEALTH_REQUEST_TIMEOUT, KEEP_ALIVE, new RunletExecutorImpl(THREAD_POOL_SIZE))); + this(duperModel, new StateV1HealthModel( + TARGET_HEALTH_STALENESS, HEALTH_REQUEST_TIMEOUT, KEEP_ALIVE, new RunletExecutorImpl(THREAD_POOL_SIZE))); } - private HealthMonitorManager(DuperModelManager duperModel, - BooleanFlag monitorInfra, - StateV1HealthModel healthModel) { - this(duperModel, monitorInfra, id -> new ApplicationHealthMonitor(id, healthModel)); + private HealthMonitorManager(DuperModelManager duperModel, StateV1HealthModel healthModel) { + this(duperModel, id -> new ApplicationHealthMonitor(id, healthModel)); } - HealthMonitorManager(DuperModelManager duperModel, - BooleanFlag monitorInfra, - ApplicationHealthMonitorFactory applicationHealthMonitorFactory) { + HealthMonitorManager(DuperModelManager duperModel, ApplicationHealthMonitorFactory applicationHealthMonitorFactory) { this.duperModel = duperModel; - this.monitorInfra = monitorInfra; this.applicationHealthMonitorFactory = applicationHealthMonitorFactory; } @@ -111,14 +102,6 @@ public class HealthMonitorManager implements MonitorManager { @Override public boolean wouldMonitor(ApplicationId id) { - if (duperModel.isSupportedInfraApplication(id) && monitorInfra.value()) { - return true; - } - - if (id.equals(duperModel.getConfigServerApplication().getApplicationId())) { - return true; - } - - return false; + return duperModel.isSupportedInfraApplication(id); } } -- cgit v1.2.3