diff --git a/app/scripts/modules/amazon/src/serverGroup/details/rollback/rollbackServerGroup.controller.js b/app/scripts/modules/amazon/src/serverGroup/details/rollback/rollbackServerGroup.controller.js index b18de506e25..d66ae9aa25c 100644 --- a/app/scripts/modules/amazon/src/serverGroup/details/rollback/rollbackServerGroup.controller.js +++ b/app/scripts/modules/amazon/src/serverGroup/details/rollback/rollbackServerGroup.controller.js @@ -16,13 +16,41 @@ module.exports = angular.module('spinnaker.amazon.serverGroup.details.rollback.c $scope.allServerGroups = allServerGroups.sort((a, b) => b.name.localeCompare(a.name)); $scope.verification = {}; + var desired = serverGroup.capacity.desired; + + function calcPercent(badInstances) { + return Math.floor((desired - badInstances) / desired * 100); + } + + if (desired < 10) { + var healthyPercent = 100; + } else if (desired < 20) { + // accept 1 instance in an unknown state during rollback + healthyPercent = calcPercent(1); + } else if (desired <= 32) { + healthyPercent = calcPercent(2); + } else if (desired <= 64) { + healthyPercent = calcPercent(3); + } else if (desired <= 128) { + healthyPercent = calcPercent(4); + } else if (desired <= 256) { + healthyPercent = calcPercent(5); + } else if (desired > 256) { + healthyPercent = 98; + } + $scope.command = { rollbackType: 'EXPLICIT', rollbackContext: { - rollbackServerGroupName: serverGroup.name + rollbackServerGroupName: serverGroup.name, + targetHealthyRollbackPercentage: healthyPercent } }; + $scope.minHealthy = function(percent) { + return Math.ceil(desired * percent / 100); + }; + if (application && application.attributes) { if (application.attributes.platformHealthOnlyShowOverride && application.attributes.platformHealthOnly) { $scope.command.interestingHealthProviderNames = ['Amazon']; diff --git a/app/scripts/modules/amazon/src/serverGroup/details/rollback/rollbackServerGroup.html b/app/scripts/modules/amazon/src/serverGroup/details/rollback/rollbackServerGroup.html index b5172f06ce5..2d452bf543f 100644 --- a/app/scripts/modules/amazon/src/serverGroup/details/rollback/rollbackServerGroup.html +++ b/app/scripts/modules/amazon/src/serverGroup/details/rollback/rollbackServerGroup.html @@ -30,7 +30,22 @@

Rollback {{serverGroup.name}}

- +
+ +
+ +
+
+ Consider rollback successful when + + percent of instances are healthy. +
+
@@ -46,6 +61,10 @@

Rollback {{serverGroup.name}}

max: {{ serverGroup.capacity.max }}, desired: {{ serverGroup.capacity.desired }} ]
(minimum capacity pinned at {{serverGroup.capacity.desired}} to prevent autoscaling down during rollback) +
+ (resize considered successful when at least {{minHealthy(command.rollbackContext.targetHealthyRollbackPercentage)}} + instances report healthy) +
  • Disable {{ serverGroup.name }}
  • Restore minimum capacity of {{ command.rollbackContext.restoreServerGroupName || 'previous server group' }} [