Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
Also preserve vnet on upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
itowlson authored and jackfrancis committed Mar 14, 2018
1 parent ac4c759 commit 7c1d169
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 42 deletions.
25 changes: 24 additions & 1 deletion pkg/acsengine/transform/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,25 @@ func (t *Transformer) NormalizeResourcesForK8sMasterUpgrade(logger *logrus.Entry
continue
}

if !(resourceType == vmResourceType || resourceType == vmExtensionType || resourceType == nicResourceType) {
dependencies, ok := resourceMap[dependsOnFieldName].([]interface{})
if !ok {
continue
}

for dIndex := len(dependencies) - 1; dIndex >= 0; dIndex-- {
dependency := dependencies[dIndex].(string)
if strings.Contains(dependency, vnetResourceType) || strings.Contains(dependency, vnetID) {
dependencies = append(dependencies[:dIndex], dependencies[dIndex+1:]...)
}
}

if len(dependencies) > 0 {
resourceMap[dependsOnFieldName] = dependencies
} else {
delete(resourceMap, dependsOnFieldName)
}

if !(resourceType == vmResourceType || resourceType == vmExtensionType || resourceType == nicResourceType || resourceType == vnetResourceType) {
continue
}

Expand All @@ -310,6 +328,11 @@ func (t *Transformer) NormalizeResourcesForK8sMasterUpgrade(logger *logrus.Entry
continue
}

if resourceType == vnetResourceType {
filteredResources = filteredResources[:len(filteredResources)-1]
continue
}

if resourceType == nicResourceType {
if strings.Contains(resourceName, "variables('masterVMNamePrefix')") {
continue
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1659,9 +1659,6 @@
"count": "[sub(variables('agentppol1Count'), variables('agentppol1Offset'))]",
"name": "loop"
},
"dependsOn": [
"[variables('vnetID')]"
],
"location": "[variables('location')]",
"name": "[concat(variables('agentppol1VMNamePrefix'), 'nic-', copyIndex(variables('agentppol1Offset')))]",
"properties": {
Expand Down Expand Up @@ -1710,9 +1707,6 @@
"count": "[sub(variables('agentpool2Count'), variables('agentpool2Offset'))]",
"name": "loop"
},
"dependsOn": [
"[variables('vnetID')]"
],
"location": "[variables('location')]",
"name": "[concat(variables('agentpool2VMNamePrefix'), 'nic-', copyIndex(variables('agentpool2Offset')))]",
"properties": {
Expand Down Expand Up @@ -1857,37 +1851,6 @@
},
"type": "Microsoft.Compute/availabilitySets"
},
{
"apiVersion": "[variables('apiVersionDefault')]",
"dependsOn": [
"[concat('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]",
"[concat('Microsoft.Network/routeTables/', variables('routeTableName'))]"
],
"location": "[variables('location')]",
"name": "[variables('virtualNetworkName')]",
"properties": {
"addressSpace": {
"addressPrefixes": [
"[variables('vnetCidr')]"
]
},
"subnets": [
{
"name": "[variables('subnetName')]",
"properties": {
"addressPrefix": "[variables('subnet')]",
"networkSecurityGroup": {
"id": "[variables('nsgID')]"
},
"routeTable": {
"id": "[variables('routeTableID')]"
}
}
}
]
},
"type": "Microsoft.Network/virtualNetworks"
},
{
"apiVersion": "[variables('apiVersionDefault')]",
"location": "[variables('location')]",
Expand Down Expand Up @@ -1993,9 +1956,6 @@
},
{
"apiVersion": "[variables('apiVersionDefault')]",
"dependsOn": [
"[variables('vnetID')]"
],
"location": "[variables('location')]",
"name": "[variables('masterInternalLbName')]",
"properties": {
Expand Down Expand Up @@ -2089,7 +2049,6 @@
"name": "nicLoopNode"
},
"dependsOn": [
"[variables('vnetID')]",
"[concat(variables('masterLbID'),'/inboundNatRules/SSH-',variables('masterVMNamePrefix'),copyIndex(variables('masterOffset')))]",
"[variables('masterInternalLbName')]"
],
Expand Down

0 comments on commit 7c1d169

Please sign in to comment.