summaryrefslogtreecommitdiffstats
path: root/controller-server
diff options
context:
space:
mode:
authorJon Bratseth <bratseth@gmail.com>2019-10-07 17:26:59 +0200
committerGitHub <noreply@github.com>2019-10-07 17:26:59 +0200
commitfc0c6d5e3af1bd091e398968db4b7a394fb490e0 (patch)
treee763f40a2c282ce1a8214d16ac34cfe579ca3485 /controller-server
parent5bedd856c54812faa780d52236c1cf6394ed3fd9 (diff)
Revert "Bratseth/instances in deployment xml rebased"
Diffstat (limited to 'controller-server')
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java23
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/DeploymentSpecValidator.java23
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java5
-rw-r--r--controller-server/src/main/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepository.java72
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java5
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/ApplicationPackageBuilder.java24
-rw-r--r--controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java34
7 files changed, 82 insertions, 104 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java
index 0cf0f59102e..190a529f101 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/ApplicationController.java
@@ -385,9 +385,10 @@ public class ApplicationController {
}
if (zone.environment().isProduction()) // Assign and register endpoints
- application = withRotation(applicationPackage.deploymentSpec(), application, instance);
+ application = withRotation(application, instance);
+
+ endpoints = registerEndpointsInDns(application.get().deploymentSpec(), application.get().require(instanceId.instance()), zone);
- endpoints = registerEndpointsInDns(applicationPackage.deploymentSpec(), application.get().require(instanceId.instance()), zone);
if (controller.zoneRegistry().zones().directlyRouted().ids().contains(zone)) {
// Provisions a new certificate if missing
@@ -517,9 +518,9 @@ public class ApplicationController {
}
/** Makes sure the application has a global rotation, if eligible. */
- private LockedApplication withRotation(DeploymentSpec deploymentSpec, LockedApplication application, InstanceName instanceName) {
+ private LockedApplication withRotation(LockedApplication application, InstanceName instanceName) {
try (RotationLock rotationLock = rotationRepository.lock()) {
- var rotations = rotationRepository.getOrAssignRotations(deploymentSpec,
+ var rotations = rotationRepository.getOrAssignRotations(application.get().deploymentSpec(),
application.get().require(instanceName),
rotationLock);
application = application.with(instanceName, instance -> instance.with(rotations));
@@ -535,7 +536,7 @@ public class ApplicationController {
*/
private Set<ContainerEndpoint> registerEndpointsInDns(DeploymentSpec deploymentSpec, Instance instance, ZoneId zone) {
var containerEndpoints = new HashSet<ContainerEndpoint>();
- var registerLegacyNames = deploymentSpec.requireInstance(instance.name()).globalServiceId().isPresent();
+ var registerLegacyNames = deploymentSpec.globalServiceId().isPresent();
for (var assignedRotation : instance.rotations()) {
var names = new ArrayList<String>();
var endpoints = instance.endpointsIn(controller.system(), assignedRotation.endpointId())
@@ -627,8 +628,8 @@ public class ApplicationController {
private LockedApplication withoutDeletedDeployments(LockedApplication application, InstanceName instance) {
DeploymentSpec deploymentSpec = application.get().deploymentSpec();
List<Deployment> deploymentsToRemove = application.get().require(instance).productionDeployments().values().stream()
- .filter(deployment -> ! deploymentSpec.requireInstance(instance).includes(deployment.zone().environment(),
- Optional.of(deployment.zone().region())))
+ .filter(deployment -> ! deploymentSpec.includes(deployment.zone().environment(),
+ Optional.of(deployment.zone().region())))
.collect(Collectors.toList());
if (deploymentsToRemove.isEmpty()) return application;
@@ -652,7 +653,7 @@ public class ApplicationController {
private Instance withoutUnreferencedDeploymentJobs(DeploymentSpec deploymentSpec, Instance instance) {
for (JobType job : JobList.from(instance).production().mapToList(JobStatus::type)) {
ZoneId zone = job.zone(controller.system());
- if (deploymentSpec.requireInstance(instance.name()).includes(zone.environment(), Optional.of(zone.region())))
+ if (deploymentSpec.includes(zone.environment(), Optional.of(zone.region())))
continue;
instance = instance.withoutDeploymentJob(job);
}
@@ -910,9 +911,9 @@ public class ApplicationController {
* 2. If the principal is given, verify that the principal is tenant admin or admin of the tenant domain
* 3. If the principal is not given, verify that the Athenz domain of the tenant equals Athenz domain given in deployment.xml
*
- * @param tenantName tenant where application should be deployed
- * @param applicationPackage application package
- * @param deployer principal initiating the deployment, possibly empty
+ * @param tenantName Tenant where application should be deployed
+ * @param applicationPackage Application package
+ * @param deployer Principal initiating the deployment, possibly empty
*/
public void verifyApplicationIdentityConfiguration(TenantName tenantName, ApplicationPackage applicationPackage, Optional<Principal> deployer) {
verifyAllowedLaunchAthenzService(applicationPackage.deploymentSpec());
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/DeploymentSpecValidator.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/DeploymentSpecValidator.java
index 5c4d5874e53..ce7904dc829 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/DeploymentSpecValidator.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/DeploymentSpecValidator.java
@@ -39,7 +39,7 @@ public class DeploymentSpecValidator {
/** Verify that each of the production zones listed in the deployment spec exist in this system */
private void validateSteps(DeploymentSpec deploymentSpec) {
new DeploymentSteps(deploymentSpec, controller::system).jobs();
- deploymentSpec.instances().stream().flatMap(instance -> instance.zones().stream())
+ deploymentSpec.zones().stream()
.filter(zone -> zone.environment() == Environment.prod)
.forEach(zone -> {
if ( ! controller.zoneRegistry().hasZone(ZoneId.from(zone.environment(),
@@ -51,20 +51,17 @@ public class DeploymentSpecValidator {
/** Verify that no single endpoint contains regions in different clouds */
private void validateEndpoints(DeploymentSpec deploymentSpec) {
- for (var instance : deploymentSpec.instances()) {
- for (var endpoint : instance.endpoints()) {
- var clouds = new HashSet<CloudName>();
- for (var region : endpoint.regions()) {
- for (ZoneApi zone : controller.zoneRegistry().zones().all().in(region).zones()) {
- clouds.add(zone.getCloudName());
- }
- }
- if (clouds.size() != 1) {
- throw new IllegalArgumentException("Endpoint '" + endpoint.endpointId() + "' in " + instance +
- " cannot contain regions in different clouds: " +
- endpoint.regions().stream().sorted().collect(Collectors.toList()));
+ for (var endpoint : deploymentSpec.endpoints()) {
+ var clouds = new HashSet<CloudName>();
+ for (var region : endpoint.regions()) {
+ for (ZoneApi zone : controller.zoneRegistry().zones().all().in(region).zones()) {
+ clouds.add(zone.getCloudName());
}
}
+ if (clouds.size() != 1) {
+ throw new IllegalArgumentException("Endpoint '" + endpoint.endpointId() + "' cannot contain regions in different clouds: " +
+ endpoint.regions().stream().sorted().collect(Collectors.toList()));
+ }
}
}
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java
index 3df889d7a88..376048143d9 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentTrigger.java
@@ -372,8 +372,9 @@ public class DeploymentTrigger {
}
else { // All jobs are complete; find the time of completion of this step.
if (stepJobs.isEmpty()) { // No jobs means this is a delay step.
- completedAt = completedAt.map(at -> at.plus(step.delay())).filter(at -> !at.isAfter(clock.instant()));
- reason += " after a delay of " + step.delay();
+ Duration delay = ((DeploymentSpec.Delay) step).duration();
+ completedAt = completedAt.map(at -> at.plus(delay)).filter(at -> !at.isAfter(clock.instant()));
+ reason += " after a delay of " + delay;
}
else {
completedAt = stepJobs.stream().map(job -> instance.deploymentJobs().statusOf(job).get().lastCompleted().get().at()).max(naturalOrder());
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepository.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepository.java
index 9f6bbcd2a5a..a16ca5cb201 100644
--- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepository.java
+++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/rotation/RotationRepository.java
@@ -77,25 +77,22 @@ public class RotationRepository {
* If a rotation is already assigned to the application, that rotation will be returned.
* If no rotation is assigned, return an available rotation. The caller is responsible for assigning the rotation.
*
- * @param deploymentSpec the deployment spec for the application
- * @param instance the instance requesting a rotation
- * @param lock lock which must be acquired by the caller
+ * @param deploymentSpec The deployment spec for the application
+ * @param instance The instance requesting a rotation
+ * @param lock Lock which must be acquired by the caller
*/
public Rotation getOrAssignRotation(DeploymentSpec deploymentSpec, Instance instance, RotationLock lock) {
if ( ! instance.rotations().isEmpty()) {
return allRotations.get(instance.rotations().get(0).rotationId());
}
-
- if (deploymentSpec.requireInstance(instance.name()).globalServiceId().isEmpty()) {
- throw new IllegalArgumentException("global-service-id is not set in deployment spec for instance '" +
- instance.name() + "'");
+ if (deploymentSpec.globalServiceId().isEmpty()) {
+ throw new IllegalArgumentException("global-service-id is not set in deployment spec");
}
- long productionZones = deploymentSpec.requireInstance(instance.name()).zones().stream()
- .filter(zone -> zone.deploysTo(Environment.prod))
- .count();
+ long productionZones = deploymentSpec.zones().stream()
+ .filter(zone -> zone.deploysTo(Environment.prod))
+ .count();
if (productionZones < 2) {
- throw new IllegalArgumentException("global-service-id is set but less than 2 prod zones are defined " +
- "in instance '" + instance.name() + "'");
+ throw new IllegalArgumentException("global-service-id is set but less than 2 prod zones are defined");
}
return findAvailableRotation(instance.id(), lock);
}
@@ -113,23 +110,22 @@ public class RotationRepository {
* @return List of rotation assignments - either new or existing
*/
public List<AssignedRotation> getOrAssignRotations(DeploymentSpec deploymentSpec, Instance instance, RotationLock lock) {
- if (deploymentSpec.requireInstance(instance.name()).globalServiceId().isPresent()
- && ! deploymentSpec.requireInstance(instance.name()).endpoints().isEmpty()) {
+ if (deploymentSpec.globalServiceId().isPresent() && ! deploymentSpec.endpoints().isEmpty()) {
throw new IllegalArgumentException("Cannot provision rotations with both global-service-id and 'endpoints'");
}
// Support the older case of setting global-service-id
- if (deploymentSpec.requireInstance(instance.name()).globalServiceId().isPresent()) {
- var regions = deploymentSpec.requireInstance(instance.name()).zones().stream()
- .filter(zone -> zone.environment().isProduction())
- .flatMap(zone -> zone.region().stream())
- .collect(Collectors.toSet());
+ if (deploymentSpec.globalServiceId().isPresent()) {
+ final var regions = deploymentSpec.zones().stream()
+ .filter(zone -> zone.environment().isProduction())
+ .flatMap(zone -> zone.region().stream())
+ .collect(Collectors.toSet());
- var rotation = getOrAssignRotation(deploymentSpec, instance, lock);
+ final var rotation = getOrAssignRotation(deploymentSpec, instance, lock);
return List.of(
new AssignedRotation(
- new ClusterSpec.Id(deploymentSpec.requireInstance(instance.name()).globalServiceId().get()),
+ new ClusterSpec.Id(deploymentSpec.globalServiceId().get()),
EndpointId.default_(),
rotation.id(),
regions
@@ -137,8 +133,8 @@ public class RotationRepository {
);
}
- Map<EndpointId, AssignedRotation> existingAssignments = existingEndpointAssignments(deploymentSpec, instance);
- Map<EndpointId, AssignedRotation> updatedAssignments = assignRotationsToEndpoints(deploymentSpec, existingAssignments, lock);
+ final Map<EndpointId, AssignedRotation> existingAssignments = existingEndpointAssignments(deploymentSpec, instance);
+ final Map<EndpointId, AssignedRotation> updatedAssignments = assignRotationsToEndpoints(deploymentSpec, existingAssignments, lock);
existingAssignments.putAll(updatedAssignments);
@@ -146,11 +142,11 @@ public class RotationRepository {
}
private Map<EndpointId, AssignedRotation> assignRotationsToEndpoints(DeploymentSpec deploymentSpec, Map<EndpointId, AssignedRotation> existingAssignments, RotationLock lock) {
- var availableRotations = new ArrayList<>(availableRotations(lock).values());
+ final var availableRotations = new ArrayList<>(availableRotations(lock).values());
- var neededRotations = deploymentSpec.endpoints().stream()
- .filter(Predicate.not(endpoint -> existingAssignments.containsKey(EndpointId.of(endpoint.endpointId()))))
- .collect(Collectors.toSet());
+ final var neededRotations = deploymentSpec.endpoints().stream()
+ .filter(Predicate.not(endpoint -> existingAssignments.containsKey(EndpointId.of(endpoint.endpointId()))))
+ .collect(Collectors.toSet());
if (neededRotations.size() > availableRotations.size()) {
throw new IllegalStateException("Hosted Vespa ran out of rotations, unable to assign rotation: need " + neededRotations.size() + ", have " + availableRotations.size());
@@ -176,26 +172,34 @@ public class RotationRepository {
}
private Map<EndpointId, AssignedRotation> existingEndpointAssignments(DeploymentSpec deploymentSpec, Instance instance) {
+ //
// Get the regions that has been configured for an endpoint. Empty set if the endpoint
// is no longer mentioned in the configuration file.
- Function<EndpointId, Set<RegionName>> configuredRegionsForEndpoint = endpointId ->
- deploymentSpec.requireInstance(instance.name()).endpoints().stream()
+ //
+ final Function<EndpointId, Set<RegionName>> configuredRegionsForEndpoint = endpointId -> {
+ return deploymentSpec.endpoints().stream()
.filter(endpoint -> endpointId.id().equals(endpoint.endpointId()))
.map(Endpoint::regions)
.findFirst()
.orElse(Set.of());
+ };
+ //
// Build a new AssignedRotation instance where we update set of regions from the configuration instead
- // of using the one already mentioned in the assignment. This allows us to overwrite the set of regions.
- Function<AssignedRotation, AssignedRotation> assignedRotationWithConfiguredRegions = assignedRotation ->
- new AssignedRotation(
+ // of using the one already mentioned in the assignment. This allows us to overwrite the set of regions
+ // when
+ final Function<AssignedRotation, AssignedRotation> assignedRotationWithConfiguredRegions = assignedRotation -> {
+ return new AssignedRotation(
assignedRotation.clusterId(),
assignedRotation.endpointId(),
assignedRotation.rotationId(),
- configuredRegionsForEndpoint.apply(assignedRotation.endpointId()));
+ configuredRegionsForEndpoint.apply(assignedRotation.endpointId())
+ );
+ };
return instance.rotations().stream()
- .collect(Collectors.toMap(
+ .collect(
+ Collectors.toMap(
AssignedRotation::endpointId,
assignedRotationWithConfiguredRegions,
(a, b) -> {
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java
index e3682a78b7d..ebf80eb9daa 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTest.java
@@ -72,6 +72,7 @@ public class ControllerTest {
@Test
public void testDeployment() {
// Setup system
+ ApplicationController applications = tester.controller().applications();
ApplicationPackage applicationPackage = new ApplicationPackageBuilder()
.environment(Environment.prod)
.region("us-west-1")
@@ -752,7 +753,7 @@ public class ControllerTest {
tester.deployCompletely(application, applicationPackage);
fail("Expected exception");
} catch (IllegalArgumentException e) {
- assertEquals("Endpoint 'default' in instance 'default' cannot contain regions in different clouds: [aws-us-east-1, us-west-1]", e.getMessage());
+ assertEquals("Endpoint 'default' cannot contain regions in different clouds: [aws-us-east-1, us-west-1]", e.getMessage());
}
var applicationPackage2 = new ApplicationPackageBuilder()
@@ -765,7 +766,7 @@ public class ControllerTest {
tester.deployCompletely(application, applicationPackage2);
fail("Expected exception");
} catch (IllegalArgumentException e) {
- assertEquals("Endpoint 'foo' in instance 'default' cannot contain regions in different clouds: [aws-us-east-1, us-west-1]", e.getMessage());
+ assertEquals("Endpoint 'foo' cannot contain regions in different clouds: [aws-us-east-1, us-west-1]", e.getMessage());
}
}
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/ApplicationPackageBuilder.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/ApplicationPackageBuilder.java
index 9449f2b0854..25e562ed046 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/ApplicationPackageBuilder.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/deployment/ApplicationPackageBuilder.java
@@ -47,7 +47,6 @@ public class ApplicationPackageBuilder {
private final List<X509Certificate> trustedCertificates = new ArrayList<>();
private OptionalInt majorVersion = OptionalInt.empty();
- private String instances = "default";
private String upgradePolicy = null;
private Environment environment = Environment.prod;
private String globalServiceId = null;
@@ -59,11 +58,6 @@ public class ApplicationPackageBuilder {
return this;
}
- public ApplicationPackageBuilder instances(String instances) {
- this.instances = instances;
- return this;
- }
-
public ApplicationPackageBuilder upgradePolicy(String upgradePolicy) {
this.upgradePolicy = upgradePolicy;
return this;
@@ -96,7 +90,7 @@ public class ApplicationPackageBuilder {
}
public ApplicationPackageBuilder region(String regionName) {
- environmentBody.append(" <region active='true'>");
+ environmentBody.append(" <region active='true'>");
environmentBody.append(regionName);
environmentBody.append("</region>\n");
return this;
@@ -118,7 +112,7 @@ public class ApplicationPackageBuilder {
public ApplicationPackageBuilder blockChange(boolean revision, boolean version, String daySpec, String hourSpec,
String zoneSpec) {
- blockChange.append(" <block-change");
+ blockChange.append(" <block-change");
blockChange.append(" revision='").append(revision).append("'");
blockChange.append(" version='").append(version).append("'");
blockChange.append(" days='").append(daySpec).append("'");
@@ -172,15 +166,14 @@ public class ApplicationPackageBuilder {
xml.append(athenzIdentityAttributes);
}
xml.append(">\n");
- xml.append(" <instance id='").append(instances).append("'>\n");
if (upgradePolicy != null) {
- xml.append(" <upgrade policy='");
+ xml.append("<upgrade policy='");
xml.append(upgradePolicy);
xml.append("'/>\n");
}
xml.append(notifications);
xml.append(blockChange);
- xml.append(" <");
+ xml.append(" <");
xml.append(environment.value());
if (globalServiceId != null) {
xml.append(" global-service-id='");
@@ -189,14 +182,13 @@ public class ApplicationPackageBuilder {
}
xml.append(">\n");
xml.append(environmentBody);
- xml.append(" </");
+ xml.append(" </");
xml.append(environment.value());
xml.append(">\n");
- xml.append(" <endpoints>\n");
+ xml.append(" <endpoints>\n");
xml.append(endpointsBody);
- xml.append(" </endpoints>\n");
- xml.append(" </instance>\n");
- xml.append("</deployment>\n");
+ xml.append(" </endpoints>\n");
+ xml.append("</deployment>");
return xml.toString().getBytes(UTF_8);
}
diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java
index 9c957785606..7061af3904f 100644
--- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java
+++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiTest.java
@@ -113,18 +113,7 @@ public class ApplicationApiTest extends ControllerContainerTest {
"-----END PUBLIC KEY-----\n";
private static final String quotedPemPublicKey = pemPublicKey.replaceAll("\\n", "\\\\n");
- private static final ApplicationPackage applicationPackageDefault = new ApplicationPackageBuilder()
- .instances("default")
- .environment(Environment.prod)
- .globalServiceId("foo")
- .region("us-central-1")
- .region("us-east-3")
- .region("us-west-1")
- .blockChange(false, true, "mon-fri", "0-8", "UTC")
- .build();
-
- private static final ApplicationPackage applicationPackageInstance1 = new ApplicationPackageBuilder()
- .instances("instance1")
+ private static final ApplicationPackage applicationPackage = new ApplicationPackageBuilder()
.environment(Environment.prod)
.globalServiceId("foo")
.region("us-central-1")
@@ -232,7 +221,7 @@ public class ApplicationApiTest extends ControllerContainerTest {
addUserToHostedOperatorRole(HostedAthenzIdentities.from(HOSTED_VESPA_OPERATOR));
// POST (deploy) an application to a zone - manual user deployment (includes a content hash for verification)
- MultiPartStreamer entity = createApplicationDeployData(applicationPackageInstance1, true);
+ MultiPartStreamer entity = createApplicationDeployData(applicationPackage, true);
tester.assertResponse(request("/application/v4/tenant/tenant1/application/application1/environment/dev/region/us-west-1/instance/instance1/deploy", POST)
.data(entity)
.header("X-Content-Hash", Base64.getEncoder().encodeToString(Signatures.sha256Digest(entity::data)))
@@ -252,7 +241,7 @@ public class ApplicationApiTest extends ControllerContainerTest {
controllerTester.jobCompletion(JobType.component)
.application(id)
.projectId(screwdriverProjectId)
- .uploadArtifact(applicationPackageInstance1)
+ .uploadArtifact(applicationPackage)
.submit();
// ... systemtest
@@ -316,7 +305,6 @@ public class ApplicationApiTest extends ControllerContainerTest {
// POST (create) another application
ApplicationPackage applicationPackage = new ApplicationPackageBuilder()
- .instances("instance1")
.environment(Environment.prod)
.region("us-west-1")
.build();
@@ -593,7 +581,6 @@ public class ApplicationApiTest extends ControllerContainerTest {
// Second attempt has a service under a different domain than the tenant of the application, and fails.
ApplicationPackage packageWithServiceForWrongDomain = new ApplicationPackageBuilder()
- .instances("instance1")
.environment(Environment.prod)
.athenzIdentity(com.yahoo.config.provision.AthenzDomain.from(ATHENZ_TENANT_DOMAIN_2.getName()), AthenzService.from("service"))
.region("us-west-1")
@@ -606,7 +593,6 @@ public class ApplicationApiTest extends ControllerContainerTest {
// Third attempt finally has a service under the domain of the tenant, and succeeds.
ApplicationPackage packageWithService = new ApplicationPackageBuilder()
- .instances("instance1")
.environment(Environment.prod)
.athenzIdentity(com.yahoo.config.provision.AthenzDomain.from(ATHENZ_TENANT_DOMAIN.getName()), AthenzService.from("service"))
.region("us-west-1")
@@ -720,7 +706,6 @@ public class ApplicationApiTest extends ControllerContainerTest {
tester.computeVersionStatus();
createAthenzDomainWithAdmin(ATHENZ_TENANT_DOMAIN, USER_ID);
ApplicationPackage applicationPackage = new ApplicationPackageBuilder()
- .instances("instance1")
.globalServiceId("foo")
.region("us-west-1")
.region("us-east-3")
@@ -729,7 +714,7 @@ public class ApplicationApiTest extends ControllerContainerTest {
// Create tenant and deploy
ApplicationId id = createTenantAndApplication();
long projectId = 1;
- MultiPartStreamer deployData = createApplicationDeployData(Optional.of(applicationPackage), false);
+ MultiPartStreamer deployData = createApplicationDeployData(Optional.empty(), false);
startAndTestChange(controllerTester, id, projectId, applicationPackage, deployData, 100);
// us-west-1
@@ -792,7 +777,6 @@ public class ApplicationApiTest extends ControllerContainerTest {
tester.computeVersionStatus();
createAthenzDomainWithAdmin(ATHENZ_TENANT_DOMAIN, USER_ID);
ApplicationPackage applicationPackage = new ApplicationPackageBuilder()
- .instances("instance1")
.region("us-west-1")
.region("us-east-3")
.region("eu-west-1")
@@ -869,7 +853,7 @@ public class ApplicationApiTest extends ControllerContainerTest {
new com.yahoo.vespa.hosted.controller.api.identifiers.ApplicationId("application1"));
// POST (deploy) an application to a prod zone - allowed when project ID is not specified
- MultiPartStreamer entity = createApplicationDeployData(applicationPackageInstance1, true);
+ MultiPartStreamer entity = createApplicationDeployData(applicationPackage, true);
tester.assertResponse(request("/application/v4/tenant/tenant1/application/application1/environment/prod/region/us-central-1/instance/instance1/deploy", POST)
.data(entity)
.screwdriverIdentity(SCREWDRIVER_ID),
@@ -901,7 +885,6 @@ public class ApplicationApiTest extends ControllerContainerTest {
// Deploy
ApplicationPackage applicationPackage = new ApplicationPackageBuilder()
- .instances("instance1")
.region("us-east-3")
.build();
ApplicationId id = createTenantAndApplication();
@@ -921,7 +904,6 @@ public class ApplicationApiTest extends ControllerContainerTest {
// New zone is added before us-east-3
applicationPackage = new ApplicationPackageBuilder()
- .instances("instance1")
.globalServiceId("foo")
// These decides the ordering of deploymentJobs and instances in the response
.region("us-west-1")
@@ -1074,7 +1056,7 @@ public class ApplicationApiTest extends ControllerContainerTest {
configServer.throwOnNextPrepare(new ConfigServerException(new URI("server-url"), "Failed to prepare application", ConfigServerException.ErrorCode.INVALID_APPLICATION_PACKAGE, null));
// POST (deploy) an application with an invalid application package
- MultiPartStreamer entity = createApplicationDeployData(applicationPackageInstance1, true);
+ MultiPartStreamer entity = createApplicationDeployData(applicationPackage, true);
tester.assertResponse(request("/application/v4/tenant/tenant1/application/application1/environment/dev/region/us-west-1/instance/instance1/deploy", POST)
.data(entity)
.userIdentity(USER_ID),
@@ -1194,7 +1176,7 @@ public class ApplicationApiTest extends ControllerContainerTest {
200);
// Deploy to an authorized zone by a user tenant is disallowed
- MultiPartStreamer entity = createApplicationDeployData(applicationPackageDefault, true);
+ MultiPartStreamer entity = createApplicationDeployData(applicationPackage, true);
tester.assertResponse(request("/application/v4/tenant/tenant1/application/application1/environment/prod/region/us-west-1/instance/default/deploy", POST)
.data(entity)
.userIdentity(USER_ID),
@@ -1607,7 +1589,7 @@ public class ApplicationApiTest extends ControllerContainerTest {
}
private MultiPartStreamer createApplicationDeployData(Optional<ApplicationPackage> applicationPackage,
- Optional<ApplicationVersion> applicationVersion, boolean deployDirectly) {
+ Optional<ApplicationVersion> applicationVersion, boolean deployDirectly) {
MultiPartStreamer streamer = new MultiPartStreamer();
streamer.addJson("deployOptions", deployOptions(deployDirectly, applicationVersion));
applicationPackage.ifPresent(ap -> streamer.addBytes("applicationZip", ap.zippedContent()));