Skip to content

Commit 41769bf

Browse files
authored
fix: log bastion instructions for ssh (#7623)
1 parent 85d1a22 commit 41769bf

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

e2e/vmss.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,16 @@ func CreateVMSS(ctx context.Context, s *Scenario, resourceGroupName string) (*Sc
282282
cleanupVMSS(ctx, s, vm)
283283
})
284284

285+
result := "SSH Instructions: (may take a few minutes for the VM to be ready for SSH)\n========================\n"
286+
if config.Config.KeepVMSS {
287+
s.T.Logf("VM will be preserved after the test finishes, PLEASE MANUALLY DELETE THE VMSS. Set KEEP_VMSS=false to delete it automatically after the test finishes\n")
288+
} else {
289+
s.T.Logf("VM will be automatically deleted after the test finishes, to preserve it for debugging purposes set KEEP_VMSS=true or pause the test with a breakpoint before the test finishes or failed\n")
290+
}
291+
// We combine the az aks get credentials in the same line so we don't overwrite the user's kubeconfig.
292+
result += fmt.Sprintf(`az network bastion ssh --target-ip-address "%s" --name "%s-bastion" --resource-group %s --auth-type ssh-key --username azureuser --ssh-key %s`, vm.PrivateIP, *s.Runtime.Cluster.Model.Name, config.ResourceGroupName(s.Location), config.VMSSHPrivateKeyFileName) + "\n"
293+
s.T.Log(result)
294+
285295
vmssResp, err := operation.PollUntilDone(ctx, config.DefaultPollUntilDoneOptions)
286296
if err != nil {
287297
return vm, err

0 commit comments

Comments
 (0)