aboutsummaryrefslogtreecommitdiffstats
path: root/config-provisioning/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'config-provisioning/src/main/java')
-rw-r--r--config-provisioning/src/main/java/com/yahoo/config/provision/ClusterMembership.java27
-rw-r--r--config-provisioning/src/main/java/com/yahoo/config/provision/ClusterSpec.java26
-rw-r--r--config-provisioning/src/main/java/com/yahoo/config/provision/SystemName.java7
-rw-r--r--config-provisioning/src/main/java/com/yahoo/config/provision/zone/ZoneId.java20
4 files changed, 14 insertions, 66 deletions
diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/ClusterMembership.java b/config-provisioning/src/main/java/com/yahoo/config/provision/ClusterMembership.java
index c0099878b45..f041823bf04 100644
--- a/config-provisioning/src/main/java/com/yahoo/config/provision/ClusterMembership.java
+++ b/config-provisioning/src/main/java/com/yahoo/config/provision/ClusterMembership.java
@@ -3,14 +3,9 @@ package com.yahoo.config.provision;
import com.yahoo.component.Version;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Set;
-import java.util.stream.Collectors;
-
/**
* A node's membership in a cluster. This is a value object.
- * The format is "clusterType/clusterId/groupId/index[/exclusive][/retired][/rotationId,...]"
+ * The format is "clusterType/clusterId/groupId/index[/exclusive][/retired]"
*
* @author bratseth
*/
@@ -25,26 +20,23 @@ public class ClusterMembership {
private ClusterMembership(String stringValue, Version vespaVersion) {
String[] components = stringValue.split("/");
- if (components.length < 4 || components.length > 7)
+ if (components.length < 4)
throw new RuntimeException("Could not parse '" + stringValue + "' to a cluster membership. " +
- "Expected 'clusterType/clusterId/groupId/index[/retired][/exclusive][/rotationId,...]'");
+ "Expected 'clusterType/clusterId/groupId/index[/retired][/exclusive]'");
boolean exclusive = false;
- Set<RotationName> rotations = Collections.emptySet();
if (components.length > 4) {
for (int i = 4; i < components.length; i++) {
String component = components[i];
switch (component) {
case "exclusive": exclusive = true; break;
case "retired": retired = true; break;
- default: rotations = rotationsFrom(component); break;
}
}
}
this.cluster = ClusterSpec.from(ClusterSpec.Type.valueOf(components[0]), ClusterSpec.Id.from(components[1]),
- ClusterSpec.Group.from(Integer.valueOf(components[2])), vespaVersion, exclusive,
- rotations);
+ ClusterSpec.Group.from(Integer.valueOf(components[2])), vespaVersion, exclusive);
this.index = Integer.parseInt(components[3]);
this.stringValue = toStringValue();
}
@@ -62,8 +54,7 @@ public class ClusterMembership {
(cluster.group().isPresent() ? "/" + cluster.group().get().index() : "") +
"/" + index +
( cluster.isExclusive() ? "/exclusive" : "") +
- ( retired ? "/retired" : "") +
- ( !cluster.rotations().isEmpty() ? "/" + rotationsAsString(cluster.rotations()) : "");
+ ( retired ? "/retired" : "");
}
@@ -121,12 +112,4 @@ public class ClusterMembership {
return new ClusterMembership(cluster, index, true);
}
- private static Set<RotationName> rotationsFrom(String s) {
- return Arrays.stream(s.split(",")).map(RotationName::from).collect(Collectors.toUnmodifiableSet());
- }
-
- private static String rotationsAsString(Set<RotationName> rotations) {
- return rotations.stream().map(RotationName::value).collect(Collectors.joining(","));
- }
-
}
diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/ClusterSpec.java b/config-provisioning/src/main/java/com/yahoo/config/provision/ClusterSpec.java
index 35ee538178a..8ed56b98705 100644
--- a/config-provisioning/src/main/java/com/yahoo/config/provision/ClusterSpec.java
+++ b/config-provisioning/src/main/java/com/yahoo/config/provision/ClusterSpec.java
@@ -1,7 +1,6 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.provision;
-import com.google.common.collect.ImmutableSortedSet;
import com.yahoo.component.Version;
import java.util.Objects;
@@ -23,19 +22,13 @@ public final class ClusterSpec {
private final Optional<Group> groupId;
private final Version vespaVersion;
private boolean exclusive;
- private final Set<RotationName> rotations;
- private ClusterSpec(Type type, Id id, Optional<Group> groupId, Version vespaVersion, boolean exclusive,
- Set<RotationName> rotations) {
- if (type != Type.container && !rotations.isEmpty()) {
- throw new IllegalArgumentException("Rotations can only be declared for clusters of type " + Type.container);
- }
+ private ClusterSpec(Type type, Id id, Optional<Group> groupId, Version vespaVersion, boolean exclusive) {
this.type = type;
this.id = id;
this.groupId = groupId;
this.vespaVersion = vespaVersion;
this.exclusive = exclusive;
- this.rotations = ImmutableSortedSet.copyOf(rotations);
}
/** Returns the cluster type */
@@ -57,35 +50,30 @@ public final class ClusterSpec {
*/
public boolean isExclusive() { return exclusive; }
- /** Returns the rotations of which this cluster should be a member */
- public Set<RotationName> rotations() {
- return rotations;
- }
-
public ClusterSpec with(Optional<Group> newGroup) {
- return new ClusterSpec(type, id, newGroup, vespaVersion, exclusive, rotations);
+ return new ClusterSpec(type, id, newGroup, vespaVersion, exclusive);
}
public ClusterSpec exclusive(boolean exclusive) {
- return new ClusterSpec(type, id, groupId, vespaVersion, exclusive, rotations);
+ return new ClusterSpec(type, id, groupId, vespaVersion, exclusive);
}
public static ClusterSpec request(Type type, Id id, Version vespaVersion, boolean exclusive) {
- return new ClusterSpec(type, id, Optional.empty(), vespaVersion, exclusive, Set.of());
+ return new ClusterSpec(type, id, Optional.empty(), vespaVersion, exclusive);
}
// TODO: Remove after June 2019
public static ClusterSpec request(Type type, Id id, Version vespaVersion, boolean exclusive, Set<RotationName> rotations) {
- return new ClusterSpec(type, id, Optional.empty(), vespaVersion, exclusive, rotations);
+ return new ClusterSpec(type, id, Optional.empty(), vespaVersion, exclusive);
}
public static ClusterSpec from(Type type, Id id, Group groupId, Version vespaVersion, boolean exclusive) {
- return new ClusterSpec(type, id, Optional.of(groupId), vespaVersion, exclusive, Set.of());
+ return new ClusterSpec(type, id, Optional.of(groupId), vespaVersion, exclusive);
}
// TODO: Remove after June 2019
public static ClusterSpec from(Type type, Id id, Group groupId, Version vespaVersion, boolean exclusive, Set<RotationName> rotations) {
- return new ClusterSpec(type, id, Optional.of(groupId), vespaVersion, exclusive, rotations);
+ return new ClusterSpec(type, id, Optional.of(groupId), vespaVersion, exclusive);
}
@Override
diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/SystemName.java b/config-provisioning/src/main/java/com/yahoo/config/provision/SystemName.java
index ba462b9eb64..0f6a87020da 100644
--- a/config-provisioning/src/main/java/com/yahoo/config/provision/SystemName.java
+++ b/config-provisioning/src/main/java/com/yahoo/config/provision/SystemName.java
@@ -27,10 +27,7 @@ public enum SystemName {
PublicCd(true, true),
/** Local development system */
- dev(false, false),
-
- /** VaaS */
- vaas(true, true); // TODO: Remove this and use public everywhere
+ dev(false, false);
private final boolean isPublic;
private final boolean isCd;
@@ -51,7 +48,6 @@ public enum SystemName {
case "main": return main;
case "public": return Public;
case "publiccd": return PublicCd;
- case "vaas": return vaas;
default: throw new IllegalArgumentException(String.format("'%s' is not a valid system", value));
}
}
@@ -63,7 +59,6 @@ public enum SystemName {
case main: return "main";
case Public: return "public";
case PublicCd: return "publiccd";
- case vaas: return "vaas";
default : throw new IllegalStateException();
}
}
diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/zone/ZoneId.java b/config-provisioning/src/main/java/com/yahoo/config/provision/zone/ZoneId.java
index c6aaf05492e..5e664e00b4c 100644
--- a/config-provisioning/src/main/java/com/yahoo/config/provision/zone/ZoneId.java
+++ b/config-provisioning/src/main/java/com/yahoo/config/provision/zone/ZoneId.java
@@ -18,17 +18,13 @@ import java.util.Objects;
public class ZoneId {
// TODO: Replace usages of environment + region with usages of this.
- // TODO: Remove static factory methods not specifying cloud and system
-
private final Environment environment;
private final RegionName region;
- private final CloudName cloud;
private final SystemName system;
private ZoneId(Environment environment, RegionName region, CloudName cloud, SystemName system) {
this.environment = Objects.requireNonNull(environment, "environment must be non-null");
this.region = Objects.requireNonNull(region, "region must be non-null");
- this.cloud = Objects.requireNonNull(cloud, "cloud must be non-null");
this.system = Objects.requireNonNull(system, "system must be non-null");
}
@@ -69,10 +65,6 @@ public class ZoneId {
return new ZoneId(environment, region, cloud, SystemName.defaultSystem());
}
- public static ZoneId from(String environment, String region, String cloud) {
- return new ZoneId(Environment.from(environment), RegionName.from(region), CloudName.from(cloud), SystemName.defaultSystem());
- }
-
public static ZoneId from(String environment, String region, String cloud, String system) {
return new ZoneId(Environment.from(environment), RegionName.from(region), CloudName.from(cloud), SystemName.from(system));
}
@@ -89,10 +81,6 @@ public class ZoneId {
return region;
}
- public CloudName cloud() {
- return cloud;
- }
-
public SystemName system() {
return system;
}
@@ -100,20 +88,14 @@ public class ZoneId {
/** Returns the serialised value of this. Inverse of {@code ZoneId.from(String value)}. */
public String value() {
return environment + "." + region;
- // TODO: Change to the below when there only methods use constructor including cloud and system are used and
- // all serialized values contain cloud and system
- // return cloud + "." + system + "." + environment + "." + region;
}
@Override
public String toString() {
- return "zone " + value() + " in " + cloud;
- // TODO: Use the below (need to fix some use of toString() in tests first)
- //return "zone " + cloud + "." + system + "." + environment + "." + region;
+ return value();
}
@Override
- // TODO: Update to check cloud and system when everyone use methods that specify cloud and system
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;