diff options
author | Andreas Eriksen <andreer@yahooinc.com> | 2023-09-14 13:55:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-14 13:55:16 +0200 |
commit | b396cdd2de0ab19dbe3b77ae539a60450383330c (patch) | |
tree | 6fe29c433e3786ca2990408a1c9697714c9a5aca /node-admin | |
parent | 98fd22937b667e6a7bd46f42cb5bf8775a23f37d (diff) |
Revert "Wg timestamp in node repo"
Diffstat (limited to 'node-admin')
8 files changed, 10 insertions, 53 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/NodeSpec.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/NodeSpec.java index 0300d7e92ff..d217d038e42 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/NodeSpec.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/NodeSpec.java @@ -75,8 +75,6 @@ public class NodeSpec { private final Optional<WireguardKey> wireguardPubkey; - private final Optional<Instant> wireguardKeyTimestamp; - private final boolean wantToRebuild; public NodeSpec( @@ -113,7 +111,6 @@ public class NodeSpec { Optional<ApplicationId> exclusiveTo, List<TrustStoreItem> trustStore, Optional<WireguardKey> wireguardPubkey, - Optional<Instant> wireguardKeyTimestamp, boolean wantToRebuild) { if (state == NodeState.active) { @@ -158,7 +155,6 @@ public class NodeSpec { this.exclusiveTo = Objects.requireNonNull(exclusiveTo); this.trustStore = Objects.requireNonNull(trustStore); this.wireguardPubkey = Objects.requireNonNull(wireguardPubkey); - this.wireguardKeyTimestamp = Objects.requireNonNull(wireguardKeyTimestamp); this.wantToRebuild = wantToRebuild; } @@ -315,8 +311,6 @@ public class NodeSpec { public Optional<WireguardKey> wireguardPubkey() { return wireguardPubkey; } - public Optional<Instant> wireguardKeyTimestamp() { return wireguardKeyTimestamp; } - public boolean wantToRebuild() { return wantToRebuild; } @@ -359,7 +353,6 @@ public class NodeSpec { Objects.equals(exclusiveTo, that.exclusiveTo) && Objects.equals(trustStore, that.trustStore) && Objects.equals(wireguardPubkey, that.wireguardPubkey) && - Objects.equals(wireguardKeyTimestamp, that.wireguardKeyTimestamp) && Objects.equals(wantToRebuild, that.wantToRebuild); } @@ -399,7 +392,6 @@ public class NodeSpec { exclusiveTo, trustStore, wireguardPubkey, - wireguardKeyTimestamp, wantToRebuild); } @@ -439,7 +431,6 @@ public class NodeSpec { + " exclusiveTo=" + exclusiveTo + " trustStore=" + trustStore + " wireguardPubkey=" + wireguardPubkey - + " wireguardKeyTimestamp=" + wireguardKeyTimestamp + " wantToRebuild=" + wantToRebuild + " }"; } @@ -478,7 +469,6 @@ public class NodeSpec { private Optional<ApplicationId> exclusiveTo = Optional.empty(); private List<TrustStoreItem> trustStore = List.of(); private Optional<WireguardKey> wireguardPubkey = Optional.empty(); - private Optional<Instant> wireguardKeyTimestamp = Optional.empty(); private boolean wantToRebuild = false; public Builder() {} @@ -515,7 +505,6 @@ public class NodeSpec { node.exclusiveTo.ifPresent(this::exclusiveTo); trustStore(node.trustStore); node.wireguardPubkey.ifPresent(this::wireguardPubkey); - node.wireguardKeyTimestamp.ifPresent(this::wireguardKeyTimestamp); wantToRebuild(node.wantToRebuild); } @@ -704,13 +693,8 @@ public class NodeSpec { return this; } - public Builder wireguardPubkey(WireguardKey wireguardPubKey) { - this.wireguardPubkey = Optional.of(wireguardPubKey); - return this; - } - - public Builder wireguardKeyTimestamp(Instant wireguardKeyTimestamp) { - this.wireguardKeyTimestamp = Optional.of(wireguardKeyTimestamp); + public Builder wireguardPubkey(WireguardKey wireguardKey) { + wireguardPubkey = Optional.of(wireguardKey); return this; } @@ -846,7 +830,7 @@ public class NodeSpec { wantedFirmwareCheck, currentFirmwareCheck, modelName, resources, realResources, ipAddresses, additionalIpAddresses, reports, events, parentHostname, archiveUri, exclusiveTo, trustStore, - wireguardPubkey, wireguardKeyTimestamp, wantToRebuild); + wireguardPubkey, wantToRebuild); } diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/RealNodeRepository.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/RealNodeRepository.java index a48372c334f..043a8ae4cd5 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/RealNodeRepository.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/RealNodeRepository.java @@ -147,10 +147,8 @@ public class RealNodeRepository implements NodeRepository { .toList(); if (ipAddresses.isEmpty()) return; - consumer.accept(new WireguardPeer(HostName.of(node.hostname), - ipAddresses, - WireguardKey.from(node.wireguardPubkey), - Instant.ofEpochMilli(node.wireguardKeyTimestamp))); + consumer.accept(new WireguardPeer( + HostName.of(node.hostname), ipAddresses, WireguardKey.from(node.wireguardPubkey))); }) .sorted() .toList(); @@ -244,7 +242,6 @@ public class RealNodeRepository implements NodeRepository { Optional.ofNullable(node.exclusiveTo).map(ApplicationId::fromSerializedForm), trustStore, Optional.ofNullable(node.wireguardPubkey).map(WireguardKey::from), - Optional.ofNullable(node.wireguardKeyTimestamp).map(Instant::ofEpochMilli), node.wantToRebuild); } @@ -371,7 +368,6 @@ public class RealNodeRepository implements NodeRepository { private static WireguardPeer createConfigserverPeer(GetWireguardResponse.Configserver configServer) { return new WireguardPeer(HostName.of(configServer.hostname), configServer.ipAddresses.stream().map(VersionedIpAddress::from).toList(), - WireguardKey.from(configServer.wireguardPubkey), - Instant.ofEpochMilli(configServer.wireguardKeyTimestamp)); + WireguardKey.from(configServer.wireguardPubkey)); } } diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/bindings/GetWireguardResponse.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/bindings/GetWireguardResponse.java index dcbf4cc163f..a71b2a74b31 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/bindings/GetWireguardResponse.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/bindings/GetWireguardResponse.java @@ -35,18 +35,13 @@ public class GetWireguardResponse { @JsonProperty("wireguardPubkey") public final String wireguardPubkey; - @JsonProperty("wireguardKeyTimestamp") - public final Long wireguardKeyTimestamp; - @JsonCreator public Configserver(@JsonProperty("hostname") String hostname, @JsonProperty("ipAddresses") List<String> ipAddresses, - @JsonProperty("wireguardPubkey") String wireguardPubkey, - @JsonProperty("wireguardKeyTimestamp") Long wireguardKeyTimestamp) { + @JsonProperty("wireguardPubkey") String wireguardPubkey) { this.hostname = hostname; this.ipAddresses = ipAddresses; this.wireguardPubkey = wireguardPubkey; - this.wireguardKeyTimestamp = wireguardKeyTimestamp; } } diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/bindings/NodeRepositoryNode.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/bindings/NodeRepositoryNode.java index 3d0d052a877..8078b3acf6f 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/bindings/NodeRepositoryNode.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/bindings/NodeRepositoryNode.java @@ -95,9 +95,6 @@ public class NodeRepositoryNode { @JsonProperty("wireguardPubkey") @JsonInclude(JsonInclude.Include.NON_EMPTY) public String wireguardPubkey; - @JsonProperty("wireguardKeyTimestamp") - @JsonInclude(JsonInclude.Include.NON_EMPTY) - public Long wireguardKeyTimestamp; @JsonProperty("reports") public Map<String, JsonNode> reports = null; @@ -142,7 +139,6 @@ public class NodeRepositoryNode { ", history=" + history + ", trustStore=" + trustStore + ", wireguardPubkey=" + wireguardPubkey + - ", wireguardKeyTimestamp=" + wireguardKeyTimestamp + ", reports=" + reports + '}'; } diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/process/TestProcessFactory.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/process/TestProcessFactory.java index c87d3875d25..29f1ffef6f2 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/process/TestProcessFactory.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/task/util/process/TestProcessFactory.java @@ -63,9 +63,7 @@ public class TestProcessFactory implements ProcessFactory { int missingCommandIndex = spawnCommandLines.size(); throw new IllegalStateException("Command #" + missingCommandIndex + " never executed: " + - expectedSpawnCalls.get(missingCommandIndex).commandDescription + - "\nExpected commands:\n" + getExpectedCommandLines() + - "\nActual commands:\n" + spawnCommandLines); + expectedSpawnCalls.get(missingCommandIndex).commandDescription); } } @@ -103,11 +101,4 @@ public class TestProcessFactory implements ProcessFactory { return toReturn; } - - private List<String> getExpectedCommandLines() { - return expectedSpawnCalls.stream() - .map(spawnCall -> spawnCall.commandDescription) - .toList(); - } - } diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/wireguard/WireguardPeer.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/wireguard/WireguardPeer.java index b5428f57f08..0f4d2d5d8e0 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/wireguard/WireguardPeer.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/wireguard/WireguardPeer.java @@ -4,7 +4,6 @@ import com.yahoo.config.provision.HostName; import com.yahoo.config.provision.WireguardKey; import com.yahoo.vespa.hosted.node.admin.task.util.network.VersionedIpAddress; -import java.time.Instant; import java.util.List; /** @@ -15,8 +14,7 @@ import java.util.List; */ public record WireguardPeer(HostName hostname, List<VersionedIpAddress> ipAddresses, - WireguardKey publicKey, - Instant wireguardKeyTimestamp) implements Comparable<WireguardPeer> { + WireguardKey publicKey) implements Comparable<WireguardPeer> { public WireguardPeer { if (ipAddresses.isEmpty()) throw new IllegalArgumentException("No IP addresses for peer node " + hostname.value()); diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/RealNodeRepositoryTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/RealNodeRepositoryTest.java index a00241b2bbf..6358fcecafb 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/RealNodeRepositoryTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/configserver/noderepository/RealNodeRepositoryTest.java @@ -139,7 +139,6 @@ public class RealNodeRepositoryTest { var hostname = "host4.yahoo.com"; var dockerImage = "registry.example.com/repo/image-1:6.2.3"; var wireguardKey = WireguardKey.from("111122223333444455556666777788889999000042c="); - var wireguardKeyTimestamp = Instant.ofEpochMilli(123L); // Instant from clock in MockNodeRepository nodeRepositoryApi.updateNodeAttributes( hostname, @@ -152,7 +151,6 @@ public class RealNodeRepositoryTest { assertEquals(1, hostSpec.currentRestartGeneration().orElseThrow()); assertEquals(dockerImage, hostSpec.currentDockerImage().orElseThrow().asString()); assertEquals(wireguardKey.value(), hostSpec.wireguardPubkey().orElseThrow().value()); - assertEquals(wireguardKeyTimestamp, hostSpec.wireguardKeyTimestamp().orElseThrow()); } @Test diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/wireguard/WireguardPeerTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/wireguard/WireguardPeerTest.java index cd76b221c9e..00aca5c5e4d 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/wireguard/WireguardPeerTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/wireguard/WireguardPeerTest.java @@ -5,7 +5,6 @@ import com.yahoo.config.provision.WireguardKey; import com.yahoo.vespa.hosted.node.admin.task.util.network.VersionedIpAddress; import org.junit.jupiter.api.Test; -import java.time.Instant; import java.util.List; import java.util.stream.Stream; @@ -31,6 +30,6 @@ public class WireguardPeerTest { private static WireguardPeer peer(String hostname) { return new WireguardPeer(HostName.of(hostname), List.of(VersionedIpAddress.from("::1:1")), - WireguardKey.generateRandomForTesting(), Instant.EPOCH); + WireguardKey.generateRandomForTesting()); } } |