Copy cloudAccount from parent on activate()
@@ -3,6 +3,7 @@ package com.yahoo.vespa.hosted.provision.provisioning;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.ApplicationTransaction;
+import com.yahoo.config.provision.CloudAccount;
import com.yahoo.config.provision.ClusterMembership;
import com.yahoo.config.provision.ClusterSpec;
import com.yahoo.config.provision.Flavor;
@@ -88,7 +89,8 @@ class Activator {
NodeList activeToRemove = oldActive.matching(node -> ! hostnames.contains(node.hostname()));
remove(activeToRemove, transaction); // TODO: Pass activation time in this call and next line
- nodeRepository.nodes().activate(newActive.asList(), transaction.nested()); // activate also continued active to update node state
+ // TODO (freva): Replace .mapToList(...) with .asList() after 8.80
+ nodeRepository.nodes().activate(newActive.mapToList(node -> fixCloudAccount(node, allNodes)), transaction.nested()); // activate also continued active to update node state
rememberResourceChange(transaction, generation, activationTime,
oldActive.not().retired(),
@@ -248,4 +250,14 @@ class Activator {
return null;
}
+ private Node fixCloudAccount(Node node, NodeList allNodes) {
+ // Existing nodes do not have cloudAccount set, copy the one from parent
+ CloudAccount cloudAccount = allNodes.parentOf(node).map(Node::cloudAccount).orElseGet(node::cloudAccount);
+ return new Node(node.id(), node.ipConfig(), node.hostname(),
+ node.parentHostname(), node.flavor(), node.status(), node.state(), node.allocation(), node.history(),
+ node.type(), node.reports(), node.modelName(), node.reservedTo(),
+ node.exclusiveToApplicationId(), node.exclusiveToClusterType(), node.switchHostname(),
+ node.trustedCertificates(), cloudAccount);
+ }
+
}
