diff options
author | gjoranv <gv@verizonmedia.com> | 2023-02-07 21:39:50 +0100 |
---|---|---|
committer | gjoranv <gv@verizonmedia.com> | 2023-02-08 13:10:36 +0100 |
commit | 1fa055c6403de7ee0825c82e1ce6bc192da7058d (patch) | |
tree | b27bcdbf6cf8945e87b0e4cfa80a60d4d87910ec /node-admin | |
parent | cc1637f6c8451cc9bd47e2d8965db28a00848fb2 (diff) |
Use a list of wg tasks, instead of an optional.
Diffstat (limited to 'node-admin')
3 files changed, 9 insertions, 9 deletions
diff --git a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java index ec1e42a911e..e363e85b898 100644 --- a/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java +++ b/node-admin/src/main/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImpl.java @@ -23,8 +23,8 @@ import com.yahoo.vespa.hosted.node.admin.container.ContainerOperations; import com.yahoo.vespa.hosted.node.admin.container.ContainerResources; import com.yahoo.vespa.hosted.node.admin.container.RegistryCredentials; import com.yahoo.vespa.hosted.node.admin.container.RegistryCredentialsProvider; -import com.yahoo.vespa.hosted.node.admin.maintenance.StorageMaintainer; import com.yahoo.vespa.hosted.node.admin.maintenance.ContainerWireguardTask; +import com.yahoo.vespa.hosted.node.admin.maintenance.StorageMaintainer; import com.yahoo.vespa.hosted.node.admin.maintenance.acl.AclMaintainer; import com.yahoo.vespa.hosted.node.admin.maintenance.identity.CredentialsMaintainer; import com.yahoo.vespa.hosted.node.admin.maintenance.servicedump.VespaServiceDumper; @@ -72,7 +72,7 @@ public class NodeAgentImpl implements NodeAgent { private final Duration warmUpDuration; private final DoubleFlag containerCpuCap; private final VespaServiceDumper serviceDumper; - private final Optional<ContainerWireguardTask> wireguardMaintainer; + private final List<ContainerWireguardTask> wireguardTasks; private Thread loopThread; private ContainerState containerState = UNKNOWN; @@ -108,10 +108,10 @@ public class NodeAgentImpl implements NodeAgent { RegistryCredentialsProvider registryCredentialsProvider, StorageMaintainer storageMaintainer, FlagSource flagSource, List<CredentialsMaintainer> credentialsMaintainers, Optional<AclMaintainer> aclMaintainer, Optional<HealthChecker> healthChecker, Clock clock, - VespaServiceDumper serviceDumper, Optional<ContainerWireguardTask> wireguardMaintainer) { + VespaServiceDumper serviceDumper, List<ContainerWireguardTask> wireguardTasks) { this(contextSupplier, nodeRepository, orchestrator, containerOperations, registryCredentialsProvider, storageMaintainer, flagSource, credentialsMaintainers, aclMaintainer, healthChecker, clock, - DEFAULT_WARM_UP_DURATION, serviceDumper, wireguardMaintainer); + DEFAULT_WARM_UP_DURATION, serviceDumper, wireguardTasks); } public NodeAgentImpl(NodeAgentContextSupplier contextSupplier, NodeRepository nodeRepository, @@ -120,7 +120,7 @@ public class NodeAgentImpl implements NodeAgent { FlagSource flagSource, List<CredentialsMaintainer> credentialsMaintainers, Optional<AclMaintainer> aclMaintainer, Optional<HealthChecker> healthChecker, Clock clock, Duration warmUpDuration, VespaServiceDumper serviceDumper, - Optional<ContainerWireguardTask> wireguardMaintainer) { + List<ContainerWireguardTask> wireguardTasks) { this.contextSupplier = contextSupplier; this.nodeRepository = nodeRepository; this.orchestrator = orchestrator; @@ -134,7 +134,7 @@ public class NodeAgentImpl implements NodeAgent { this.warmUpDuration = warmUpDuration; this.containerCpuCap = PermanentFlags.CONTAINER_CPU_CAP.bindTo(flagSource); this.serviceDumper = serviceDumper; - this.wireguardMaintainer = wireguardMaintainer; + this.wireguardTasks = new ArrayList<>(wireguardTasks); } @Override @@ -498,7 +498,7 @@ public class NodeAgentImpl implements NodeAgent { } aclMaintainer.ifPresent(maintainer -> maintainer.converge(context)); - wireguardMaintainer.ifPresent(maintainer -> maintainer.converge(context)); + wireguardTasks.forEach(task -> task.converge(context)); startServicesIfNeeded(context); resumeNodeIfNeeded(context); if (healthChecker.isPresent()) { diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integration/ContainerTester.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integration/ContainerTester.java index 2f9b282c44e..7676d0e1790 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integration/ContainerTester.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/integration/ContainerTester.java @@ -95,7 +95,7 @@ public class ContainerTester implements AutoCloseable { new NodeAgentImpl(contextSupplier, nodeRepository, orchestrator, containerOperations, () -> RegistryCredentials.none, storageMaintainer, flagSource, Collections.emptyList(), Optional.empty(), Optional.empty(), clock, Duration.ofSeconds(-1), - VespaServiceDumper.DUMMY_INSTANCE, Optional.empty()) { + VespaServiceDumper.DUMMY_INSTANCE, List.of()) { @Override public void converge(NodeAgentContext context) { super.converge(context); phaser.arriveAndAwaitAdvance(); diff --git a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImplTest.java b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImplTest.java index fb132c9b717..b8b72308bdd 100644 --- a/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImplTest.java +++ b/node-admin/src/test/java/com/yahoo/vespa/hosted/node/admin/nodeagent/NodeAgentImplTest.java @@ -789,7 +789,7 @@ public class NodeAgentImplTest { return new NodeAgentImpl(contextSupplier, nodeRepository, orchestrator, containerOperations, () -> RegistryCredentials.none, storageMaintainer, flagSource, List.of(credentialsMaintainer), Optional.of(aclMaintainer), Optional.of(healthChecker), - clock, warmUpDuration, VespaServiceDumper.DUMMY_INSTANCE, Optional.empty()); + clock, warmUpDuration, VespaServiceDumper.DUMMY_INSTANCE, List.of()); } private void mockGetContainer(DockerImage dockerImage, boolean isRunning) { |