Skip to content

Commit

Permalink
fix(rollbacks): support for tolerating some instance failures
Browse files Browse the repository at this point in the history
  • Loading branch information
asher committed Sep 25, 2017
1 parent a4e3353 commit 21966dc
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,22 @@ <h3>Rollback {{serverGroup.name}}</h3>
</div>
</div>

<task-reason command="command"></task-reason>
<div class="row">
<task-reason command="command"></task-reason>
</div>

<div class="row">
<div class="col-sm-11 col-sm-offset-1">
Consider rollback successful when
<input type="number"
min="0"
max="100"
ng-model="command.rollbackContext.targetHealthyRollbackPercentage"
class="form-control input-sm inline-number"
/>
percent of instances are healthy.
</div>
</div>

<div class="row">
<div class="col-sm-4 sm-label-right">
Expand All @@ -46,6 +61,10 @@ <h3>Rollback {{serverGroup.name}}</h3>
<strong>max</strong>: {{ serverGroup.capacity.max }},
<strong>desired</strong>: {{ serverGroup.capacity.desired }}
]<br/>(minimum capacity pinned at {{serverGroup.capacity.desired}} to prevent autoscaling down during rollback)
<div ng-if="command.rollbackContext.targetHealthyRollbackPercentage < 100">
(resize considered successful when at least {{minHealthy(command.rollbackContext.targetHealthyRollbackPercentage)}}
instances report healthy)
</div>
</li>
<li>Disable {{ serverGroup.name }}</li>
<li>Restore minimum capacity of <em>{{ command.rollbackContext.restoreServerGroupName || 'previous server group' }}</em> [
Expand Down

0 comments on commit 21966dc

Please sign in to comment.