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

Commit

Permalink
removed datadisk to allow scale after upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
shanalily authored and jackfrancis committed Jul 23, 2018
1 parent 03e6909 commit c7b8335
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 25 deletions.
15 changes: 14 additions & 1 deletion pkg/acsengine/transform/transform.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ func (t *Transformer) NormalizeMasterResourcesForScaling(logger *logrus.Entry, t
delete(hardwareProfile, vmSizeFieldName)
}

if !t.removeCustomData(logger, resourceProperties) || !t.removeImageReference(logger, resourceProperties) {
if !t.removeCustomData(logger, resourceProperties) || !t.removeDataDisks(logger, resourceProperties) || !t.removeImageReference(logger, resourceProperties) {
continue
}
}
Expand All @@ -321,6 +321,19 @@ func (t *Transformer) removeCustomData(logger *logrus.Entry, resourceProperties
return ok
}

func (t *Transformer) removeDataDisks(logger *logrus.Entry, resourceProperties map[string]interface{}) bool {
storageProfile, ok := resourceProperties[storageProfileFieldName].(map[string]interface{})
if !ok {
logger.Warnf("Template improperly formatted. Could not find: %s", storageProfileFieldName)
return ok
}

if storageProfile[dataDisksFieldName] != nil {
delete(storageProfile, dataDisksFieldName)
}
return ok
}

func (t *Transformer) removeImageReference(logger *logrus.Entry, resourceProperties map[string]interface{}) bool {
storageProfile, ok := resourceProperties[storageProfileFieldName].(map[string]interface{})
if !ok {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1991,14 +1991,6 @@
}
},
"storageProfile": {
"dataDisks": [
{
"createOption": "attach",
"diskSizeGB": "128",
"lun": 0,
"name": "[concat(variables('masterVMNamePrefix'), copyIndex(variables('masterOffset')),'-etcddisk')]"
}
],
"osDisk": {
"caching": "ReadWrite",
"createOption": "FromImage"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2173,14 +2173,6 @@
}
},
"storageProfile": {
"dataDisks": [
{
"createOption": "Empty",
"diskSizeGB": "128",
"lun": 0,
"name": "[concat(variables('masterVMNamePrefix'), copyIndex(variables('masterOffset')),'-etcddisk')]"
}
],
"osDisk": {
"caching": "ReadWrite",
"createOption": "FromImage"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2117,14 +2117,6 @@
}
},
"storageProfile": {
"dataDisks": [
{
"createOption": "Empty",
"diskSizeGB": "128",
"lun": 0,
"name": "[concat(variables('masterVMNamePrefix'), copyIndex(variables('masterOffset')),'-etcddisk')]"
}
],
"osDisk": {
"caching": "ReadWrite",
"createOption": "FromImage"
Expand Down

0 comments on commit c7b8335

Please sign in to comment.