diff options
20 files changed, 17 insertions, 201 deletions
diff --git a/config-model-api/src/main/java/com/yahoo/config/application/api/ApplicationPackage.java b/config-model-api/src/main/java/com/yahoo/config/application/api/ApplicationPackage.java index 883b59be410..0ce09c454a0 100644 --- a/config-model-api/src/main/java/com/yahoo/config/application/api/ApplicationPackage.java +++ b/config-model-api/src/main/java/com/yahoo/config/application/api/ApplicationPackage.java @@ -71,6 +71,7 @@ public interface ApplicationPackage { String RULES_NAME_SUFFIX = ".sr"; String EXT_DIR = "ext"; + // TODO: Remove when oldest model version is 8.95 String PERMANENT_SERVICES = "permanent-services.xml"; ApplicationId getApplicationId(); diff --git a/config-model-api/src/main/java/com/yahoo/config/model/api/ModelContext.java b/config-model-api/src/main/java/com/yahoo/config/model/api/ModelContext.java index a4e62dc5488..78f49f1e045 100644 --- a/config-model-api/src/main/java/com/yahoo/config/model/api/ModelContext.java +++ b/config-model-api/src/main/java/com/yahoo/config/model/api/ModelContext.java @@ -36,7 +36,7 @@ public interface ModelContext { ApplicationPackage applicationPackage(); Optional<Model> previousModel(); - Optional<ApplicationPackage> permanentApplicationPackage(); + default Optional<ApplicationPackage> permanentApplicationPackage() { return Optional.empty(); } // TODO: Remove when oldest model version is 8.95 HostProvisioner getHostProvisioner(); Provisioned provisioned(); DeployLogger deployLogger(); diff --git a/config-model/src/main/java/com/yahoo/config/model/ConfigModelRepo.java b/config-model/src/main/java/com/yahoo/config/model/ConfigModelRepo.java index 01b66057038..95d97bc9e87 100644 --- a/config-model/src/main/java/com/yahoo/config/model/ConfigModelRepo.java +++ b/config-model/src/main/java/com/yahoo/config/model/ConfigModelRepo.java @@ -1,7 +1,6 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.config.model; -import com.yahoo.config.application.api.ApplicationFile; import com.yahoo.config.application.api.ApplicationPackage; import com.yahoo.config.model.ConfigModelContext.ApplicationType; import com.yahoo.config.model.builder.xml.ConfigModelBuilder; @@ -12,7 +11,6 @@ import com.yahoo.config.model.graph.ModelGraphBuilder; import com.yahoo.config.model.graph.ModelNode; import com.yahoo.config.model.producer.AbstractConfigProducer; import com.yahoo.config.model.provision.HostsXmlProvisioner; -import com.yahoo.path.Path; import com.yahoo.text.XML; import com.yahoo.vespa.model.VespaModel; import com.yahoo.vespa.model.builder.VespaModelBuilder; @@ -20,8 +18,6 @@ import com.yahoo.vespa.model.content.Content; import com.yahoo.vespa.model.routing.Routing; import org.w3c.dom.Document; import org.w3c.dom.Element; -import org.xml.sax.SAXException; - import java.io.IOException; import java.io.Reader; import java.io.Serializable; @@ -33,7 +29,6 @@ import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import java.util.Optional; import java.util.TreeMap; import java.util.logging.Level; import java.util.logging.Logger; @@ -82,7 +77,7 @@ public class ConfigModelRepo implements ConfigModelRepoAdder, Serializable, Iter VespaModel vespaModel, VespaModelBuilder builder, ApplicationConfigProducerRoot root, - ConfigModelRegistry configModelRegistry) throws IOException, SAXException { + ConfigModelRegistry configModelRegistry) throws IOException { Element userServicesElement = getServicesFromApp(deployState.getApplicationPackage()); readConfigModels(root, userServicesElement, deployState, vespaModel, configModelRegistry); builder.postProc(deployState.getDeployLogger(), root, this); @@ -117,7 +112,7 @@ public class ConfigModelRepo implements ConfigModelRepoAdder, Serializable, Iter Element servicesRoot, DeployState deployState, VespaModel vespaModel, - ConfigModelRegistry configModelRegistry) throws IOException, SAXException { + ConfigModelRegistry configModelRegistry) { final Map<ConfigModelBuilder, List<Element>> model2Element = new LinkedHashMap<>(); ModelGraphBuilder graphBuilder = new ModelGraphBuilder(); @@ -126,8 +121,6 @@ public class ConfigModelRepo implements ConfigModelRepoAdder, Serializable, Iter if (XML.getChild(servicesRoot, "admin") == null) children.add(getImplicitAdmin(deployState)); - children.addAll(getPermanentServices(deployState)); - for (Element servicesElement : children) { String tagName = servicesElement.getTagName(); if (tagName.equals("legacy")) { @@ -170,21 +163,6 @@ public class ConfigModelRepo implements ConfigModelRepoAdder, Serializable, Iter .orElse(ApplicationType.DEFAULT); } - private Collection<Element> getPermanentServices(DeployState deployState) throws IOException, SAXException { - List<Element> permanentServices = new ArrayList<>(); - Optional<ApplicationPackage> applicationPackage = deployState.getPermanentApplicationPackage(); - if (applicationPackage.isPresent()) { - ApplicationFile file = applicationPackage.get().getFile(Path.fromString(ApplicationPackage.PERMANENT_SERVICES)); - if (file.exists()) { - try (Reader reader = file.createReader()) { - Element permanentServicesRoot = getServicesFromReader(reader); - permanentServices.addAll(getServiceElements(permanentServicesRoot)); - } - } - } - return permanentServices; - } - private Element getServicesFromReader(Reader reader) { Document doc = XmlHelper.getDocument(reader); return doc.getDocumentElement(); diff --git a/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java b/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java index 679a27df990..985fc5fd22e 100644 --- a/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java +++ b/config-model/src/main/java/com/yahoo/config/model/deploy/DeployState.java @@ -71,7 +71,6 @@ public class DeployState implements ConfigDefinitionStore { private final List<Schema> schemas; private final ApplicationPackage applicationPackage; private final Optional<ConfigDefinitionRepo> configDefinitionRepo; - private final Optional<ApplicationPackage> permanentApplicationPackage; private final Optional<Model> previousModel; private final boolean accessLoggingEnabledByDefault; private final ModelContext.Properties properties; @@ -111,7 +110,6 @@ public class DeployState implements ConfigDefinitionStore { Provisioned provisioned, ModelContext.Properties properties, Version vespaVersion, - Optional<ApplicationPackage> permanentApplicationPackage, Optional<ConfigDefinitionRepo> configDefinitionRepo, Optional<Model> previousModel, Set<ContainerEndpoint> endpoints, @@ -137,7 +135,6 @@ public class DeployState implements ConfigDefinitionStore { this.provisioned = provisioned; this.schemas = List.copyOf(application.schemas().values()); this.documentModel = application.documentModel(); - this.permanentApplicationPackage = permanentApplicationPackage; this.configDefinitionRepo = configDefinitionRepo; this.endpoints = Set.copyOf(endpoints); this.zone = zone; @@ -251,10 +248,6 @@ public class DeployState implements ConfigDefinitionStore { public HostProvisioner getProvisioner() { return provisioner; } - public Optional<ApplicationPackage> getPermanentApplicationPackage() { - return permanentApplicationPackage; - } - public ModelContext.Properties getProperties() { return properties; } public ModelContext.FeatureFlags featureFlags() { return properties.featureFlags(); } @@ -317,7 +310,6 @@ public class DeployState implements ConfigDefinitionStore { private DeployLogger logger = new BaseDeployLogger(); private Optional<HostProvisioner> hostProvisioner = Optional.empty(); private Provisioned provisioned = new Provisioned(); - private Optional<ApplicationPackage> permanentApplicationPackage = Optional.empty(); private ModelContext.Properties properties = new TestProperties(); private Version version = new Version(1, 0, 0); private Optional<ConfigDefinitionRepo> configDefinitionRepo = Optional.empty(); @@ -365,11 +357,6 @@ public class DeployState implements ConfigDefinitionStore { return this; } - public Builder permanentApplicationPackage(Optional<ApplicationPackage> permanentApplicationPackage) { - this.permanentApplicationPackage = permanentApplicationPackage; - return this; - } - public Builder properties(ModelContext.Properties properties) { this.properties = properties; return this; @@ -466,7 +453,6 @@ public class DeployState implements ConfigDefinitionStore { provisioned, properties, version, - permanentApplicationPackage, configDefinitionRepo, previousModel, endpoints, diff --git a/config-model/src/main/java/com/yahoo/vespa/model/VespaModelFactory.java b/config-model/src/main/java/com/yahoo/vespa/model/VespaModelFactory.java index 1ba8b470891..9e867a4c3bc 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/VespaModelFactory.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/VespaModelFactory.java @@ -64,10 +64,10 @@ public class VespaModelFactory implements ModelFactory { ComponentRegistry<Validator> additionalValidators, Zone zone) { this.version = new Version(VespaVersion.major, VespaVersion.minor, VespaVersion.micro); - List<ConfigModelBuilder> modelBuilders = new ArrayList<>(); + List<ConfigModelBuilder<?>> modelBuilders = new ArrayList<>(); for (ConfigModelPlugin plugin : pluginRegistry.allComponents()) { - if (plugin instanceof ConfigModelBuilder) { - modelBuilders.add((ConfigModelBuilder) plugin); + if (plugin instanceof ConfigModelBuilder p) { + modelBuilders.add(p); } } this.configModelRegistry = new MapConfigModelRegistry(modelBuilders); @@ -187,7 +187,6 @@ public class VespaModelFactory implements ModelFactory { .configDefinitionRepo(modelContext.configDefinitionRepo()) .fileRegistry(modelContext.getFileRegistry()) .executor(modelContext.getExecutor()) - .permanentApplicationPackage(modelContext.permanentApplicationPackage()) .properties(modelContext.properties()) .vespaVersion(version()) .modelHostProvisioner(modelContext.getHostProvisioner()) diff --git a/config-model/src/test/cfg/application/app_permanent/permanent-services.xml b/config-model/src/test/cfg/application/app_permanent/permanent-services.xml deleted file mode 100644 index bf00993d3e2..00000000000 --- a/config-model/src/test/cfg/application/app_permanent/permanent-services.xml +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="utf-8" ?> -<!-- Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. --> -<services version="1.0"> - <container version="1.0"> - <search /> - </container> -</services> diff --git a/config-model/src/test/java/com/yahoo/config/model/MockModelContext.java b/config-model/src/test/java/com/yahoo/config/model/MockModelContext.java index 49b4e9820de..af05a144b79 100644 --- a/config-model/src/test/java/com/yahoo/config/model/MockModelContext.java +++ b/config-model/src/test/java/com/yahoo/config/model/MockModelContext.java @@ -47,11 +47,6 @@ public class MockModelContext implements ModelContext { } @Override - public Optional<ApplicationPackage> permanentApplicationPackage() { - return Optional.empty(); - } - - @Override public HostProvisioner getHostProvisioner() { return DeployState.getDefaultModelHostProvisioner(applicationPackage); } diff --git a/config-model/src/test/java/com/yahoo/config/model/deploy/DeployStateTest.java b/config-model/src/test/java/com/yahoo/config/model/deploy/DeployStateTest.java index f0b729a718c..e0726e9443c 100644 --- a/config-model/src/test/java/com/yahoo/config/model/deploy/DeployStateTest.java +++ b/config-model/src/test/java/com/yahoo/config/model/deploy/DeployStateTest.java @@ -16,16 +16,16 @@ import com.yahoo.vespa.config.ConfigDefinitionKey; import com.yahoo.vespa.model.VespaModel; import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; - import java.io.File; import java.io.IOException; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import java.util.Optional; import java.util.Set; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * @author Ulf Lilleengen @@ -42,15 +42,6 @@ public class DeployStateTest { } @Test - void testBuilder() { - DeployState.Builder builder = new DeployState.Builder(); - ApplicationPackage app = MockApplicationPackage.createEmpty(); - builder.permanentApplicationPackage(Optional.of(app)); - DeployState state = builder.build(); - assertEquals(app, state.getPermanentApplicationPackage().get()); - } - - @Test void testPreviousModelIsProvided() throws IOException, SAXException { VespaModel prevModel = new VespaModel(MockApplicationPackage.createEmpty()); DeployState.Builder builder = new DeployState.Builder(); diff --git a/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTestCase.java b/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTestCase.java index 1aa010020f5..68782b947e3 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTestCase.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/test/VespaModelTestCase.java @@ -34,18 +34,20 @@ import com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import org.xml.sax.SAXException; - import java.io.File; import java.io.IOException; import java.io.StringReader; import java.util.ArrayList; import java.util.List; import java.util.Map; -import java.util.Optional; import java.util.Set; import java.util.logging.Level; -import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.junit.jupiter.api.Assertions.assertTrue; /** * @author gjoranv @@ -294,16 +296,6 @@ public class VespaModelTestCase { } @Test - void testPermanentServices() throws IOException, SAXException { - ApplicationPackage app = MockApplicationPackage.createEmpty(); - DeployState.Builder builder = new DeployState.Builder().applicationPackage(app); - VespaModel model = new VespaModel(new NullConfigModelRegistry(), builder.build()); - assertTrue(model.getContainerClusters().isEmpty()); - model = new VespaModel(new NullConfigModelRegistry(), builder.permanentApplicationPackage(Optional.of(FilesApplicationPackage.fromFile(new File(TESTDIR, "app_permanent")))).build()); - assertEquals(1, model.getContainerClusters().size()); - } - - @Test void testThatDeployLogContainsWarningWhenUsingSearchdefinitionsDir() throws IOException, SAXException { ApplicationPackage app = FilesApplicationPackage.fromFile( new File("src/test/cfg/application/deprecated_features_app/")); diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/application/PermanentApplicationPackage.java b/configserver/src/main/java/com/yahoo/vespa/config/server/application/PermanentApplicationPackage.java deleted file mode 100644 index 65c741066c2..00000000000 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/application/PermanentApplicationPackage.java +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.config.server.application; - -import com.yahoo.config.application.api.ApplicationPackage; -import com.yahoo.config.model.application.provider.FilesApplicationPackage; -import java.util.logging.Level; -import com.yahoo.cloud.config.ConfigserverConfig; -import static com.yahoo.vespa.defaults.Defaults.getDefaults; - -import java.io.File; -import java.util.Optional; -import java.util.logging.Logger; - -/** - * A global permanent application package containing configuration info that is always used during deploy. - * - * @author Ulf Lilleengen - */ -public class PermanentApplicationPackage { - - private static final Logger log = Logger.getLogger(PermanentApplicationPackage.class.getName()); - private final Optional<ApplicationPackage> applicationPackage; - - public PermanentApplicationPackage(ConfigserverConfig config) { - File app = new File(getDefaults().underVespaHome(config.applicationDirectory())); - applicationPackage = Optional.ofNullable(app.exists() ? FilesApplicationPackage.fromFile(app) : null); - if (applicationPackage.isPresent()) { - log.log(Level.FINE, () -> "Detected permanent application package in '" + - getDefaults().underVespaHome(config.applicationDirectory()) + - "'. This might add extra services to config models"); - } - } - - /** - * Get the permanent application package. - * - * @return An {@link Optional} of the application package, as it may not exist. - */ - public Optional<ApplicationPackage> applicationPackage() { - return applicationPackage; - } - -} diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java b/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java index 2a19a3b0833..dcd59f6ceff 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/deploy/ModelContextImpl.java @@ -56,7 +56,6 @@ public class ModelContextImpl implements ModelContext { private final ApplicationPackage applicationPackage; private final Optional<Model> previousModel; - private final Optional<ApplicationPackage> permanentApplicationPackage; private final DeployLogger deployLogger; private final ConfigDefinitionRepo configDefinitionRepo; private final FileRegistry fileRegistry; @@ -83,7 +82,6 @@ public class ModelContextImpl implements ModelContext { public ModelContextImpl(ApplicationPackage applicationPackage, Optional<Model> previousModel, - Optional<ApplicationPackage> permanentApplicationPackage, DeployLogger deployLogger, ConfigDefinitionRepo configDefinitionRepo, FileRegistry fileRegistry, @@ -98,7 +96,6 @@ public class ModelContextImpl implements ModelContext { Version wantedNodeVespaVersion) { this.applicationPackage = applicationPackage; this.previousModel = previousModel; - this.permanentApplicationPackage = permanentApplicationPackage; this.deployLogger = deployLogger; this.configDefinitionRepo = configDefinitionRepo; this.fileRegistry = fileRegistry; @@ -119,9 +116,6 @@ public class ModelContextImpl implements ModelContext { @Override public Optional<Model> previousModel() { return previousModel; } - @Override - public Optional<ApplicationPackage> permanentApplicationPackage() { return permanentApplicationPackage; } - /** * Returns the host provisioner to use, or empty to use the default provisioner, * creating hosts from the application package defined hosts diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/modelfactory/ActivatedModelsBuilder.java b/configserver/src/main/java/com/yahoo/vespa/config/server/modelfactory/ActivatedModelsBuilder.java index 019b0386695..9497a298a33 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/modelfactory/ActivatedModelsBuilder.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/modelfactory/ActivatedModelsBuilder.java @@ -20,7 +20,6 @@ import com.yahoo.vespa.config.server.ServerCache; import com.yahoo.vespa.config.server.application.Application; import com.yahoo.vespa.config.server.application.ApplicationCuratorDatabase; import com.yahoo.vespa.config.server.application.ApplicationSet; -import com.yahoo.vespa.config.server.application.PermanentApplicationPackage; import com.yahoo.vespa.config.server.deploy.ModelContextImpl; import com.yahoo.vespa.config.server.monitoring.MetricUpdater; import com.yahoo.vespa.config.server.monitoring.Metrics; @@ -33,7 +32,6 @@ import com.yahoo.vespa.config.server.tenant.EndpointCertificateRetriever; import com.yahoo.vespa.config.server.tenant.TenantRepository; import com.yahoo.vespa.curator.Curator; import com.yahoo.vespa.flags.FlagSource; - import java.util.Comparator; import java.util.Map; import java.util.Optional; @@ -54,7 +52,6 @@ public class ActivatedModelsBuilder extends ModelsBuilder<Application> { private final long applicationGeneration; private final SessionZooKeeperClient zkClient; private final Optional<ApplicationSet> currentActiveApplicationSet; - private final PermanentApplicationPackage permanentApplicationPackage; private final ConfigDefinitionRepo configDefinitionRepo; private final Metrics metrics; private final Curator curator; @@ -69,7 +66,6 @@ public class ActivatedModelsBuilder extends ModelsBuilder<Application> { ExecutorService executor, Curator curator, Metrics metrics, - PermanentApplicationPackage permanentApplicationPackage, FlagSource flagSource, SecretStore secretStore, HostProvisionerProvider hostProvisionerProvider, @@ -82,7 +78,6 @@ public class ActivatedModelsBuilder extends ModelsBuilder<Application> { this.applicationGeneration = applicationGeneration; this.zkClient = zkClient; this.currentActiveApplicationSet = currentActiveApplicationSet; - this.permanentApplicationPackage = permanentApplicationPackage; this.configDefinitionRepo = configDefinitionRepo; this.metrics = metrics; this.curator = curator; @@ -104,7 +99,6 @@ public class ActivatedModelsBuilder extends ModelsBuilder<Application> { ModelContext modelContext = new ModelContextImpl( applicationPackage, modelOf(modelFactory.version()), - permanentApplicationPackage.applicationPackage(), new SilentDeployLogger(), configDefinitionRepo, getForVersionOrLatest(applicationPackage.getFileRegistries(), modelFactory.version()).orElse(new MockFileRegistry()), diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/modelfactory/PreparedModelsBuilder.java b/configserver/src/main/java/com/yahoo/vespa/config/server/modelfactory/PreparedModelsBuilder.java index e6ae5c491c0..35c4d761090 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/modelfactory/PreparedModelsBuilder.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/modelfactory/PreparedModelsBuilder.java @@ -29,14 +29,12 @@ import com.yahoo.container.jdisc.secretstore.SecretStore; import com.yahoo.vespa.config.server.application.Application; import com.yahoo.vespa.config.server.application.ApplicationCuratorDatabase; import com.yahoo.vespa.config.server.application.ApplicationSet; -import com.yahoo.vespa.config.server.application.PermanentApplicationPackage; import com.yahoo.vespa.config.server.deploy.ModelContextImpl; import com.yahoo.vespa.config.server.host.HostValidator; import com.yahoo.vespa.config.server.provision.HostProvisionerProvider; import com.yahoo.vespa.config.server.session.PrepareParams; import com.yahoo.vespa.curator.Curator; import com.yahoo.vespa.flags.FlagSource; - import java.io.File; import java.io.IOException; import java.time.Duration; @@ -56,7 +54,6 @@ public class PreparedModelsBuilder extends ModelsBuilder<PreparedModelsBuilder.P private static final Logger log = Logger.getLogger(PreparedModelsBuilder.class.getName()); - private final PermanentApplicationPackage permanentApplicationPackage; private final FlagSource flagSource; private final SecretStore secretStore; private final List<ContainerEndpoint> containerEndpoints; @@ -70,7 +67,6 @@ public class PreparedModelsBuilder extends ModelsBuilder<PreparedModelsBuilder.P private final ExecutorService executor; public PreparedModelsBuilder(ModelFactoryRegistry modelFactoryRegistry, - PermanentApplicationPackage permanentApplicationPackage, FlagSource flagSource, SecretStore secretStore, List<ContainerEndpoint> containerEndpoints, @@ -87,7 +83,6 @@ public class PreparedModelsBuilder extends ModelsBuilder<PreparedModelsBuilder.P ConfigserverConfig configserverConfig, Zone zone) { super(modelFactoryRegistry, configserverConfig, zone, hostProvisionerProvider, deployLogger); - this.permanentApplicationPackage = permanentApplicationPackage; this.flagSource = flagSource; this.secretStore = secretStore; this.containerEndpoints = containerEndpoints; @@ -115,7 +110,6 @@ public class PreparedModelsBuilder extends ModelsBuilder<PreparedModelsBuilder.P ModelContext modelContext = new ModelContextImpl( applicationPackage, modelOf(modelVersion), - permanentApplicationPackage.applicationPackage(), deployLogger(), configDefinitionRepo, fileRegistry, diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionPreparer.java b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionPreparer.java index 4928af488e1..86eba77606b 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionPreparer.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionPreparer.java @@ -33,7 +33,6 @@ import com.yahoo.text.XML; import com.yahoo.vespa.config.server.ConfigServerSpec; import com.yahoo.vespa.config.server.TimeoutBudget; import com.yahoo.vespa.config.server.application.ApplicationSet; -import com.yahoo.vespa.config.server.application.PermanentApplicationPackage; import com.yahoo.vespa.config.server.configchange.ConfigChangeActions; import com.yahoo.vespa.config.server.deploy.ZooKeeperDeployer; import com.yahoo.vespa.config.server.filedistribution.FileDistributionFactory; @@ -83,7 +82,6 @@ public class SessionPreparer { private final ModelFactoryRegistry modelFactoryRegistry; private final FileDistributionFactory fileDistributionFactory; private final HostProvisionerProvider hostProvisionerProvider; - private final PermanentApplicationPackage permanentApplicationPackage; private final ConfigserverConfig configserverConfig; private final ConfigDefinitionRepo configDefinitionRepo; private final Curator curator; @@ -96,7 +94,6 @@ public class SessionPreparer { FileDistributionFactory fileDistributionFactory, ExecutorService executor, HostProvisionerProvider hostProvisionerProvider, - PermanentApplicationPackage permanentApplicationPackage, ConfigserverConfig configserverConfig, ConfigDefinitionRepo configDefinitionRepo, Curator curator, @@ -106,7 +103,6 @@ public class SessionPreparer { this.modelFactoryRegistry = modelFactoryRegistry; this.fileDistributionFactory = fileDistributionFactory; this.hostProvisionerProvider = hostProvisionerProvider; - this.permanentApplicationPackage = permanentApplicationPackage; this.configserverConfig = configserverConfig; this.configDefinitionRepo = configDefinitionRepo; this.curator = curator; @@ -206,7 +202,6 @@ public class SessionPreparer { this.athenzDomain = params.athenzDomain(); this.fileRegistry = fileDistributionFactory.createFileRegistry(serverDbSessionDir); this.preparedModelsBuilder = new PreparedModelsBuilder(modelFactoryRegistry, - permanentApplicationPackage, flagSource, secretStore, containerEndpoints, diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java index 9c50636ecfb..77b8a9de2c0 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/session/SessionRepository.java @@ -25,7 +25,6 @@ import com.yahoo.transaction.Transaction; import com.yahoo.vespa.config.server.ConfigServerDB; import com.yahoo.vespa.config.server.TimeoutBudget; import com.yahoo.vespa.config.server.application.ApplicationSet; -import com.yahoo.vespa.config.server.application.PermanentApplicationPackage; import com.yahoo.vespa.config.server.application.TenantApplications; import com.yahoo.vespa.config.server.configchange.ConfigChangeActions; import com.yahoo.vespa.config.server.deploy.TenantFileSystemDirs; @@ -110,7 +109,6 @@ public class SessionRepository { private final Curator curator; private final Executor zkWatcherExecutor; private final FileDistributionFactory fileDistributionFactory; - private final PermanentApplicationPackage permanentApplicationPackage; private final FlagSource flagSource; private final TenantFileSystemDirs tenantFileSystemDirs; private final Metrics metrics; @@ -137,7 +135,6 @@ public class SessionRepository { Metrics metrics, StripedExecutor<TenantName> zkWatcherExecutor, FileDistributionFactory fileDistributionFactory, - PermanentApplicationPackage permanentApplicationPackage, FlagSource flagSource, ExecutorService zkCacheExecutor, SecretStore secretStore, @@ -157,7 +154,6 @@ public class SessionRepository { this.sessionLifetime = Duration.ofSeconds(configserverConfig.sessionLifetime()); this.zkWatcherExecutor = command -> zkWatcherExecutor.execute(tenantName, command); this.fileDistributionFactory = fileDistributionFactory; - this.permanentApplicationPackage = permanentApplicationPackage; this.flagSource = flagSource; this.tenantFileSystemDirs = new TenantFileSystemDirs(configServerDB, tenantName); this.applicationRepo = applicationRepo; @@ -548,7 +544,6 @@ public class SessionRepository { sessionPreparer.getExecutor(), curator, metrics, - permanentApplicationPackage, flagSource, secretStore, hostProvisionerProvider, diff --git a/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/TenantRepository.java b/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/TenantRepository.java index e044e19331e..69d13bf2dea 100644 --- a/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/TenantRepository.java +++ b/configserver/src/main/java/com/yahoo/vespa/config/server/tenant/TenantRepository.java @@ -2,9 +2,9 @@ package com.yahoo.vespa.config.server.tenant; import com.google.common.collect.ImmutableSet; -import com.yahoo.component.annotation.Inject; import com.yahoo.cloud.config.ConfigserverConfig; import com.yahoo.cloud.config.ZookeeperServerConfig; +import com.yahoo.component.annotation.Inject; import com.yahoo.concurrent.DaemonThreadFactory; import com.yahoo.concurrent.Lock; import com.yahoo.concurrent.Locks; @@ -18,9 +18,8 @@ import com.yahoo.container.jdisc.secretstore.SecretStore; import com.yahoo.path.Path; import com.yahoo.text.Utf8; import com.yahoo.transaction.Transaction; -import com.yahoo.vespa.config.server.ConfigServerDB; import com.yahoo.vespa.config.server.ConfigActivationListener; -import com.yahoo.vespa.config.server.application.PermanentApplicationPackage; +import com.yahoo.vespa.config.server.ConfigServerDB; import com.yahoo.vespa.config.server.application.TenantApplications; import com.yahoo.vespa.config.server.deploy.TenantFileSystemDirs; import com.yahoo.vespa.config.server.filedistribution.FileDirectory; @@ -41,7 +40,6 @@ import org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent; import org.apache.curator.framework.state.ConnectionState; import org.apache.zookeeper.KeeperException; import org.apache.zookeeper.data.Stat; - import java.time.Clock; import java.time.Duration; import java.time.Instant; @@ -346,12 +344,10 @@ public class TenantRepository { new TenantFileSystemDirs(configServerDB, tenantName), clock, flagSource); - PermanentApplicationPackage permanentApplicationPackage = new PermanentApplicationPackage(configserverConfig); SessionPreparer sessionPreparer = new SessionPreparer(modelFactoryRegistry, fileDistributionFactory, deployHelperExecutor, hostProvisionerProvider, - permanentApplicationPackage, configserverConfig, configDefinitionRepo, curator, @@ -365,7 +361,6 @@ public class TenantRepository { metrics, zkSessionWatcherExecutor, fileDistributionFactory, - permanentApplicationPackage, flagSource, zkCacheExecutor, secretStore, diff --git a/configserver/src/main/resources/configserver-app/services.xml b/configserver/src/main/resources/configserver-app/services.xml index 077980d9523..713b897f23a 100644 --- a/configserver/src/main/resources/configserver-app/services.xml +++ b/configserver/src/main/resources/configserver-app/services.xml @@ -26,7 +26,6 @@ <component id="com.yahoo.vespa.config.server.deploy.InfraDeployerProvider" bundle="configserver" /> <component id="com.yahoo.vespa.curator.Curator" bundle="configserver" /> <component id="com.yahoo.vespa.config.server.tenant.TenantRepository" bundle="configserver" /> - <component id="com.yahoo.vespa.config.server.application.PermanentApplicationPackage" bundle="configserver" /> <component id="com.yahoo.vespa.config.server.host.HostRegistry" bundle="configserver" /> <component id="com.yahoo.vespa.config.server.ApplicationRepository" bundle="configserver" /> <component id="com.yahoo.vespa.config.server.version.VersionState" bundle="configserver" /> diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/ModelContextImplTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/ModelContextImplTest.java index 8848beb3821..2ef9a41a967 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/ModelContextImplTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/ModelContextImplTest.java @@ -53,7 +53,6 @@ public class ModelContextImplTest { ModelContext context = new ModelContextImpl( applicationPackage, Optional.empty(), - Optional.empty(), new BaseDeployLogger(), new StaticConfigDefinitionRepo(), new MockFileRegistry(), @@ -83,7 +82,6 @@ public class ModelContextImplTest { new Version(8)); assertTrue(context.applicationPackage() instanceof MockApplicationPackage); assertEquals(hostProvisioner, context.getHostProvisioner()); - assertFalse(context.permanentApplicationPackage().isPresent()); assertFalse(context.previousModel().isPresent()); assertTrue(context.getFileRegistry() instanceof MockFileRegistry); assertTrue(context.configDefinitionRepo() instanceof StaticConfigDefinitionRepo); diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/application/PermanentApplicationPackageTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/application/PermanentApplicationPackageTest.java deleted file mode 100644 index 678b7506a9d..00000000000 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/application/PermanentApplicationPackageTest.java +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.config.server.application; - -import com.yahoo.cloud.config.ConfigserverConfig; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; - -import java.io.File; -import java.io.IOException; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -/** - * @author Ulf Lilleengen - * @since 5.15 - */ -public class PermanentApplicationPackageTest { - @Test - public void testNonexistingApplication() { - PermanentApplicationPackage permanentApplicationPackage = new PermanentApplicationPackage( - new ConfigserverConfig(new ConfigserverConfig.Builder().applicationDirectory("_no_such_dir"))); - assertFalse(permanentApplicationPackage.applicationPackage().isPresent()); - } - - @Rule - public TemporaryFolder folder = new TemporaryFolder(); - - @Test - public void testExistingApplication() throws IOException { - File tmpDir = folder.newFolder(); - PermanentApplicationPackage permanentApplicationPackage = new PermanentApplicationPackage( - new ConfigserverConfig(new ConfigserverConfig.Builder().applicationDirectory(tmpDir.getAbsolutePath()))); - assertTrue(permanentApplicationPackage.applicationPackage().isPresent()); - } -} diff --git a/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionPreparerTest.java b/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionPreparerTest.java index eabcd5dce45..26fa26b67c3 100644 --- a/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionPreparerTest.java +++ b/configserver/src/test/java/com/yahoo/vespa/config/server/session/SessionPreparerTest.java @@ -31,7 +31,6 @@ import com.yahoo.vespa.config.server.MockProvisioner; import com.yahoo.vespa.config.server.MockSecretStore; import com.yahoo.vespa.config.server.TestConfigDefinitionRepo; import com.yahoo.vespa.config.server.TimeoutBudgetTest; -import com.yahoo.vespa.config.server.application.PermanentApplicationPackage; import com.yahoo.vespa.config.server.deploy.DeployHandlerLogger; import com.yahoo.vespa.config.server.filedistribution.FileDirectory; import com.yahoo.vespa.config.server.filedistribution.MockFileDistributionFactory; @@ -53,7 +52,6 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; import org.junit.rules.TemporaryFolder; - import javax.security.auth.x500.X500Principal; import java.io.File; import java.io.IOException; @@ -130,7 +128,6 @@ public class SessionPreparerTest { new MockFileDistributionFactory(configserverConfig, new FileDirectory(configserverConfig, flagSource)), new InThreadExecutorService(), hostProvisionerProvider, - new PermanentApplicationPackage(configserverConfig), configserverConfig, new TestConfigDefinitionRepo(), curator, |