Skip to content

Commit

Permalink
feat(aws/netflix): Add UX for specifying ASG Metrics
Browse files Browse the repository at this point in the history
See also spinnaker/spinnaker#1548.

These changes introduce an Group Metrics (EnabledMetrics) Advanced
Setting. Exposing the EnabledMetrics property we added support for in
spinnaker/clouddriver#1563.
  • Loading branch information
erran committed Apr 11, 2017
1 parent 88ec307 commit a85edd1
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ module.exports = angular.module('spinnaker.aws.serverGroupCommandBuilder.service
},
targetHealthyDeployPercentage: 100,
cooldown: 10,
enabledMetrics: [],
healthCheckType: 'EC2',
healthCheckGracePeriod: 600,
instanceMonitoring: false,
Expand Down Expand Up @@ -145,6 +146,7 @@ module.exports = angular.module('spinnaker.aws.serverGroupCommandBuilder.service
{ asgName: serverGroup.name, region: serverGroup.region }
],
cooldown: serverGroup.asg.defaultCooldown,
enabledMetrics: angular.copy(serverGroup.asg.enabledMetrics),
healthCheckGracePeriod: serverGroup.asg.healthCheckGracePeriod,
healthCheckType: serverGroup.asg.healthCheckType,
terminationPolicies: angular.copy(serverGroup.asg.terminationPolicies),
Expand Down Expand Up @@ -190,6 +192,7 @@ module.exports = angular.module('spinnaker.aws.serverGroupCommandBuilder.service
freeFormDetails: serverGroupName.freeFormDetails,
credentials: serverGroup.account,
cooldown: serverGroup.asg.defaultCooldown,
enabledMetrics: serverGroup.asg.enabledMetrics,
healthCheckGracePeriod: serverGroup.asg.healthCheckGracePeriod,
healthCheckType: serverGroup.asg.healthCheckType,
terminationPolicies: serverGroup.asg.terminationPolicies,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@ module.exports = angular.module('spinnaker.aws.serverGroup.configure.service', [
serverGroupCommandRegistry, autoScalingProcessService) {


var healthCheckTypes = ['EC2', 'ELB'],
var enabledMetrics = ['GroupMinSize', 'GroupMaxSize', 'GroupDesiredCapacity', 'GroupInServiceInstances', 'GroupPendingInstances', 'GroupStandbyInstances', 'GroupTerminatingInstances', 'GroupTotalInstances'],
healthCheckTypes = ['EC2', 'ELB'],
terminationPolicies = ['OldestInstance', 'NewestInstance', 'OldestLaunchConfiguration', 'ClosestToNextInstanceHour', 'Default'];

function configureUpdateCommand(command) {
command.backingData = {
enabledMetrics: angular.copy(enabledMetrics),
healthCheckTypes: angular.copy(healthCheckTypes),
terminationPolicies: angular.copy(terminationPolicies)
};
Expand Down Expand Up @@ -85,6 +87,7 @@ module.exports = angular.module('spinnaker.aws.serverGroup.configure.service', [
keyPairs: keyPairsReader.listKeyPairs(),
packageImages: imageLoader,
instanceTypes: awsInstanceTypeService.getAllTypesByRegion(),
enabledMetrics: $q.when(angular.copy(enabledMetrics)),
healthCheckTypes: $q.when(angular.copy(healthCheckTypes)),
terminationPolicies: $q.when(angular.copy(terminationPolicies)),
}).then(function(backingData) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,23 @@
class="form-control input-sm no-spel"
ng-model="$ctrl.command.cooldown"/></div>&nbsp;seconds
</div>
<div class="form-group">
<div class="col-md-5 sm-label-right">
<b>Enabled Metrics</b>
<help-field key="aws.serverGroup.enabledMetrics"></help-field>
</div>
<div class="col-md-6">

<ui-select multiple ng-model="$ctrl.command.enabledMetrics" class="form-control input-sm">
<ui-select-match>{{$item}}</ui-select-match>
<ui-select-choices repeat="enabledMetric in $ctrl.command.backingData.enabledMetrics | filter: $select.search | orderBy: 'toString()'">
<span ng-bind-html="enabledMetric | highlight: $select.search"></span>
</ui-select-choices>
</ui-select>

</div>
</div>

<div class="form-group">
<div class="col-md-5 sm-label-right"><b>Health Check Type</b></div>
<div class="col-md-6">
Expand Down Expand Up @@ -87,7 +104,11 @@
ng-model="$ctrl.command.base64UserData"/></div>
</div>
<div class="form-group">
<div class="col-md-5 sm-label-right"><b>Instance Monitoring</b></div>
<div class="col-md-5 sm-label-right">
<b>Instance Monitoring</b>
<help-field key="aws.serverGroup.instanceMonitoring"></help-field>
</div>

<div class="col-md-6 checkbox">
<label><input type="checkbox" ng-model="$ctrl.command.instanceMonitoring"/> Enable Instance Monitoring </label>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,22 @@ <h3>Edit Advanced Settings for {{serverGroup.name}}</h3>
class="form-control input-sm"
ng-model="command.cooldown"/></div>&nbsp;seconds
</div>
<div class="form-group">
<div class="col-md-5 sm-label-right">
<b>Enabled Metrics</b>
<help-field key="aws.serverGroup.enabledMetrics"></help-field>
</div>
<div class="col-md-6">

<ui-select multiple ng-model="$ctrl.command.enabledMetrics" class="form-control input-sm">
<ui-select-match>{{$item}}</ui-select-match>
<ui-select-choices repeat="enabledMetric in $ctrl.command.backingData.enabledMetrics | filter: $select.search | orderBy: 'toString()'">
<span ng-bind-html="enabledMetric | highlight: $select.search"></span>
</ui-select-choices>
</ui-select>

</div>
</div>
<div class="form-group">
<div class="col-md-5 sm-label-right"><b>Health Check Type</b></div>
<div class="col-md-6">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ <h3 select-on-dbl-click>
<dl class="horizontal-when-filters-collapsed">
<dt>Cooldown</dt>
<dd>{{ctrl.serverGroup.asg.defaultCooldown}} seconds</dd>
<dt>Enabled Metrics</dt>
<dd>{{ctrl.serverGroup.asg.enabledMetrics.join(', ')}}</dd>
<dt>Health Check Type</dt>
<dd>{{ctrl.serverGroup.asg.healthCheckType}}</dd>
<dt>Grace Period</dt>
Expand Down
2 changes: 2 additions & 0 deletions app/scripts/modules/core/help/helpContents.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ <h3 select-on-dbl-click>
<dl class="horizontal-when-filters-collapsed">
<dt>Cooldown</dt>
<dd>{{ctrl.serverGroup.asg.defaultCooldown}} seconds</dd>
<dt>Enabled Metrics</dt>
<dd>{{ctrl.serverGroup.asg.enabledMetrics.join(', ')}}</dd>
<dt>Health Check Type</dt>
<dd>{{ctrl.serverGroup.asg.healthCheckType}}</dd>
<dt>Grace Period</dt>
Expand Down

0 comments on commit a85edd1

Please sign in to comment.