diff options
author | Martin Polden <mpolden@mpolden.no> | 2023-07-26 16:02:45 +0200 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2023-07-26 16:24:11 +0200 |
commit | e3ba83a0fdd1e31036929c172836e9996f79f16d (patch) | |
tree | c03df2abc06f0f0567c4d5503eef6039cd2773e7 /controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/rotation | |
parent | 886a16481d5023822629fd4f8f128157af9edce8 (diff) |
Remove global-service-id
Diffstat (limited to 'controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/rotation')
-rw-r--r-- | controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/rotation/RotationRepository.java | 47 |
1 files changed, 0 insertions, 47 deletions
diff --git a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/rotation/RotationRepository.java b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/rotation/RotationRepository.java index 1e9f11e0349..d54bdead0bd 100644 --- a/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/rotation/RotationRepository.java +++ b/controller-server/src/main/java/com/yahoo/vespa/hosted/controller/routing/rotation/RotationRepository.java @@ -1,7 +1,6 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.controller.routing.rotation; -import com.yahoo.config.application.api.DeploymentInstanceSpec; import com.yahoo.config.application.api.DeploymentSpec; import com.yahoo.config.application.api.Endpoint; import com.yahoo.config.provision.ApplicationId; @@ -63,44 +62,10 @@ public class RotationRepository { } /** - * Returns a single rotation for the given application. This is only used when a rotation is assigned through the - * use of a global service ID. - * - * 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 instanceSpec the instance deployment spec - * @param instance the instance requesting a rotation - * @param lock lock which must be acquired by the caller - */ - private AssignedRotation assignRotationTo(String globalServiceId, DeploymentInstanceSpec instanceSpec, - Instance instance, RotationLock lock) { - RotationId rotation; - if (instance.rotations().isEmpty()) { - rotation = findAvailableRotation(instance.id(), lock).id(); - } else { - rotation = instance.rotations().get(0).rotationId(); - } - var productionRegions = instanceSpec.zones().stream() - .filter(zone -> zone.environment().isProduction()) - .flatMap(zone -> zone.region().stream()) - .collect(Collectors.toSet()); - if (productionRegions.size() < 2) { - throw new IllegalArgumentException("global-service-id is set but less than 2 prod zones are defined " + - "in instance '" + instance.name() + "'"); - } - return new AssignedRotation(new ClusterSpec.Id(globalServiceId), - EndpointId.defaultId(), - rotation, - productionRegions); - } - - /** * Returns rotation assignments for all endpoints in application. * * If rotations are already assigned, these will be returned. * If rotations are not assigned, a new assignment will be created taking new rotations from the repository. - * This method supports both global-service-id as well as the new endpoints tag. * * @param deploymentSpec The deployment spec of the application * @param instance The application requesting rotations @@ -112,19 +77,7 @@ public class RotationRepository { if (allRotations.isEmpty()) { return List.of(); } - - // Only allow one kind of configuration syntax var instanceSpec = deploymentSpec.requireInstance(instance.name()); - if ( instanceSpec.globalServiceId().isPresent() - && ! instanceSpec.endpoints().isEmpty()) { - throw new IllegalArgumentException("Cannot provision rotations with both global-service-id and 'endpoints'"); - } - - // Support legacy global-service-id - if (instanceSpec.globalServiceId().isPresent()) { - return List.of(assignRotationTo(instanceSpec.globalServiceId().get(), instanceSpec, instance, lock)); - } - return assignRotationsTo(instanceSpec.endpoints(), instance, lock); } |