diff options
author | Jon Marius Venstad <jonmv@users.noreply.github.com> | 2017-12-11 14:25:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-11 14:25:38 +0100 |
commit | 891d69cc5eb652885d2b77b639b9b1b1fd71a6d2 (patch) | |
tree | 635136885364cb6d6e1b98da58113a125e5aaff5 /controller-server | |
parent | 361f32665f54c061640c4def02d6132f760d6026 (diff) | |
parent | 9c357854f8945738dd513d6fe7b598c81cda9e77 (diff) |
Merge pull request #4398 from vespa-engine/jvenstad/zone-cleanpu
Jvenstad/zone cleanpu
Diffstat (limited to 'controller-server')
29 files changed, 175 insertions, 173 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Application.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Application.java index 9a7ce69f62a..ae2de96f511 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Application.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/Application.java @@ -7,7 +7,7 @@ import com.yahoo.config.application.api.DeploymentSpec; import com.yahoo.config.application.api.ValidationOverrides; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.Environment; -import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import com.yahoo.vespa.hosted.controller.api.integration.MetricsService.ApplicationMetrics; import com.yahoo.vespa.hosted.controller.api.integration.organization.IssueId; import com.yahoo.vespa.hosted.controller.application.ApplicationRotation; @@ -40,7 +40,7 @@ public class Application { private final ApplicationId id; private final DeploymentSpec deploymentSpec; private final ValidationOverrides validationOverrides; - private final Map<Zone, Deployment> deployments; + private final Map<ZoneId, Deployment> deployments; private final DeploymentJobs deploymentJobs; private final Optional<Change> deploying; private final boolean outstandingChange; @@ -67,7 +67,7 @@ public class Application { } Application(ApplicationId id, DeploymentSpec deploymentSpec, ValidationOverrides validationOverrides, - Map<Zone, Deployment> deployments, DeploymentJobs deploymentJobs, Optional<Change> deploying, + Map<ZoneId, Deployment> deployments, DeploymentJobs deploymentJobs, Optional<Change> deploying, boolean outstandingChange, Optional<IssueId> ownershipIssueId, ApplicationMetrics metrics, Optional<RotationId> rotation) { Objects.requireNonNull(id, "id cannot be null"); @@ -106,13 +106,13 @@ public class Application { public ValidationOverrides validationOverrides() { return validationOverrides; } /** Returns an immutable map of the current deployments of this */ - public Map<Zone, Deployment> deployments() { return deployments; } + public Map<ZoneId, Deployment> deployments() { return deployments; } /** * Returns an immutable map of the current *production* deployments of this * (deployments also includes manually deployed environments) */ - public Map<Zone, Deployment> productionDeployments() { + public Map<ZoneId, Deployment> productionDeployments() { return ImmutableMap.copyOf(deployments.values().stream() .filter(deployment -> deployment.zone().environment() == Environment.prod) .collect(Collectors.toMap(Deployment::zone, Function.identity()))); @@ -151,7 +151,7 @@ public class Application { } /** Returns the version a new deployment to this zone should use for this application */ - public Version deployVersionIn(Zone zone, Controller controller) { + public Version deployVersionIn(ZoneId zone, Controller controller) { if (deploying().isPresent() && deploying().get() instanceof VersionChange) return ((Change.VersionChange) deploying().get()).version(); @@ -159,13 +159,13 @@ public class Application { } /** Returns the current version this application has, or if none; should use, in the given zone */ - public Version versionIn(Zone zone, Controller controller) { + public Version versionIn(ZoneId zone, Controller controller) { return Optional.ofNullable(deployments().get(zone)).map(Deployment::version) // Already deployed in this zone: Use that version .orElse(oldestDeployedVersion().orElse(controller.systemVersion())); } /** Returns the revision a new deployment to this zone should use for this application, or empty if we don't know */ - public Optional<ApplicationRevision> deployRevisionIn(Zone zone) { + public Optional<ApplicationRevision> deployRevisionIn(ZoneId zone) { if (deploying().isPresent() && deploying().get() instanceof Change.ApplicationChange) return ((Change.ApplicationChange) deploying().get()).revision(); @@ -173,7 +173,7 @@ public class Application { } /** Returns the revision this application is or should be deployed with in the given zone, or empty if unknown. */ - public Optional<ApplicationRevision> revisionIn(Zone zone) { + public Optional<ApplicationRevision> revisionIn(ZoneId zone) { return Optional.ofNullable(deployments().get(zone)).map(Deployment::revision); } 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 43133cc0d70..3f64562f2d2 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 @@ -8,6 +8,7 @@ import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.TenantName; import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import com.yahoo.vespa.curator.Lock; import com.yahoo.vespa.hosted.controller.api.ActivateResult; import com.yahoo.vespa.hosted.controller.api.InstanceEndpoints; @@ -267,7 +268,7 @@ public class ApplicationController { /** Deploys an application. If the application does not exist it is created. */ // TODO: Get rid of the options arg - public ActivateResult deployApplication(ApplicationId applicationId, Zone zone, + public ActivateResult deployApplication(ApplicationId applicationId, ZoneId zone, ApplicationPackage applicationPackage, DeployOptions options) { try (Lock lock = lock(applicationId)) { // TODO: Shouldn't this go through the above method? Seems you can cheat the checks here ... ? @@ -368,7 +369,7 @@ public class ApplicationController { } } - private ActivateResult unexpectedDeployment(ApplicationId applicationId, Zone zone, ApplicationPackage applicationPackage) { + private ActivateResult unexpectedDeployment(ApplicationId applicationId, ZoneId zone, ApplicationPackage applicationPackage) { Log logEntry = new Log(); logEntry.level = "WARNING"; logEntry.time = clock.instant().toEpochMilli(); @@ -405,9 +406,9 @@ public class ApplicationController { private LockedApplication deleteUnreferencedDeploymentJobs(LockedApplication application) { for (DeploymentJobs.JobType job : application.deploymentJobs().jobStatus().keySet()) { - Optional<Zone> zone = job.zone(controller.system()); + Optional<ZoneId> zone = job.zone(controller.system()); - if ( ! job.isProduction() || (zone.isPresent() && application.deploymentSpec().includes(zone.get().environment(), zone.map(Zone::region)))) + if ( ! job.isProduction() || (zone.isPresent() && application.deploymentSpec().includes(zone.get().environment(), zone.map(ZoneId::region)))) continue; application = application.withoutDeploymentJob(job); } @@ -475,7 +476,7 @@ public class ApplicationController { } /** Get an available rotation, if deploying to a production zone and a service ID is specified */ - private Optional<Rotation> getRotation(Application application, Zone zone, RotationLock lock) { + private Optional<Rotation> getRotation(Application application, ZoneId zone, RotationLock lock) { if (zone.environment() != Environment.prod || !application.deploymentSpec().globalServiceId().isPresent()) { return Optional.empty(); @@ -590,7 +591,7 @@ public class ApplicationController { } /** Deactivate application in the given zone */ - public void deactivate(Application application, Zone zone) { + public void deactivate(Application application, ZoneId zone) { deactivate(application, zone, Optional.empty(), false); } @@ -599,7 +600,7 @@ public class ApplicationController { deactivate(application, deployment.zone(), Optional.of(deployment), requireThatDeploymentHasExpired); } - private void deactivate(Application application, Zone zone, Optional<Deployment> deployment, + private void deactivate(Application application, ZoneId zone, Optional<Deployment> deployment, boolean requireThatDeploymentHasExpired) { if (requireThatDeploymentHasExpired && deployment.isPresent() && ! DeploymentExpirer.hasExpired(controller.zoneRegistry(), deployment.get(), clock.instant())) @@ -614,7 +615,7 @@ public class ApplicationController { * * @return the application with the deployment in the given zone removed */ - private LockedApplication deactivate(LockedApplication application, Zone zone) { + private LockedApplication deactivate(LockedApplication application, ZoneId zone) { try { configserverClient.deactivate(new DeploymentId(application.id(), zone)); } @@ -644,7 +645,7 @@ public class ApplicationController { } /** Returns whether a direct deployment to given zone is allowed */ - private static boolean canDeployDirectlyTo(Zone zone, DeployOptions options) { + private static boolean canDeployDirectlyTo(ZoneId zone, DeployOptions options) { return ! options.screwdriverBuildJob.isPresent() || options.screwdriverBuildJob.get().screwdriverId == null || zone.environment().isManuallyDeployed(); diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/LockedApplication.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/LockedApplication.java index d96739dd0a0..72ed1a42435 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/LockedApplication.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/LockedApplication.java @@ -6,6 +6,7 @@ import com.yahoo.config.application.api.ValidationOverrides; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.ClusterSpec; import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import com.yahoo.vespa.curator.Lock; import com.yahoo.vespa.hosted.controller.api.integration.MetricsService; import com.yahoo.vespa.hosted.controller.api.integration.MetricsService.ApplicationMetrics; @@ -68,7 +69,7 @@ public class LockedApplication extends Application { return new LockedApplication(new Builder(this).with(deploymentJobs().withTriggering(type, change, version, revision, reason, triggerTime))); } - public LockedApplication withNewDeployment(Zone zone, ApplicationRevision revision, Version version, Instant instant) { + public LockedApplication withNewDeployment(ZoneId zone, ApplicationRevision revision, Version version, Instant instant) { // Use info from previous deployment if available, otherwise create a new one. Deployment previousDeployment = deployments().getOrDefault(zone, new Deployment(zone, revision, version, instant)); Deployment newDeployment = new Deployment(zone, revision, version, instant, @@ -78,27 +79,27 @@ public class LockedApplication extends Application { return with(newDeployment); } - public LockedApplication withClusterUtilization(Zone zone, Map<ClusterSpec.Id, ClusterUtilization> clusterUtilization) { + public LockedApplication withClusterUtilization(ZoneId zone, Map<ClusterSpec.Id, ClusterUtilization> clusterUtilization) { Deployment deployment = deployments().get(zone); if (deployment == null) return this; // No longer deployed in this zone. return with(deployment.withClusterUtils(clusterUtilization)); } - public LockedApplication withClusterInfo(Zone zone, Map<ClusterSpec.Id, ClusterInfo> clusterInfo) { + public LockedApplication withClusterInfo(ZoneId zone, Map<ClusterSpec.Id, ClusterInfo> clusterInfo) { Deployment deployment = deployments().get(zone); if (deployment == null) return this; // No longer deployed in this zone. return with(deployment.withClusterInfo(clusterInfo)); } - public LockedApplication with(Zone zone, DeploymentMetrics deploymentMetrics) { + public LockedApplication with(ZoneId zone, DeploymentMetrics deploymentMetrics) { Deployment deployment = deployments().get(zone); if (deployment == null) return this; // No longer deployed in this zone. return with(deployment.withMetrics(deploymentMetrics)); } - public LockedApplication withoutDeploymentIn(Zone zone) { - Map<Zone, Deployment> deployments = new LinkedHashMap<>(deployments()); + public LockedApplication withoutDeploymentIn(ZoneId zone) { + Map<ZoneId, Deployment> deployments = new LinkedHashMap<>(deployments()); deployments.remove(zone); return new LockedApplication(new Builder(this).with(deployments)); } @@ -149,7 +150,7 @@ public class LockedApplication extends Application { /** Don't expose non-leaf sub-objects. */ private LockedApplication with(Deployment deployment) { - Map<Zone, Deployment> deployments = new LinkedHashMap<>(deployments()); + Map<ZoneId, Deployment> deployments = new LinkedHashMap<>(deployments()); deployments.put(deployment.zone(), deployment); return new LockedApplication(new Builder(this).with(deployments)); } @@ -160,7 +161,7 @@ public class LockedApplication extends Application { private final ApplicationId applicationId; private DeploymentSpec deploymentSpec; private ValidationOverrides validationOverrides; - private Map<Zone, Deployment> deployments; + private Map<ZoneId, Deployment> deployments; private DeploymentJobs deploymentJobs; private Optional<Change> deploying; private boolean hasOutstandingChange; @@ -191,7 +192,7 @@ public class LockedApplication extends Application { return this; } - private Builder with(Map<Zone, Deployment> deployments) { + private Builder with(Map<ZoneId, Deployment> deployments) { this.deployments = deployments; return this; } diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Deployment.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Deployment.java index 98ae5ed1762..b9d07249cb2 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Deployment.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/Deployment.java @@ -4,6 +4,7 @@ package com.yahoo.vespa.hosted.controller.application; import com.yahoo.component.Version; import com.yahoo.config.provision.ClusterSpec.Id; import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import java.time.Instant; import java.util.HashMap; @@ -18,7 +19,7 @@ import java.util.Objects; */ public class Deployment { - private final Zone zone; + private final ZoneId zone; private final ApplicationRevision revision; private final Version version; private final Instant deployTime; @@ -26,11 +27,11 @@ public class Deployment { private final Map<Id, ClusterInfo> clusterInfo; private final DeploymentMetrics metrics; - public Deployment(Zone zone, ApplicationRevision revision, Version version, Instant deployTime) { + public Deployment(ZoneId zone, ApplicationRevision revision, Version version, Instant deployTime) { this(zone, revision, version, deployTime, new HashMap<>(), new HashMap<>(), new DeploymentMetrics()); } - public Deployment(Zone zone, ApplicationRevision revision, Version version, Instant deployTime, + public Deployment(ZoneId zone, ApplicationRevision revision, Version version, Instant deployTime, Map<Id, ClusterUtilization> clusterUtils, Map<Id, ClusterInfo> clusterInfo, DeploymentMetrics metrics) { Objects.requireNonNull(zone, "zone cannot be null"); Objects.requireNonNull(revision, "revision cannot be null"); @@ -49,7 +50,7 @@ public class Deployment { } /** Returns the zone this was deployed to */ - public Zone zone() { return zone; } + public ZoneId zone() { return zone; } /** Returns the revision of the application which was deployed */ public ApplicationRevision revision() { return revision; } diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/DeploymentJobs.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/DeploymentJobs.java index 98f8c2a3d99..ec8b2d6d019 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/DeploymentJobs.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/application/DeploymentJobs.java @@ -7,19 +7,17 @@ import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.RegionName; import com.yahoo.config.provision.SystemName; -import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import com.yahoo.vespa.hosted.controller.Controller; import com.yahoo.vespa.hosted.controller.api.integration.organization.IssueId; import java.time.Instant; import java.util.Collection; -import java.util.Comparator; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; import java.util.Objects; import java.util.Optional; -import java.util.stream.Collectors; import java.util.stream.Stream; /** @@ -161,34 +159,36 @@ public class DeploymentJobs { /** Job types that exist in the build system */ public enum JobType { - - component ("component" ), - systemTest ("system-test" , zone("test" , "us-east-1" ), zone(SystemName.cd, "test" , "cd-us-central-1")), - stagingTest ("staging-test" , zone("staging", "us-east-3" ), zone(SystemName.cd, "staging", "cd-us-central-1")), - productionCorpUsEast1 ("production-corp-us-east-1" , zone("prod" , "corp-us-east-1")), - productionUsEast3 ("production-us-east-3" , zone("prod" , "us-east-3" )), - productionUsWest1 ("production-us-west-1" , zone("prod" , "us-west-1" )), - productionUsCentral1 ("production-us-central-1" , zone("prod" , "us-central-1" )), - productionApNortheast1 ("production-ap-northeast-1" , zone("prod" , "ap-northeast-1")), - productionApNortheast2 ("production-ap-northeast-2" , zone("prod" , "ap-northeast-2")), - productionApSoutheast1 ("production-ap-southeast-1" , zone("prod" , "ap-southeast-1")), - productionEuWest1 ("production-eu-west-1" , zone("prod" , "eu-west-1" )), - productionCdUsCentral1 ("production-cd-us-central-1", zone(SystemName.cd, "prod", "cd-us-central-1")), - productionCdUsCentral2 ("production-cd-us-central-2", zone(SystemName.cd, "prod", "cd-us-central-2")); +// | enum name ------------| job name ------------------| Zone in main system ---------------------------------------| Zone in CD system ------------------------------------------- + component ("component" , null , null ), + systemTest ("system-test" , ZoneId.from("test" , "us-east-1") , ZoneId.from("test" , "cd-us-central-1")), + stagingTest ("staging-test" , ZoneId.from("staging", "us-east-3") , ZoneId.from("staging", "cd-us-central-1")), + productionCorpUsEast1 ("production-corp-us-east-1" , ZoneId.from("prod" , "corp-us-east-1") , null ), + productionUsEast3 ("production-us-east-3" , ZoneId.from("prod" , "us-east-3") , null ), + productionUsWest1 ("production-us-west-1" , ZoneId.from("prod" , "us-west-1") , null ), + productionUsCentral1 ("production-us-central-1" , ZoneId.from("prod" , "us-central-1") , null ), + productionApNortheast1 ("production-ap-northeast-1" , ZoneId.from("prod" , "ap-northeast-1") , null ), + productionApNortheast2 ("production-ap-northeast-2" , ZoneId.from("prod" , "ap-northeast-2") , null ), + productionApSoutheast1 ("production-ap-southeast-1" , ZoneId.from("prod" , "ap-southeast-1") , null ), + productionEuWest1 ("production-eu-west-1" , ZoneId.from("prod" , "eu-west-1") , null ), + productionCdUsCentral1 ("production-cd-us-central-1", null , ZoneId.from("prod" , "cd-us-central-1")), + productionCdUsCentral2 ("production-cd-us-central-2", null , ZoneId.from("prod" , "cd-us-central-2")); private final String jobName; - private final ImmutableMap<SystemName, Zone> zones; + private final ImmutableMap<SystemName, ZoneId> zones; - JobType(String jobName, Zone... zones) { + JobType(String jobName, ZoneId mainZone, ZoneId cdZone) { this.jobName = jobName; - this.zones = ImmutableMap.copyOf(Stream.of(zones).collect(Collectors.toMap(zone -> zone.system(), - zone -> zone))); + ImmutableMap.Builder<SystemName, ZoneId> builder = ImmutableMap.builder(); + if (mainZone != null) builder.put(SystemName.main, mainZone); + if (cdZone != null) builder.put(SystemName.cd, cdZone); + this.zones = builder.build(); } public String jobName() { return jobName; } /** Returns the zone for this job in the given system, or empty if this job does not have a zone */ - public Optional<Zone> zone(SystemName system) { + public Optional<ZoneId> zone(SystemName system) { return Optional.ofNullable(zones.get(system)); } @@ -207,7 +207,7 @@ public class DeploymentJobs { /** Returns the region of this job type, or null if it does not have a region */ public Optional<RegionName> region(SystemName system) { - return zone(system).map(Zone::region); + return zone(system).map(ZoneId::region); } public static JobType fromJobName(String jobName) { @@ -217,7 +217,7 @@ public class DeploymentJobs { } /** Returns the job type for the given zone */ - public static Optional<JobType> from(SystemName system, Zone zone) { + public static Optional<JobType> from(SystemName system, ZoneId zone) { return Stream.of(values()) .filter(job -> job.zone(system).filter(zone::equals).isPresent()) .findAny(); @@ -229,16 +229,9 @@ public class DeploymentJobs { case test: return Optional.of(systemTest); case staging: return Optional.of(stagingTest); } - return from(system, new Zone(environment, region)); - } - - private static Zone zone(SystemName system, String environment, String region) { - return new Zone(system, Environment.from(environment), RegionName.from(region)); + return from(system, ZoneId.from(environment, region)); } - private static Zone zone(String environment, String region) { - return new Zone(Environment.from(environment), RegionName.from(region)); - } } /** A job report. This class is immutable. */ diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentOrder.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentOrder.java index aa4d07634db..2bf64571bdf 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentOrder.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/deployment/DeploymentOrder.java @@ -2,7 +2,7 @@ package com.yahoo.vespa.hosted.controller.deployment; import com.yahoo.config.application.api.DeploymentSpec; -import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import com.yahoo.vespa.hosted.controller.Application; import com.yahoo.vespa.hosted.controller.Controller; import com.yahoo.vespa.hosted.controller.LockedApplication; @@ -105,9 +105,9 @@ public class DeploymentOrder { /** Returns deployments sorted according to declared zones */ public List<Deployment> sortBy(List<DeploymentSpec.DeclaredZone> zones, Collection<Deployment> deployments) { - List<Zone> productionZones = zones.stream() + List<ZoneId> productionZones = zones.stream() .filter(z -> z.region().isPresent()) - .map(z -> new Zone(z.environment(), z.region().get())) + .map(z -> ZoneId.from(z.environment(), z.region().get())) .collect(toList()); return deployments.stream() .sorted(comparingInt(deployment -> productionZones.indexOf(deployment.zone()))) 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 dada11ca436..f0c950b024b 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 @@ -4,7 +4,7 @@ package com.yahoo.vespa.hosted.controller.deployment; import com.yahoo.component.Version; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.SystemName; -import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import com.yahoo.vespa.hosted.controller.Application; import com.yahoo.vespa.hosted.controller.ApplicationController; import com.yahoo.vespa.hosted.controller.Controller; @@ -358,7 +358,7 @@ public class DeploymentTrigger { */ private boolean isOnNewerVersionInProductionThan(Version version, Application application, JobType job) { if ( ! job.isProduction()) return false; - Optional<Zone> zone = job.zone(controller.system()); + Optional<ZoneId> zone = job.zone(controller.system()); if ( ! zone.isPresent()) return false; Deployment existingDeployment = application.deployments().get(zone.get()); if (existingDeployment == null) return false; diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ClusterInfoMaintainer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ClusterInfoMaintainer.java index f7284272b38..ad7fa90967b 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ClusterInfoMaintainer.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ClusterInfoMaintainer.java @@ -4,6 +4,7 @@ package com.yahoo.vespa.hosted.controller.maintenance; import com.yahoo.config.provision.ClusterSpec; import com.yahoo.config.provision.Flavor; import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import com.yahoo.vespa.hosted.controller.Application; import com.yahoo.vespa.hosted.controller.Controller; import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId; @@ -44,7 +45,7 @@ public class ClusterInfoMaintainer extends Maintainer { return node.membership.clusterId; } - private Map<ClusterSpec.Id, ClusterInfo> getClusterInfo(NodeList nodes, Zone zone) { + private Map<ClusterSpec.Id, ClusterInfo> getClusterInfo(NodeList nodes, ZoneId zone) { Map<ClusterSpec.Id, ClusterInfo> infoMap = new HashMap<>(); // Group nodes by clusterid @@ -63,7 +64,8 @@ public class ClusterInfoMaintainer extends Maintainer { double cpu = 0; double mem = 0; double disk = 0; - if (zone.nodeFlavors().isPresent()) { + // TODO: This code was never run. Reenable when flavours are available from a FlavorRegistry or something, or remove. + /*if (zone.nodeFlavors().isPresent()) { Optional<Flavor> flavorOptional = zone.nodeFlavors().get().getFlavor(node.flavor); if ((flavorOptional.isPresent())) { Flavor flavor = flavorOptional.get(); @@ -71,7 +73,7 @@ public class ClusterInfoMaintainer extends Maintainer { mem = flavor.getMinMainMemoryAvailableGb(); disk = flavor.getMinMainMemoryAvailableGb(); } - } + }*/ // Add to map List<String> hostnames = clusterNodes.stream().map(node1 -> node1.hostname).collect(Collectors.toList()); diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ClusterUtilizationMaintainer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ClusterUtilizationMaintainer.java index 0d472ab0910..58e32344372 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ClusterUtilizationMaintainer.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/maintenance/ClusterUtilizationMaintainer.java @@ -3,7 +3,7 @@ package com.yahoo.vespa.hosted.controller.maintenance; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.ClusterSpec; -import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import com.yahoo.vespa.hosted.controller.Application; import com.yahoo.vespa.hosted.controller.Controller; import com.yahoo.vespa.hosted.controller.api.integration.MetricsService; @@ -29,7 +29,7 @@ public class ClusterUtilizationMaintainer extends Maintainer { this.controller = controller; } - private Map<ClusterSpec.Id, ClusterUtilization> getUpdatedClusterUtilizations(ApplicationId app, Zone zone) { + private Map<ClusterSpec.Id, ClusterUtilization> getUpdatedClusterUtilizations(ApplicationId app, ZoneId zone) { Map<String, MetricsService.SystemMetrics> systemMetrics = controller.metricsService().getSystemMetrics(app, zone); Map<ClusterSpec.Id, ClusterUtilization> utilizationMap = new HashMap<>(); diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializer.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializer.java index c71409aaba9..762f12c3e8a 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializer.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializer.java @@ -8,7 +8,7 @@ import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.ClusterSpec; import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.RegionName; -import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import com.yahoo.slime.ArrayTraverser; import com.yahoo.slime.Cursor; import com.yahoo.slime.Inspector; @@ -142,7 +142,7 @@ public class ApplicationSerializer { } private void deploymentToSlime(Deployment deployment, Cursor object) { - zoneToSlime(deployment.zone(), object.setObject(zoneField)); + zoneIdToSlime(deployment.zone(), object.setObject(zoneField)); object.setString(versionField, deployment.version().toString()); object.setLong(deployTimeField, deployment.at().toEpochMilli()); toSlime(deployment.revision(), object.setObject(applicationPackageRevisionField)); @@ -194,7 +194,7 @@ public class ApplicationSerializer { object.setDouble(clusterUtilsDiskBusyField, utils.getDiskBusy()); } - private void zoneToSlime(Zone zone, Cursor object) { + private void zoneIdToSlime(ZoneId zone, Cursor object) { object.setString(environmentField, zone.environment().value()); object.setString(regionField, zone.region().value()); } @@ -283,13 +283,13 @@ public class ApplicationSerializer { } private Deployment deploymentFromSlime(Inspector deploymentObject) { - return new Deployment(zoneFromSlime(deploymentObject.field(zoneField)), + return new Deployment(zoneIdFromSlime(deploymentObject.field(zoneField)), applicationRevisionFromSlime(deploymentObject.field(applicationPackageRevisionField)).get(), Version.fromString(deploymentObject.field(versionField).asString()), Instant.ofEpochMilli(deploymentObject.field(deployTimeField).asLong()), - clusterUtilsMapFromSlime(deploymentObject.field(clusterUtilsField)), - clusterInfoMapFromSlime(deploymentObject.field(clusterInfoField)), - deploymentMetricsFromSlime(deploymentObject.field(deploymentMetricsField))); + clusterUtilsMapFromSlime(deploymentObject.field(clusterUtilsField)), + clusterInfoMapFromSlime(deploymentObject.field(clusterInfoField)), + deploymentMetricsFromSlime(deploymentObject.field(deploymentMetricsField))); } private DeploymentMetrics deploymentMetricsFromSlime(Inspector object) { @@ -338,9 +338,8 @@ public class ApplicationSerializer { return new ClusterInfo(flavor, cost, flavorCpu, flavorMem, flavorDisk, ClusterSpec.Type.from(type), hostnames); } - private Zone zoneFromSlime(Inspector object) { - return new Zone(Environment.from(object.field(environmentField).asString()), - RegionName.from(object.field(regionField).asString())); + private ZoneId zoneIdFromSlime(Inspector object) { + return ZoneId.from(object.field(environmentField).asString(), object.field(regionField).asString()); } private Optional<ApplicationRevision> applicationRevisionFromSlime(Inspector object) { diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/proxy/ConfigServerRestExecutorImpl.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/proxy/ConfigServerRestExecutorImpl.java index e8b68d0c55a..c9ce0b76520 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/proxy/ConfigServerRestExecutorImpl.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/proxy/ConfigServerRestExecutorImpl.java @@ -5,7 +5,7 @@ import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.ObjectMapper; import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.RegionName; -import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import com.yahoo.io.IOUtils; import com.yahoo.jdisc.http.HttpRequest.Method; import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneRegistry; @@ -83,8 +83,8 @@ public class ConfigServerRestExecutorImpl implements ConfigServerRestExecutor { ObjectMapper mapper = new ObjectMapper(); DiscoveryResponseStructure responseStructure = new DiscoveryResponseStructure(); - List<Zone> zones = zoneRegistry.zones(); - for (Zone zone : zones) { + List<ZoneId> zones = zoneRegistry.zones(); + for (ZoneId zone : zones) { if (!"".equals(proxyRequest.getEnvironment()) && !proxyRequest.getEnvironment().equals(zone.environment().value())) { continue; diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java index d64f07906ab..4e3b96b40df 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ApplicationApiHandler.java @@ -10,7 +10,7 @@ import com.yahoo.config.provision.ApplicationName; import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.RegionName; import com.yahoo.config.provision.TenantName; -import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import com.yahoo.container.jdisc.HttpRequest; import com.yahoo.container.jdisc.HttpResponse; import com.yahoo.container.jdisc.LoggingRequestHandler; @@ -423,7 +423,7 @@ public class ApplicationApiHandler extends LoggingRequestHandler { .orElseThrow(() -> new NotExistsException(id + " not found")); DeploymentId deploymentId = new DeploymentId(application.id(), - new Zone(Environment.from(environment), RegionName.from(region))); + ZoneId.from(environment, region)); Deployment deployment = application.deployments().get(deploymentId.zone()); if (deployment == null) @@ -514,7 +514,7 @@ public class ApplicationApiHandler extends LoggingRequestHandler { // DeploymentId identifies the zone and application we are dealing with DeploymentId deploymentId = new DeploymentId(ApplicationId.from(tenantName, applicationName, instanceName), - new Zone(Environment.from(environment), RegionName.from(region))); + ZoneId.from(environment, region)); try { List<String> rotations = controller.applications().setGlobalRotationStatus(deploymentId, endPointStatus); return new MessageResponse(String.format("Rotations %s successfully set to %s service", rotations.toString(), inService ? "in" : "out of")); @@ -526,7 +526,7 @@ public class ApplicationApiHandler extends LoggingRequestHandler { private HttpResponse getGlobalRotationOverride(String tenantName, String applicationName, String instanceName, String environment, String region) { DeploymentId deploymentId = new DeploymentId(ApplicationId.from(tenantName, applicationName, instanceName), - new Zone(Environment.from(environment), RegionName.from(region))); + ZoneId.from(environment, region)); Slime slime = new Slime(); Cursor c1 = slime.setObject().setArray("globalrotationoverride"); @@ -571,13 +571,13 @@ public class ApplicationApiHandler extends LoggingRequestHandler { private HttpResponse waitForConvergence(String tenantName, String applicationName, String instanceName, String environment, String region, HttpRequest request) { return new JacksonJsonResponse(controller.waitForConfigConvergence(new DeploymentId(ApplicationId.from(tenantName, applicationName, instanceName), - new Zone(Environment.from(environment), RegionName.from(region))), + ZoneId.from(environment, region)), asLong(request.getProperty("timeout"), 1000))); } private HttpResponse services(String tenantName, String applicationName, String instanceName, String environment, String region, HttpRequest request) { ApplicationView applicationView = controller.getApplicationView(tenantName, applicationName, instanceName, environment, region); - ServiceApiResponse response = new ServiceApiResponse(new Zone(Environment.from(environment), RegionName.from(region)), + ServiceApiResponse response = new ServiceApiResponse(ZoneId.from(environment, region), new ApplicationId.Builder().tenant(tenantName).applicationName(applicationName).instanceName(instanceName).build(), controller.getConfigServerUris(Environment.from(environment), RegionName.from(region)), request.getUri()); @@ -587,7 +587,7 @@ public class ApplicationApiHandler extends LoggingRequestHandler { private HttpResponse service(String tenantName, String applicationName, String instanceName, String environment, String region, String serviceName, String restPath, HttpRequest request) { Map<?,?> result = controller.getServiceApiResponse(tenantName, applicationName, instanceName, environment, region, serviceName, restPath); - ServiceApiResponse response = new ServiceApiResponse(new Zone(Environment.from(environment), RegionName.from(region)), + ServiceApiResponse response = new ServiceApiResponse(ZoneId.from(environment, region), new ApplicationId.Builder().tenant(tenantName).applicationName(applicationName).instanceName(instanceName).build(), controller.getConfigServerUris(Environment.from(environment), RegionName.from(region)), request.getUri()); @@ -737,7 +737,7 @@ public class ApplicationApiHandler extends LoggingRequestHandler { /** Schedule restart of deployment, or specific host in a deployment */ private HttpResponse restart(String tenantName, String applicationName, String instanceName, String environment, String region, HttpRequest request) { DeploymentId deploymentId = new DeploymentId(ApplicationId.from(tenantName, applicationName, instanceName), - new Zone(Environment.from(environment), RegionName.from(region))); + ZoneId.from(environment, region)); // TODO: Propagate all filters Optional<Hostname> hostname = Optional.ofNullable(request.getProperty("hostname")).map(Hostname::new); controller.applications().restart(deploymentId, hostname); @@ -758,7 +758,7 @@ public class ApplicationApiHandler extends LoggingRequestHandler { private HttpResponse log(String tenantName, String applicationName, String instanceName, String environment, String region) { try { DeploymentId deploymentId = new DeploymentId(ApplicationId.from(tenantName, applicationName, instanceName), - new Zone(Environment.from(environment), RegionName.from(region))); + ZoneId.from(environment, region)); return new JacksonJsonResponse(controller.grabLog(deploymentId)); } catch (RuntimeException e) { @@ -770,7 +770,7 @@ public class ApplicationApiHandler extends LoggingRequestHandler { private HttpResponse deploy(String tenantName, String applicationName, String instanceName, String environment, String region, HttpRequest request) { ApplicationId applicationId = ApplicationId.from(tenantName, applicationName, instanceName); - Zone zone = new Zone(Environment.from(environment), RegionName.from(region)); + ZoneId zone = ZoneId.from(environment, region); Map<String, byte[]> dataParts = new MultipartParser().parse(request); if ( ! dataParts.containsKey("deployOptions")) @@ -821,7 +821,7 @@ public class ApplicationApiHandler extends LoggingRequestHandler { private HttpResponse deactivate(String tenantName, String applicationName, String instanceName, String environment, String region) { Application application = controller.applications().require(ApplicationId.from(tenantName, applicationName, instanceName)); - Zone zone = new Zone(Environment.from(environment), RegionName.from(region)); + ZoneId zone = ZoneId.from(environment, region); Deployment deployment = application.deployments().get(zone); if (deployment == null) { // Attempt to deactivate application even if the deployment is not known by the controller diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ServiceApiResponse.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ServiceApiResponse.java index 6a448e475c5..0b0a2c3ad52 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ServiceApiResponse.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/application/ServiceApiResponse.java @@ -2,7 +2,7 @@ package com.yahoo.vespa.hosted.controller.restapi.application; import com.yahoo.config.provision.ApplicationId; -import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import com.yahoo.container.jdisc.HttpResponse; import com.yahoo.slime.Cursor; import com.yahoo.slime.JsonFormat; @@ -30,7 +30,7 @@ import java.util.regex.Pattern; */ class ServiceApiResponse extends HttpResponse { - private final Zone zone; + private final ZoneId zone; private final ApplicationId application; private final List<URI> configServerURIs; private final Slime slime; @@ -40,7 +40,7 @@ class ServiceApiResponse extends HttpResponse { private String serviceName = null; private String restPath = null; - public ServiceApiResponse(Zone zone, ApplicationId application, List<URI> configServerURIs, URI requestUri) { + public ServiceApiResponse(ZoneId zone, ApplicationId application, List<URI> configServerURIs, URI requestUri) { super(200); this.zone = zone; this.application = application; diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/zone/v1/ZoneApiHandler.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/zone/v1/ZoneApiHandler.java index 3a3fd445bcf..aecd3847653 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/zone/v1/ZoneApiHandler.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/restapi/zone/v1/ZoneApiHandler.java @@ -3,7 +3,7 @@ package com.yahoo.vespa.hosted.controller.restapi.zone.v1; import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.RegionName; -import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import com.yahoo.container.jdisc.HttpRequest; import com.yahoo.container.jdisc.HttpResponse; import com.yahoo.container.jdisc.LoggingRequestHandler; @@ -70,7 +70,7 @@ public class ZoneApiHandler extends LoggingRequestHandler { private HttpResponse root(HttpRequest request) { List<Environment> environments = zoneRegistry.zones().stream() - .map(Zone::environment) + .map(ZoneId::environment) .distinct() .sorted(Comparator.comparing(Environment::value)) .collect(Collectors.toList()); @@ -89,7 +89,7 @@ public class ZoneApiHandler extends LoggingRequestHandler { } private HttpResponse environment(HttpRequest request, Environment environment) { - List<Zone> zones = zoneRegistry.zones().stream() + List<ZoneId> zones = zoneRegistry.zones().stream() .filter(zone -> zone.environment() == environment) .collect(Collectors.toList()); Slime slime = new Slime(); 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 529b2b25785..3f85b0116ad 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 @@ -3,7 +3,7 @@ package com.yahoo.vespa.hosted.controller.restapi.zone.v2; import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.RegionName; -import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import com.yahoo.container.jdisc.HttpRequest; import com.yahoo.container.jdisc.HttpResponse; import com.yahoo.container.jdisc.LoggingRequestHandler; @@ -81,7 +81,7 @@ public class ZoneApiHandler extends LoggingRequestHandler { } Environment environment = Environment.from(path.get("environment")); RegionName region = RegionName.from(path.get("region")); - Optional<Zone> zone = zoneRegistry.getZone(environment, region); + Optional<ZoneId> zone = zoneRegistry.getZone(environment, region); if (!zone.isPresent()) { throw new IllegalArgumentException("No such zone: " + environment.value() + "." + region.value()); } 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 3363981d6c0..8af95f6b612 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 @@ -11,6 +11,7 @@ import com.yahoo.config.provision.RegionName; import com.yahoo.config.provision.SystemName; import com.yahoo.config.provision.TenantName; import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import com.yahoo.vespa.config.SlimeUtils; import com.yahoo.vespa.hosted.controller.api.Tenant; import com.yahoo.vespa.hosted.controller.api.application.v4.model.DeployOptions; @@ -496,7 +497,7 @@ public class ControllerTest { public void testGlobalRotations() throws IOException { // Setup tester and app def ControllerTester tester = new ControllerTester(); - Zone zone = Zone.defaultZone(); + ZoneId zone = ZoneId.from(Environment.defaultEnvironment(), RegionName.defaultName()); ApplicationId appId = tester.applicationId("tenant", "app1", "default"); DeploymentId deployId = new DeploymentId(appId, zone); @@ -529,7 +530,7 @@ public class ControllerTest { application = application.withDeploying(Optional.of(new Change.VersionChange(Version.fromString("6.3")))); applications.store(application); try { - tester.deploy(app, new Zone(Environment.prod, RegionName.from("us-east-3"))); + tester.deploy(app, ZoneId.from("prod", "us-east-3")); fail("Expected exception"); } catch (IllegalArgumentException e) { assertEquals("Rejecting deployment of application 'tenant1.app1' to zone prod.us-east-3 as version change to 6.3 is not tested", e.getMessage()); @@ -649,8 +650,8 @@ public class ControllerTest { .build(); tester.notifyJobCompletion(component, app1, true); tester.deployAndNotify(app1, applicationPackage, true, systemTest); - tester.applications().deactivate(app1, new Zone(Environment.test, RegionName.from("us-east-1"))); - tester.applications().deactivate(app1, new Zone(Environment.staging, RegionName.from("us-east-3"))); + tester.applications().deactivate(app1, ZoneId.from(Environment.test, RegionName.from("us-east-1"))); + tester.applications().deactivate(app1, ZoneId.from(Environment.staging, RegionName.from("us-east-3"))); tester.applications().deleteApplication(app1.id(), Optional.of(new NToken("ntoken"))); try (RotationLock lock = tester.applications().rotationRepository().lock()) { assertTrue("Rotation is unassigned", @@ -721,7 +722,7 @@ public class ControllerTest { Application app = tester.createApplication("app1", "tenant1", 1, 2L); // Direct deploy is allowed when project ID is missing - Zone zone = new Zone(Environment.prod, RegionName.from("cd-us-central-1")); + ZoneId zone = ZoneId.from("prod", "cd-us-central-1"); // Same options as used in our integration tests DeployOptions options = new DeployOptions(Optional.empty(), Optional.empty(), false, false); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTester.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTester.java index bdb8160a3f6..52e1b3ae400 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTester.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ControllerTester.java @@ -7,7 +7,7 @@ import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.InstanceName; import com.yahoo.config.provision.RegionName; import com.yahoo.config.provision.TenantName; -import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import com.yahoo.slime.Slime; import com.yahoo.test.ManualClock; import com.yahoo.vespa.curator.Lock; @@ -130,7 +130,7 @@ public final class ControllerTester { /** Creates the given tenant and application and deploys it */ public Application createAndDeploy(String tenantName, String domainName, String applicationName, - String instanceName, Zone zone, long projectId, Long propertyId) { + String instanceName, ZoneId zone, long projectId, Long propertyId) { TenantId tenant = createTenant(tenantName, domainName, propertyId); Application application = createApplication(tenant, applicationName, instanceName, projectId); deploy(application, zone); @@ -144,7 +144,7 @@ public final class ControllerTester { } /** Creates the given tenant and application and deploys it */ - public Application createAndDeploy(String tenantName, String domainName, String applicationName, Zone zone, long projectId, Long propertyId) { + public Application createAndDeploy(String tenantName, String domainName, String applicationName, ZoneId zone, long projectId, Long propertyId) { return createAndDeploy(tenantName, domainName, applicationName, "default", zone, projectId, propertyId); } @@ -163,11 +163,14 @@ public final class ControllerTester { return application; } - public Zone toZone(Environment environment) { + public ZoneId toZone(Environment environment) { switch (environment) { - case dev: case test: return new Zone(environment, RegionName.from("us-east-1")); - case staging: return new Zone(environment, RegionName.from("us-east-3")); - default: return new Zone(environment, RegionName.from("us-west-1")); + case dev: case test: + return ZoneId.from(environment, RegionName.from("us-east-1")); + case staging: + return ZoneId.from(environment, RegionName.from("us-east-3")); + default: + return ZoneId.from(environment, RegionName.from("us-west-1")); } } @@ -197,15 +200,15 @@ public final class ControllerTester { return controller().applications().require(applicationId); } - public void deploy(Application application, Zone zone) { + public void deploy(Application application, ZoneId zone) { deploy(application, zone, new ApplicationPackage(new byte[0])); } - public void deploy(Application application, Zone zone, ApplicationPackage applicationPackage) { + public void deploy(Application application, ZoneId zone, ApplicationPackage applicationPackage) { deploy(application, zone, applicationPackage, false); } - public void deploy(Application application, Zone zone, ApplicationPackage applicationPackage, boolean deployCurrentVersion) { + public void deploy(Application application, ZoneId zone, ApplicationPackage applicationPackage, boolean deployCurrentVersion) { ScrewdriverId app1ScrewdriverId = new ScrewdriverId(String.valueOf(application.deploymentJobs().projectId().get())); GitRevision app1RevisionId = new GitRevision(new GitRepository("repo"), new GitBranch("master"), new GitCommit("commit1")); controller().applications().deployApplication(application.id(), diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ZoneRegistryMock.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ZoneRegistryMock.java index 18332942c24..53af74bf542 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ZoneRegistryMock.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/ZoneRegistryMock.java @@ -7,7 +7,7 @@ import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.RegionName; import com.yahoo.config.provision.SystemName; -import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneRegistry; import java.net.URI; @@ -24,19 +24,19 @@ import java.util.Optional; */ public class ZoneRegistryMock extends AbstractComponent implements ZoneRegistry { - private final Map<Zone, Duration> deploymentTimeToLive = new HashMap<>(); + private final Map<ZoneId, Duration> deploymentTimeToLive = new HashMap<>(); private final Map<Environment, RegionName> defaultRegionForEnvironment = new HashMap<>(); - private List<Zone> zones = new ArrayList<>(); + private List<ZoneId> zones = new ArrayList<>(); private SystemName system = SystemName.main; @Inject public ZoneRegistryMock() { - this.zones.add(new Zone(SystemName.main, Environment.from("prod"), RegionName.from("corp-us-east-1"))); - this.zones.add(new Zone(SystemName.main, Environment.from("prod"), RegionName.from("us-east-3"))); - this.zones.add(new Zone(SystemName.main, Environment.from("prod"), RegionName.from("us-west-1"))); + this.zones.add(ZoneId.from("prod", "corp-us-east-1")); + this.zones.add(ZoneId.from("prod", "us-east-3")); + this.zones.add(ZoneId.from("prod", "us-west-1")); } - public ZoneRegistryMock setDeploymentTimeToLive(Zone zone, Duration duration) { + public ZoneRegistryMock setDeploymentTimeToLive(ZoneId zone, Duration duration) { deploymentTimeToLive.put(zone, duration); return this; } @@ -46,7 +46,7 @@ public class ZoneRegistryMock extends AbstractComponent implements ZoneRegistry return this; } - public ZoneRegistryMock setZones(List<Zone> zones) { + public ZoneRegistryMock setZones(List<ZoneId> zones) { this.zones = zones; return this; } @@ -62,12 +62,12 @@ public class ZoneRegistryMock extends AbstractComponent implements ZoneRegistry } @Override - public List<Zone> zones() { + public List<ZoneId> zones() { return Collections.unmodifiableList(zones); } @Override - public Optional<Zone> getZone(Environment environment, RegionName region) { + public Optional<ZoneId> getZone(Environment environment, RegionName region) { return zones().stream().filter(z -> z.environment().equals(environment) && z.region().equals(region)).findFirst(); } @@ -88,7 +88,7 @@ public class ZoneRegistryMock extends AbstractComponent implements ZoneRegistry @Override public Optional<Duration> getDeploymentTimeToLive(Environment environment, RegionName region) { - return Optional.ofNullable(deploymentTimeToLive.get(new Zone(environment, region))); + return Optional.ofNullable(deploymentTimeToLive.get(ZoneId.from(environment, region))); } @Override diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/MockMetricsService.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/MockMetricsService.java index 2dc6471effb..a58d2d0fa39 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/MockMetricsService.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/integration/MockMetricsService.java @@ -2,7 +2,7 @@ package com.yahoo.vespa.hosted.controller.integration; import com.yahoo.config.provision.ApplicationId; -import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import java.util.HashMap; import java.util.Map; @@ -18,12 +18,12 @@ public class MockMetricsService implements com.yahoo.vespa.hosted.controller.api } @Override - public DeploymentMetrics getDeploymentMetrics(ApplicationId application, Zone zone) { + public DeploymentMetrics getDeploymentMetrics(ApplicationId application, ZoneId zone) { return new DeploymentMetrics(1, 2, 3, 4, 5); } @Override - public Map<String, SystemMetrics> getSystemMetrics(ApplicationId application, Zone zone) { + public Map<String, SystemMetrics> getSystemMetrics(ApplicationId application, ZoneId zone) { Map<String, SystemMetrics> result = new HashMap<>(); SystemMetrics system = new SystemMetrics(55.54, 69.90, 34.59); result.put("default", system); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentExpirerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentExpirerTest.java index ef0b05f9bb2..47d62f93def 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentExpirerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DeploymentExpirerTest.java @@ -3,7 +3,7 @@ package com.yahoo.vespa.hosted.controller.maintenance; import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.RegionName; -import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import com.yahoo.vespa.hosted.controller.Application; import com.yahoo.vespa.hosted.controller.application.ApplicationPackage; import com.yahoo.vespa.hosted.controller.application.Deployment; @@ -35,7 +35,7 @@ public class DeploymentExpirerTest { @Test public void testDeploymentExpiry() throws IOException, InterruptedException { tester.controllerTester().zoneRegistry().setDeploymentTimeToLive( - new Zone(Environment.dev, RegionName.from("us-east-1")), + ZoneId.from(Environment.dev, RegionName.from("us-east-1")), Duration.ofDays(14) ); DeploymentExpirer expirer = new DeploymentExpirer(tester.controller(), Duration.ofDays(10), diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DnsMaintainerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DnsMaintainerTest.java index 17f9ab29628..8647b87133e 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DnsMaintainerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/DnsMaintainerTest.java @@ -5,6 +5,7 @@ import com.yahoo.config.application.api.ValidationId; import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.RegionName; import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import com.yahoo.vespa.hosted.controller.Application; import com.yahoo.vespa.hosted.controller.api.integration.athenz.NToken; import com.yahoo.vespa.hosted.controller.api.integration.dns.Record; @@ -60,8 +61,8 @@ public class DnsMaintainerTest { .build(); tester.notifyJobCompletion(component, application, true); tester.deployAndNotify(application, applicationPackage, true, systemTest); - tester.applications().deactivate(application, new Zone(Environment.test, RegionName.from("us-east-1"))); - tester.applications().deactivate(application, new Zone(Environment.staging, RegionName.from("us-east-3"))); + tester.applications().deactivate(application, ZoneId.from(Environment.test, RegionName.from("us-east-1"))); + tester.applications().deactivate(application, ZoneId.from(Environment.staging, RegionName.from("us-east-3"))); tester.applications().deleteApplication(application.id(), Optional.of(new NToken("ntoken"))); // DnsMaintainer removes record diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/UpgraderTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/UpgraderTest.java index 8839f6a5a18..ac282422c89 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/UpgraderTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/maintenance/UpgraderTest.java @@ -4,7 +4,7 @@ package com.yahoo.vespa.hosted.controller.maintenance; import com.yahoo.component.Version; import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.RegionName; -import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import com.yahoo.test.ManualClock; import com.yahoo.vespa.hosted.controller.Application; import com.yahoo.vespa.hosted.controller.ControllerTester; @@ -692,7 +692,7 @@ public class UpgraderTest { // Dev deployment which should be ignored Application dev0 = tester.createApplication("dev0", "tenant1", 7, 1L); - tester.controllerTester().deploy(dev0, new Zone(Environment.dev, RegionName.from("dev-region"))); + tester.controllerTester().deploy(dev0, ZoneId.from(Environment.dev, RegionName.from("dev-region"))); // New version is released and canaries upgrade version = Version.fromString("5.1"); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializerTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializerTest.java index bf869230e8d..b281b513f4a 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializerTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/persistence/ApplicationSerializerTest.java @@ -8,7 +8,7 @@ import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.ClusterSpec; import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.RegionName; -import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import com.yahoo.slime.Slime; import com.yahoo.vespa.config.SlimeUtils; import com.yahoo.vespa.hosted.controller.Application; @@ -48,8 +48,8 @@ public class ApplicationSerializerTest { private static final ApplicationSerializer applicationSerializer = new ApplicationSerializer(); - private static final Zone zone1 = new Zone(Environment.from("prod"), RegionName.from("us-west-1")); - private static final Zone zone2 = new Zone(Environment.from("prod"), RegionName.from("us-east-3")); + private static final ZoneId zone1 = ZoneId.from("prod", "us-west-1"); + private static final ZoneId zone2 = ZoneId.from("prod", "us-east-3"); @Test public void testSerialization() { diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ContainerControllerTester.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ContainerControllerTester.java index bb5f129b20b..f3fa1e21eda 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ContainerControllerTester.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/ContainerControllerTester.java @@ -5,6 +5,7 @@ import com.yahoo.application.container.JDisc; import com.yahoo.application.container.handler.Request; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import com.yahoo.vespa.hosted.controller.Application; import com.yahoo.vespa.hosted.controller.Controller; import com.yahoo.vespa.hosted.controller.TestIdentities; @@ -76,7 +77,7 @@ public class ContainerControllerTester { return controller().applications().createApplication(app, Optional.of(TestIdentities.userNToken)); } - public Application deploy(Application application, ApplicationPackage applicationPackage, Zone zone, long projectId) { + public Application deploy(Application application, ApplicationPackage applicationPackage, ZoneId zone, long projectId) { ScrewdriverId app1ScrewdriverId = new ScrewdriverId(String.valueOf(projectId)); GitRevision app1RevisionId = new GitRevision(new GitRepository("repo"), new GitBranch("master"), new GitCommit("commit1")); controller().applications().deployApplication(application.id(), @@ -132,4 +133,5 @@ public class ContainerControllerTester { .applications.get(new com.yahoo.vespa.hosted.controller.api.identifiers.ApplicationId(application.id().application().value())) .addRoleMember(action, AthenzService.fromScrewdriverId(screwdriverId)); } + } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ServiceApiResponseTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ServiceApiResponseTest.java index 6cf90905679..4c25bf6fe61 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ServiceApiResponseTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/application/ServiceApiResponseTest.java @@ -4,7 +4,7 @@ package com.yahoo.vespa.hosted.controller.restapi.application; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.RegionName; -import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import com.yahoo.io.IOUtils; import com.yahoo.slime.Slime; import com.yahoo.vespa.config.SlimeUtils; @@ -32,10 +32,10 @@ public class ServiceApiResponseTest { @Test public void testServiceViewResponse() throws URISyntaxException, IOException { - ServiceApiResponse response = new ServiceApiResponse(new Zone(Environment.prod, RegionName.from("us-west-1")), - ApplicationId.from("tenant1", "application1", "default"), - Collections.singletonList(new URI("config-server1")), - new URI("http://server1:4080/request/path?foo=bar")); + ServiceApiResponse response = new ServiceApiResponse(ZoneId.from(Environment.prod, RegionName.from("us-west-1")), + ApplicationId.from("tenant1", "application1", "default"), + Collections.singletonList(new URI("config-server1")), + new URI("http://server1:4080/request/path?foo=bar")); ApplicationView applicationView = new ApplicationView(); ClusterView clusterView = new ClusterView(); clusterView.type = "container"; @@ -63,7 +63,7 @@ public class ServiceApiResponseTest { @Test public void testServiceViewResponseWithURLs() throws URISyntaxException, IOException { - ServiceApiResponse response = new ServiceApiResponse(new Zone(Environment.prod, RegionName.from("us-west-1")), + ServiceApiResponse response = new ServiceApiResponse(ZoneId.from(Environment.prod, RegionName.from("us-west-1")), ApplicationId.from("tenant2", "application2", "default"), Collections.singletonList(new URI("http://cfg1.test/")), new URI("http://cfg1.test/serviceview/v1/tenant/tenant2/application/application2/environment/prod/region/us-west-1/instance/default/service/searchnode-9dujk1pa0vufxrj6n4yvmi8uc/state/v1")); diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiTest.java index 55a4b46f4a7..d16a0222e4a 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/deployment/DeploymentApiTest.java @@ -6,7 +6,7 @@ import com.yahoo.application.container.handler.Request; import com.yahoo.component.Version; import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.RegionName; -import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import com.yahoo.vespa.hosted.controller.Application; import com.yahoo.vespa.hosted.controller.Controller; import com.yahoo.vespa.hosted.controller.application.ApplicationPackage; @@ -95,14 +95,12 @@ public class DeploymentApiTest extends ControllerContainerTest { private void deployCompletely(Application application, ApplicationPackage applicationPackage, long projectId, boolean success) { tester.notifyJobCompletion(application.id(), projectId, true, component); - tester.deploy(application, applicationPackage, new Zone(Environment.test, - RegionName.from("us-east-1")), projectId); + tester.deploy(application, applicationPackage, ZoneId.from(Environment.test, RegionName.from("us-east-1")), projectId); tester.notifyJobCompletion(application.id(), projectId, true, systemTest); - tester.deploy(application, applicationPackage, new Zone(Environment.staging, - RegionName.from("us-east-3")), projectId); + tester.deploy(application, applicationPackage, ZoneId.from(Environment.staging, RegionName.from("us-east-3")), projectId); tester.notifyJobCompletion(application.id(), projectId, success, stagingTest); if (success) { - tester.deploy(application, applicationPackage, new Zone(Environment.prod,RegionName.from("corp-us-east-1")), + tester.deploy(application, applicationPackage, ZoneId.from(Environment.prod, RegionName.from("corp-us-east-1")), projectId); tester.notifyJobCompletion(application.id(), projectId, true, productionCorpUsEast1); } diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiTest.java index e2c3725ea5f..1269bb23105 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/ScrewdriverApiTest.java @@ -7,7 +7,7 @@ import com.yahoo.component.Version; import com.yahoo.config.provision.ApplicationId; import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.RegionName; -import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import com.yahoo.vespa.config.SlimeUtils; import com.yahoo.vespa.hosted.controller.Application; import com.yahoo.vespa.hosted.controller.application.ApplicationPackage; @@ -39,8 +39,8 @@ import static org.junit.Assert.assertTrue; public class ScrewdriverApiTest extends ControllerContainerTest { private static final String responseFiles = "src/test/java/com/yahoo/vespa/hosted/controller/restapi/screwdriver/responses/"; - private static final Zone testZone = new Zone(Environment.test, RegionName.from("us-east-1")); - private static final Zone stagingZone = new Zone(Environment.staging, RegionName.from("us-east-3")); + private static final ZoneId testZone = ZoneId.from(Environment.test, RegionName.from("us-east-1")); + private static final ZoneId stagingZone = ZoneId.from(Environment.staging, RegionName.from("us-east-3")); @Test public void testGetReleaseStatus() throws Exception { diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/zone/v1/ZoneApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/zone/v1/ZoneApiTest.java index a00665b77cb..2d92d10b661 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/zone/v1/ZoneApiTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/zone/v1/ZoneApiTest.java @@ -4,7 +4,7 @@ package com.yahoo.vespa.hosted.controller.restapi.zone.v1; import com.yahoo.application.container.handler.Request; import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.RegionName; -import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import com.yahoo.vespa.hosted.controller.ZoneRegistryMock; import com.yahoo.vespa.hosted.controller.restapi.ContainerControllerTester; import com.yahoo.vespa.hosted.controller.restapi.ControllerContainerTest; @@ -21,12 +21,12 @@ import java.util.List; public class ZoneApiTest extends ControllerContainerTest { private static final String responseFiles = "src/test/java/com/yahoo/vespa/hosted/controller/restapi/zone/v1/responses/"; - private static final List<Zone> zones = Arrays.asList( - new Zone(Environment.prod, RegionName.from("us-north-1")), - new Zone(Environment.dev, RegionName.from("us-north-2")), - new Zone(Environment.test, RegionName.from("us-north-3")), - new Zone(Environment.staging, RegionName.from("us-north-4")) - ); + private static final List<ZoneId> zones = Arrays.asList( + ZoneId.from(Environment.prod, RegionName.from("us-north-1")), + ZoneId.from(Environment.dev, RegionName.from("us-north-2")), + ZoneId.from(Environment.test, RegionName.from("us-north-3")), + ZoneId.from(Environment.staging, RegionName.from("us-north-4")) + ); private ContainerControllerTester tester; diff --git a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/zone/v2/ZoneApiTest.java b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/zone/v2/ZoneApiTest.java index 63899d808f9..9c20c470cf8 100644 --- a/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/zone/v2/ZoneApiTest.java +++ b/controller-server/src/test/java/com/yahoo/vespa/hosted/controller/restapi/zone/v2/ZoneApiTest.java @@ -4,7 +4,7 @@ import com.yahoo.application.container.handler.Request; import com.yahoo.application.container.handler.Request.Method; import com.yahoo.config.provision.Environment; import com.yahoo.config.provision.RegionName; -import com.yahoo.config.provision.Zone; +import com.yahoo.config.provision.ZoneId; import com.yahoo.text.Utf8; import com.yahoo.vespa.hosted.controller.ConfigServerProxyMock; import com.yahoo.vespa.hosted.controller.ZoneRegistryMock; @@ -26,12 +26,12 @@ import static org.junit.Assert.assertFalse; public class ZoneApiTest extends ControllerContainerTest { private static final String responseFiles = "src/test/java/com/yahoo/vespa/hosted/controller/restapi/zone/v2/responses/"; - private static final List<Zone> zones = Arrays.asList( - new Zone(Environment.prod, RegionName.from("us-north-1")), - new Zone(Environment.dev, RegionName.from("us-north-2")), - new Zone(Environment.test, RegionName.from("us-north-3")), - new Zone(Environment.staging, RegionName.from("us-north-4")) - ); + private static final List<ZoneId> zones = Arrays.asList( + ZoneId.from(Environment.prod, RegionName.from("us-north-1")), + ZoneId.from(Environment.dev, RegionName.from("us-north-2")), + ZoneId.from(Environment.test, RegionName.from("us-north-3")), + ZoneId.from(Environment.staging, RegionName.from("us-north-4")) + ); private ContainerControllerTester tester; private ConfigServerProxyMock proxy; |