Skip to content

Commit

Permalink
Fix scaling issues and force private IP usage when usePrivateIP is set (
Browse files Browse the repository at this point in the history
#636)

* Fix fleet scaling with shutdownOnIdle by cleaning up temporaryOffline state
 * Ensure private IP is always used when usePrivateIP is set
 * Prevent premature VM shutdown during initial VM creation for shutdownOnIdle
  • Loading branch information
psciborek authored Feb 14, 2025
1 parent a3819d7 commit 3f8b46d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -691,6 +691,7 @@ public Collection<PlannedNode> provision(CloudState cloudState, int workLoad) {
getServiceDelegate().setVirtualMachineDetails(
agentNode, template);
Jenkins.get().addNode(agentNode);
azureComputer.setTemporaryOfflineCause(null);

Check warning on line 694 in src/main/java/com/microsoft/azure/vmagent/AzureVMCloud.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 694 is not covered by tests
if (agentNode.getAgentLaunchMethod().equalsIgnoreCase("SSH")) {
retrySshConnect(azureComputer);
} else { // Wait until node is online
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public void resetShutdownVMStatus(final AzureVMAgent agent) {
Computer.threadPoolForRemoting.submit(new Runnable() {
@Override
public void run() {
if (agent.getTemplate().isShutdownOnIdle()) {
if (agent.getTemplate().isShutdownOnIdle() && !agent.isCleanUpBlocked()) {

Check warning on line 22 in src/main/java/com/microsoft/azure/vmagent/AzureVMCloudBaseRetentionStrategy.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered line

Line 22 is not covered by tests
agent.setEligibleForReuse(false);
agent.shutdown(agent.getCleanUpReason());
agent.blockCleanUpAction();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1169,9 +1169,9 @@ public void setVirtualMachineDetails(
String publicIPStr = "";
String privateIP = vm.getPrimaryNetworkInterface().primaryPrivateIP();
String fqdn;
if (publicIP == null) {
if (publicIP == null || template.getUsePrivateIP()) {
fqdn = privateIP;
LOGGER.log(Level.INFO, "The Azure agent doesn't have a public IP. Will use the private IP");
LOGGER.log(Level.INFO, "The Azure agent doesn't have a public IP or usePrivateIP is set. Will use the private IP");

Check warning on line 1174 in src/main/java/com/microsoft/azure/vmagent/AzureVMManagementServiceDelegate.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Not covered lines

Lines 1172-1174 are not covered by tests
} else {
fqdn = publicIP.fqdn();
publicIPStr = publicIP.ipAddress();
Expand Down

0 comments on commit 3f8b46d

Please sign in to comment.