Fix issue creating the VMSS reference object, resulting in incorrect NAT Pool migrations (#95)
* added progress bars * fix vmss reference object creation * version bump
This commit is contained in:
Родитель
ee4b8db8d0
Коммит
4cc5e7f7d2
|
@ -12,7 +12,7 @@
|
|||
RootModule = 'AzureBasicLoadBalancerUpgrade'
|
||||
|
||||
# Version number of this module.
|
||||
ModuleVersion = '2.3.2'
|
||||
ModuleVersion = '2.3.3'
|
||||
|
||||
# Supported PSEditions
|
||||
# CompatiblePSEditions = @()
|
||||
|
@ -107,7 +107,7 @@
|
|||
# IconUri = ''
|
||||
|
||||
# ReleaseNotes of this module
|
||||
ReleaseNotes = 'Added progress bar to the migration process.'
|
||||
ReleaseNotes = 'Fixed issue with creating a reference object of the VMSS, resulting inconsistent NAT Pool membership'
|
||||
|
||||
# Prerelease string of this module
|
||||
# Prerelease = ''
|
||||
|
|
|
@ -98,7 +98,8 @@ function PublicLBMigrationVmss {
|
|||
[Parameter(Mandatory = $True)][string] $StandardLoadBalancerName,
|
||||
[Parameter(Mandatory = $true)][string] $RecoveryBackupPath,
|
||||
[Parameter(Mandatory = $true)][psobject] $scenario,
|
||||
[Parameter(Mandatory = $false)][switch]$outputMigrationValiationObj
|
||||
[Parameter(Mandatory = $false)][switch]$outputMigrationValiationObj,
|
||||
[Parameter(Mandatory = $false)][Microsoft.Azure.Commands.Compute.Automation.Models.PSVirtualMachineScaleSet] $refVmss
|
||||
)
|
||||
|
||||
$progressParams = @{
|
||||
|
@ -111,7 +112,6 @@ function PublicLBMigrationVmss {
|
|||
|
||||
# Creating a vmss object before it gets changed as a reference for the backend pool migration
|
||||
Write-Progress -Status "Backing up VMSS" -ParentId 4 @progressParams
|
||||
$refVmss = GetVmssFromBasicLoadBalancer -BasicLoadBalancer $BasicLoadBalancer
|
||||
|
||||
# Backup VMSS Configurations
|
||||
BackupVmss -BasicLoadBalancer $BasicLoadBalancer -RecoveryBackupPath $RecoveryBackupPath
|
||||
|
@ -180,7 +180,8 @@ function InternalLBMigrationVmss {
|
|||
[Parameter(Mandatory = $True)][string] $StandardLoadBalancerName,
|
||||
[Parameter(Mandatory = $true)][string] $RecoveryBackupPath,
|
||||
[Parameter(Mandatory = $true)][psobject] $scenario,
|
||||
[Parameter(Mandatory = $false)][switch]$outputMigrationValiationObj
|
||||
[Parameter(Mandatory = $false)][switch]$outputMigrationValiationObj,
|
||||
[Parameter(Mandatory = $false)][Microsoft.Azure.Commands.Compute.Automation.Models.PSVirtualMachineScaleSet] $refVmss
|
||||
)
|
||||
|
||||
$progressParams = @{
|
||||
|
@ -192,7 +193,6 @@ function InternalLBMigrationVmss {
|
|||
|
||||
# Creating a vmss object before it gets changed as a reference for the backend pool migration
|
||||
Write-Progress -Status "Backing up VMSS" -PercentComplete ((1/14) * 100) @progressParams
|
||||
$refVmss = GetVmssFromBasicLoadBalancer -BasicLoadBalancer $BasicLoadBalancer
|
||||
|
||||
# Backup VMSS Configurations
|
||||
Write-Progress -Status "Backing up VMSS Configurations" -PercentComplete ((2/14) * 100) @progressParams
|
||||
|
@ -838,6 +838,11 @@ function LBMigrationPrep {
|
|||
Write-Progress -Status "Backing up Basic Load Balancer Configurations" -PercentComplete ((2/4) * 100) @progressParams
|
||||
BackupBasicLoadBalancer -BasicLoadBalancer $migrationConfig.BasicLoadBalancer -RecoveryBackupPath $RecoveryBackupPath
|
||||
|
||||
# get a reference copy of the vmss prior to modifying it
|
||||
If ($migrationConfig.scenario.backendType -eq 'VMSS') {
|
||||
$migrationConfig['vmssRefObject'] = GetVmssFromBasicLoadBalancer -BasicLoadBalancer $migrationConfig.BasicLoadBalancer
|
||||
}
|
||||
|
||||
If ($migrationConfig.scenario.ExternalOrInternal -eq 'External') {
|
||||
# Migrate public IP addresses on Basic LB to static (if dynamic)
|
||||
Write-Progress -Status "Migrating public IP addresses on Basic LB to static (if dynamic)" -PercentComplete ((3/4) * 100) @progressParams
|
||||
|
@ -850,6 +855,9 @@ function LBMigrationPrep {
|
|||
|
||||
log -message "[LBMigrationPrep] Completed preparing load balancer '$($migrationConfig.BasicLoadBalancer.Name)' for migration"
|
||||
}
|
||||
|
||||
# return the migration configs with the reference vmss object
|
||||
return $migrationConfigs
|
||||
}
|
||||
|
||||
Export-ModuleMember -Function PublicLBMigrationVmss
|
||||
|
|
|
@ -252,7 +252,7 @@ function Start-AzBasicLoadBalancerUpgrade {
|
|||
# verify basic load balancer configuration is a supported scenario
|
||||
|
||||
## verify scenario for a single load balancer
|
||||
Write-Progress -Activity "Validating Migration Scenario" -Status "Validating Migration Scenario" -Id 2
|
||||
Write-Progress -Activity "Validating Migration Scenario" -Status "Validating Migration Scenario" -PercentComplete 0 -Id 2
|
||||
If ($PSCmdlet.ParameterSetName -ne 'MultiLB') {
|
||||
if ($PSBoundParameters.ContainsKey("StandardLoadBalancerName")) {
|
||||
$StdLoadBalancerName = $StandardLoadBalancerName
|
||||
|
@ -268,6 +268,7 @@ function Start-AzBasicLoadBalancerUpgrade {
|
|||
BasicLoadBalancer = $BasicLoadBalancer
|
||||
StandardLoadBalancerName = $StdLoadBalancerName
|
||||
scenario = $scenario
|
||||
vmssRefObject = ''
|
||||
})
|
||||
|
||||
if ($validateScenarioOnly) {
|
||||
|
@ -314,16 +315,16 @@ function Start-AzBasicLoadBalancerUpgrade {
|
|||
# prepare for migration by backing up the basic LB, upgrading Public IPs, and deleting the LB
|
||||
# this is done before the migration starts to ensure that all basic LBs are disassociated with any backend pool members, avoiding a mixed SKU scenario which would otherwise occur
|
||||
|
||||
Write-Progress -Activity "Preparing for Migration" -Status "Preparing for Migration" -Id 3
|
||||
Write-Progress -Activity "Preparing for Migration" -Status "Preparing for Migration" -Id 3 -PercentComplete 0
|
||||
log -Message "[Start-AzBasicLoadBalancerUpgrade] Preparing for migration by backing up and deleteing the basic LB(s)"
|
||||
LBMigrationPrep -migrationConfigs $migrationConfigs -RecoveryBackupPath $RecoveryBackupPath
|
||||
$migrationConfigs = LBMigrationPrep -migrationConfigs $migrationConfigs -RecoveryBackupPath $RecoveryBackupPath
|
||||
Write-Progress -Activity "Preparing for Migration" -Status "Preparing for Migration" -Completed -Id 3
|
||||
|
||||
# initiate the migration of each load balancer in the migration config array
|
||||
Write-Progress -Activity "Starting Migration" -Status "Starting Migration" -Id 4
|
||||
$migrationConfigsCompleted = 0
|
||||
ForEach ($migrationConfig in $migrationConfigs) {
|
||||
Write-Progress -Activity "Starting Migration" -Status "Starting migration of basic load balancer '$($migrationConfig.BasicLoadBalancer.Name)'" -Id 4
|
||||
Write-Progress -Activity "Starting Migration" -Status "Starting migration of basic load balancer '$($migrationConfig.BasicLoadBalancer.Name)'" -Id 4 -PercentComplete 0
|
||||
log -Message "[Start-AzBasicLoadBalancerUpgrade] Starting migration for Basic Load Balancer '$($migrationConfig.BasicLoadBalancer.Name)' in Resource Group '$($migrationConfig.BasicLoadBalancer.ResourceGroupName)'"
|
||||
|
||||
$standardScenarioParams = @{
|
||||
|
@ -358,7 +359,7 @@ function Start-AzBasicLoadBalancerUpgrade {
|
|||
switch ($migrationConfig.scenario.ExternalOrInternal) {
|
||||
'internal' {
|
||||
if ((!$PSBoundParameters.ContainsKey("FailedMigrationRetryFilePathLB"))) {
|
||||
InternalLBMigrationVmss @standardScenarioParams -RecoveryBackupPath $RecoveryBackupPath
|
||||
InternalLBMigrationVmss @standardScenarioParams -RecoveryBackupPath $RecoveryBackupPath -refVmss $migrationConfig.vmssRefObject
|
||||
}
|
||||
else {
|
||||
RestoreInternalLBMigrationVmss @standardScenarioParams -vmss $vmss
|
||||
|
@ -366,7 +367,7 @@ function Start-AzBasicLoadBalancerUpgrade {
|
|||
}
|
||||
'external' {
|
||||
if ((!$PSBoundParameters.ContainsKey("FailedMigrationRetryFilePathLB"))) {
|
||||
PublicLBMigrationVmss @standardScenarioParams -RecoveryBackupPath $RecoveryBackupPath
|
||||
PublicLBMigrationVmss @standardScenarioParams -RecoveryBackupPath $RecoveryBackupPath -refVmss $migrationConfig.vmssRefObject
|
||||
}
|
||||
else {
|
||||
RestoreExternalLBMigrationVmss @standardScenarioParams -vmss $vmss
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
},
|
||||
"clusterName": {
|
||||
"type": "string",
|
||||
"defaultValue": "clustermtb7",
|
||||
"defaultValue": "[concat('cluster',substring(uniqueString(deployment().properties.templateHash),0,4))]",
|
||||
"metadata": {
|
||||
"description": "Name of your cluster - Between 3 and 23 characters. Letters and numbers only"
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче