diff options
3 files changed, 35 insertions, 5 deletions
diff --git a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java index 906a56d3f34..f7068e7147e 100644 --- a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java +++ b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java @@ -145,6 +145,11 @@ public class Flags { "Configserver RPC authorizer. Allowed values: ['disable', 'log-only', 'enforce']", "Takes effect on restart of configserver"); + public static final UnboundBooleanFlag ENABLE_TENANT_HOST_APP = defineFeatureFlag( + "enable-tenant-host-app", false, + "Enable tenant host infrastructure application", + "Takes effect immediately"); + /** WARNING: public for testing: All flags should be defined in {@link Flags}. */ public static UnboundBooleanFlag defineFeatureFlag(String flagId, boolean defaultValue, String description, 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 c9cd4528bec..eb90b2f56d7 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 @@ -9,7 +9,10 @@ import com.yahoo.config.model.api.SuperModelListener; import com.yahoo.config.model.api.SuperModelProvider; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.HostName; +import com.yahoo.config.provision.NodeType; +import com.yahoo.vespa.flags.BooleanFlag; 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; @@ -34,14 +37,18 @@ public class DuperModelManager implements DuperModelInfraApi { static final ConfigServerHostApplication configServerHostApplication = new ConfigServerHostApplication(); static final ConfigServerApplication configServerApplication = new ConfigServerApplication(); static final ProxyHostApplication proxyHostApplication = new ProxyHostApplication(); + static final TenantHostApplication tenantHostApplication = new TenantHostApplication(); private final Map<ApplicationId, InfraApplication> supportedInfraApplications; + private final Map<ApplicationId, InfraApplication> supportedMinusTenantHostInfraApplications; private final Object monitor = new Object(); private final DuperModel duperModel; // The set of active infrastructure ApplicationInfo. Not all are necessarily in the DuperModel for historical reasons. private final Set<ApplicationId> activeInfraInfos = new HashSet<>(10); + private final BooleanFlag tenantHostApplicationEnabled; + @Inject public DuperModelManager(ConfigserverConfig configServerConfig, FlagSource flagSource, SuperModelProvider superModelProvider) { this(configServerConfig.multitenant(), @@ -52,16 +59,20 @@ public class DuperModelManager implements DuperModelInfraApi { /** For testing */ DuperModelManager(boolean multitenant, boolean isController, SuperModelProvider superModelProvider, DuperModel duperModel, FlagSource flagSource) { this.duperModel = duperModel; + this.tenantHostApplicationEnabled = Flags.ENABLE_TENANT_HOST_APP.bindTo(flagSource); if (multitenant) { supportedInfraApplications = (isController ? Stream.of(controllerHostApplication, controllerApplication) : - Stream.of(configServerHostApplication, configServerApplication, proxyHostApplication) + Stream.of(configServerHostApplication, configServerApplication, proxyHostApplication, tenantHostApplication) ).collect(Collectors.toUnmodifiableMap(InfraApplication::getApplicationId, Function.identity())); } else { supportedInfraApplications = Map.of(); } + supportedMinusTenantHostInfraApplications = supportedInfraApplications.entrySet().stream() + .filter(app -> app.getValue().getCapacity().type() != NodeType.host) + .collect(Collectors.toUnmodifiableMap(Map.Entry::getKey, Map.Entry::getValue)); superModelProvider.registerListener(new SuperModelListener() { @Override @@ -92,19 +103,23 @@ public class DuperModelManager implements DuperModelInfraApi { @Override public List<InfraApplicationApi> getSupportedInfraApplications() { - return new ArrayList<>(supportedInfraApplications.values()); + return new ArrayList<>(getSupportedApps().values()); } @Override public Optional<InfraApplicationApi> getInfraApplication(ApplicationId applicationId) { - return Optional.ofNullable(supportedInfraApplications.get(applicationId)); + return Optional.ofNullable(getSupportedApps().get(applicationId)); + } + + private Map<ApplicationId, InfraApplication> getSupportedApps() { + return tenantHostApplicationEnabled.value() ? supportedInfraApplications : supportedMinusTenantHostInfraApplications; } /** * Returns true if application is considered an infrastructure application by the DuperModel. * - * <p>Note: The tenant host "application" is NOT considered an infrastructure application: It is just a - * cluster in the {@link ZoneApplication zone application}. + * <p>Note: Unless enable-tenant-host-app flag is enabled, the tenant host "application" is NOT considered an + * infrastructure application: It is just a cluster in the {@link ZoneApplication zone application}. */ public boolean isSupportedInfraApplication(ApplicationId applicationId) { return supportedInfraApplications.containsKey(applicationId); diff --git a/service-monitor/src/main/java/com/yahoo/vespa/service/duper/TenantHostApplication.java b/service-monitor/src/main/java/com/yahoo/vespa/service/duper/TenantHostApplication.java new file mode 100644 index 00000000000..ee6ac94cba2 --- /dev/null +++ b/service-monitor/src/main/java/com/yahoo/vespa/service/duper/TenantHostApplication.java @@ -0,0 +1,10 @@ +// Copyright 2019 Oath Inc. 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.config.provision.NodeType; + +public class TenantHostApplication extends HostAdminApplication { + public TenantHostApplication() { + super("tenant-host", NodeType.host); + } +} |