@spinnaker/amazon 0.8.7 → 0.8.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/dist/domain/IAmazonServerGroup.d.ts +5 -3
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/serverGroup/details/scalingPolicy/targetTracking/TargetMetricFields.d.ts +1 -1
- package/dist/serverGroup/details/scalingPolicy/targetTracking/TargetTrackingAdditionalSettings.d.ts +1 -0
- package/dist/serverGroup/details/scalingPolicy/targetTracking/UpsertTargetTrackingModal.d.ts +8 -0
- package/dist/serverGroup/details/scalingPolicy/upsert/ScalingPolicyAdditionalSettings.d.ts +1 -0
- package/dist/serverGroup/details/scalingPolicy/upsert/UpsertScalingPolicyModal.d.ts +8 -0
- package/dist/serverGroup/details/scalingPolicy/upsert/step/StepPolicyAction.d.ts +2 -3
- package/dist/serverGroup/details/sections/InstancesDistributionDetailsSection.d.ts +2 -0
- package/dist/serverGroup/details/sections/index.d.ts +1 -1
- package/package.json +3 -3
- package/src/aws.module.ts +2 -2
- package/src/domain/IAmazonServerGroup.ts +5 -3
- package/src/serverGroup/details/scalingPolicy/CreateScalingPolicyButton.tsx +17 -28
- package/src/serverGroup/details/scalingPolicy/alarmBasedSummary.component.js +45 -49
- package/src/serverGroup/details/scalingPolicy/chart/MetricAlarmChart.tsx +3 -2
- package/src/serverGroup/details/scalingPolicy/targetTracking/TargetMetricFields.tsx +2 -2
- package/src/serverGroup/details/scalingPolicy/targetTracking/TargetTrackingAdditionalSettings.less +11 -0
- package/src/serverGroup/details/scalingPolicy/targetTracking/TargetTrackingAdditionalSettings.tsx +18 -16
- package/src/serverGroup/details/scalingPolicy/targetTracking/UpsertTargetTrackingModal.tsx +75 -0
- package/src/serverGroup/details/scalingPolicy/targetTracking/targetTrackingSummary.component.ts +10 -16
- package/src/serverGroup/details/scalingPolicy/upsert/ScalingPolicyAdditionalSettings.less +11 -0
- package/src/serverGroup/details/scalingPolicy/upsert/ScalingPolicyAdditionalSettings.tsx +9 -8
- package/src/serverGroup/details/scalingPolicy/upsert/UpsertScalingPolicyModal.tsx +211 -0
- package/src/serverGroup/details/scalingPolicy/upsert/alarm/AlarmConfigurer.tsx +17 -23
- package/src/serverGroup/details/scalingPolicy/upsert/alarm/DimensionsEditor.tsx +2 -2
- package/src/serverGroup/details/scalingPolicy/upsert/alarm/MetricSelector.tsx +2 -1
- package/src/serverGroup/details/scalingPolicy/upsert/step/StepPolicyAction.tsx +4 -4
- package/src/serverGroup/details/sections/{InstancesDiversificationDetailsSection.spec.tsx → InstancesDistributionDetailsSection.spec.tsx} +8 -8
- package/src/serverGroup/details/sections/{InstancesDiversificationDetailsSection.tsx → InstancesDistributionDetailsSection.tsx} +10 -10
- package/src/serverGroup/details/sections/LaunchTemplateDetailsSection.spec.tsx +1 -1
- package/src/serverGroup/details/sections/LaunchTemplateDetailsSection.tsx +1 -1
- package/src/serverGroup/details/sections/MultipleInstanceTypesSubSection.tsx +1 -1
- package/src/serverGroup/details/sections/index.ts +1 -1
- package/dist/serverGroup/details/scalingPolicy/targetTracking/upsertTargetTracking.controller.d.ts +0 -41
- package/dist/serverGroup/details/scalingPolicy/upsert/alarm/alarmConfigurer.component.d.ts +0 -2
- package/dist/serverGroup/details/scalingPolicy/upsert/alarm/dimensionsEditor.component.d.ts +0 -2
- package/dist/serverGroup/details/scalingPolicy/upsert/simple/simplePolicyAction.component.d.ts +0 -2
- package/dist/serverGroup/details/scalingPolicy/upsert/upsertScalingPolicy.controller.d.ts +0 -2
- package/dist/serverGroup/details/sections/InstancesDiversificationDetailsSection.d.ts +0 -2
- package/src/serverGroup/details/scalingPolicy/targetTracking/upsertTargetTracking.controller.ts +0 -129
- package/src/serverGroup/details/scalingPolicy/targetTracking/upsertTargetTracking.modal.html +0 -94
- package/src/serverGroup/details/scalingPolicy/upsert/simple/simplePolicyAction.component.js +0 -20
- package/src/serverGroup/details/scalingPolicy/upsert/upsertScalingPolicy.controller.js +0 -248
- package/src/serverGroup/details/scalingPolicy/upsert/upsertScalingPolicy.modal.html +0 -74
- package/src/serverGroup/details/scalingPolicy/upsert/upsertScalingPolicy.modal.less +0 -32
package/src/serverGroup/details/scalingPolicy/targetTracking/upsertTargetTracking.controller.ts
DELETED
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import { IComponentController, IScope } from 'angular';
|
|
2
|
-
import { IModalServiceInstance } from 'angular-ui-bootstrap';
|
|
3
|
-
import { cloneDeep } from 'lodash';
|
|
4
|
-
import { Subject } from 'rxjs';
|
|
5
|
-
|
|
6
|
-
import { Application, IServerGroup, TaskMonitor } from '@spinnaker/core';
|
|
7
|
-
|
|
8
|
-
import { IUpsertScalingPolicyCommand, ScalingPolicyWriter } from '../ScalingPolicyWriter';
|
|
9
|
-
import {
|
|
10
|
-
ICustomizedMetricSpecification,
|
|
11
|
-
ITargetTrackingConfiguration,
|
|
12
|
-
ITargetTrackingPolicy,
|
|
13
|
-
} from '../../../../domain';
|
|
14
|
-
|
|
15
|
-
export type MetricType = 'custom' | 'predefined';
|
|
16
|
-
|
|
17
|
-
export interface ITargetTrackingState {
|
|
18
|
-
metricType: MetricType;
|
|
19
|
-
unit: string;
|
|
20
|
-
scaleInChanged: boolean;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface ITargetTrackingPolicyCommand extends IUpsertScalingPolicyCommand {
|
|
24
|
-
estimatedInstanceWarmup: number;
|
|
25
|
-
targetTrackingConfiguration: ITargetTrackingConfiguration;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
export class UpsertTargetTrackingController implements IComponentController {
|
|
29
|
-
public predefinedMetrics = ['ASGAverageCPUUtilization', 'ASGAverageNetworkOut', 'ASGAverageNetworkIn'];
|
|
30
|
-
public statistics = ['Average', 'Maximum', 'Minimum', 'SampleCount', 'Sum'];
|
|
31
|
-
public alarmUpdated = new Subject();
|
|
32
|
-
|
|
33
|
-
public taskMonitor: TaskMonitor;
|
|
34
|
-
public state: ITargetTrackingState;
|
|
35
|
-
public command: ITargetTrackingPolicyCommand;
|
|
36
|
-
|
|
37
|
-
public static $inject = ['$uibModalInstance', 'policy', 'serverGroup', 'application', '$scope'];
|
|
38
|
-
constructor(
|
|
39
|
-
private $uibModalInstance: IModalServiceInstance,
|
|
40
|
-
public policy: ITargetTrackingPolicy,
|
|
41
|
-
public serverGroup: IServerGroup,
|
|
42
|
-
public application: Application,
|
|
43
|
-
private $scope: IScope,
|
|
44
|
-
) {}
|
|
45
|
-
|
|
46
|
-
public $onInit() {
|
|
47
|
-
const metricType = this.policy.targetTrackingConfiguration.customizedMetricSpecification ? 'custom' : 'predefined';
|
|
48
|
-
this.command = this.buildCommand();
|
|
49
|
-
this.state = {
|
|
50
|
-
metricType,
|
|
51
|
-
unit: null,
|
|
52
|
-
scaleInChanged: false,
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
public metricTypeChanged = (type: MetricType) => {
|
|
57
|
-
this.state.metricType = type;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
public toggleMetricType = (): void => {
|
|
61
|
-
const config = this.command.targetTrackingConfiguration;
|
|
62
|
-
if (this.state.metricType === 'predefined') {
|
|
63
|
-
config.predefinedMetricSpecification = null;
|
|
64
|
-
config.customizedMetricSpecification = {
|
|
65
|
-
metricName: 'CPUUtilization',
|
|
66
|
-
namespace: 'AWS/EC2',
|
|
67
|
-
dimensions: [{ name: 'AutoScalingGroupName', value: this.serverGroup.name }],
|
|
68
|
-
statistic: 'Average',
|
|
69
|
-
};
|
|
70
|
-
this.state.metricType = 'custom';
|
|
71
|
-
} else {
|
|
72
|
-
config.customizedMetricSpecification = null;
|
|
73
|
-
config.predefinedMetricSpecification = {
|
|
74
|
-
predefinedMetricType: 'ASGAverageCPUUtilization',
|
|
75
|
-
};
|
|
76
|
-
this.state.metricType = 'predefined';
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
public updateUnit = (unit: string) => {
|
|
81
|
-
this.state.unit = unit;
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
public scaleInChanged(): void {
|
|
85
|
-
this.state.scaleInChanged = true;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
public alarmChanged = (newAlarm: ICustomizedMetricSpecification) => {
|
|
89
|
-
this.command.targetTrackingConfiguration.customizedMetricSpecification = newAlarm;
|
|
90
|
-
this.alarmUpdated.next();
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
public commandChanged = (updatedCommand: ITargetTrackingPolicyCommand) => {
|
|
94
|
-
this.$scope.$applyAsync(() => {
|
|
95
|
-
this.command = updatedCommand;
|
|
96
|
-
});
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
public cancel(): void {
|
|
100
|
-
this.$uibModalInstance.dismiss();
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
public save(): void {
|
|
104
|
-
const action = this.policy.policyName ? 'Update' : 'Create';
|
|
105
|
-
const command = cloneDeep(this.command);
|
|
106
|
-
this.taskMonitor = new TaskMonitor({
|
|
107
|
-
application: this.application,
|
|
108
|
-
title: `${action} scaling policy for ${this.serverGroup.name}`,
|
|
109
|
-
modalInstance: this.$uibModalInstance,
|
|
110
|
-
submitMethod: () => ScalingPolicyWriter.upsertScalingPolicy(this.application, command),
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
this.taskMonitor.submit();
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
private buildCommand(): ITargetTrackingPolicyCommand {
|
|
117
|
-
return {
|
|
118
|
-
type: 'upsertScalingPolicy',
|
|
119
|
-
cloudProvider: 'aws',
|
|
120
|
-
credentials: this.serverGroup.account,
|
|
121
|
-
region: this.serverGroup.region,
|
|
122
|
-
serverGroupName: this.serverGroup.name,
|
|
123
|
-
adjustmentType: null,
|
|
124
|
-
name: this.policy.policyName,
|
|
125
|
-
estimatedInstanceWarmup: this.policy.estimatedInstanceWarmup || 600,
|
|
126
|
-
targetTrackingConfiguration: { ...this.policy.targetTrackingConfiguration },
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
}
|
package/src/serverGroup/details/scalingPolicy/targetTracking/upsertTargetTracking.modal.html
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
<div modal-page class="scaling-policy-modal form-inline">
|
|
2
|
-
<task-monitor monitor="$ctrl.taskMonitor"></task-monitor>
|
|
3
|
-
<modal-close dismiss="$dismiss()"></modal-close>
|
|
4
|
-
<div class="modal-header">
|
|
5
|
-
<h4 class="modal-title">{{$ctrl.policy.policyName ? "Update" : "Create"}} scaling policy</h4>
|
|
6
|
-
</div>
|
|
7
|
-
<div class="modal-body">
|
|
8
|
-
<form name="form" novalidate>
|
|
9
|
-
<h4 class="section-heading">Target Metric</h4>
|
|
10
|
-
<target-metric-fields
|
|
11
|
-
allow-dual-mode="true"
|
|
12
|
-
cloudwatch="false"
|
|
13
|
-
command="$ctrl.command"
|
|
14
|
-
is-custom-metric="$ctrl.state.metricType === 'custom'"
|
|
15
|
-
server-group="$ctrl.serverGroup"
|
|
16
|
-
toggle-metric-type="$ctrl.metricTypeChanged"
|
|
17
|
-
unit="$ctrl.state.unit"
|
|
18
|
-
update-command="$ctrl.commandChanged"
|
|
19
|
-
update-unit="$ctrl.updateUnit"
|
|
20
|
-
></target-metric-fields>
|
|
21
|
-
<h4 class="section-heading">Additional Settings</h4>
|
|
22
|
-
<div class="section-body section-additional-settings">
|
|
23
|
-
<div class="row" ng-if="$ctrl.policy.policyName">
|
|
24
|
-
<div class="col-md-2 sm-label-right">Policy Name</div>
|
|
25
|
-
<div class="col-md-10 content-fields">
|
|
26
|
-
<span class="form-control-static select-placeholder" ng-bind="$ctrl.policy.policyName"></span>
|
|
27
|
-
</div>
|
|
28
|
-
</div>
|
|
29
|
-
|
|
30
|
-
<div class="row">
|
|
31
|
-
<div class="col-md-2 sm-label-right">Warmup</div>
|
|
32
|
-
<div class="col-md-10 content-fields">
|
|
33
|
-
<span class="form-control-static select-placeholder">Instances need</span>
|
|
34
|
-
<input
|
|
35
|
-
type="number"
|
|
36
|
-
style="width: 60px"
|
|
37
|
-
class="form-control input-sm"
|
|
38
|
-
required
|
|
39
|
-
ng-model="$ctrl.command.estimatedInstanceWarmup"
|
|
40
|
-
/>
|
|
41
|
-
<span class="input-label"> seconds to warm up </span>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
|
|
45
|
-
<div class="row">
|
|
46
|
-
<div class="col-md-2 sm-label-right">Scale In</div>
|
|
47
|
-
<div class="col-md-9">
|
|
48
|
-
<div class="checkbox" style="margin-top: 5px">
|
|
49
|
-
<label>
|
|
50
|
-
<input
|
|
51
|
-
type="checkbox"
|
|
52
|
-
ng-model="$ctrl.command.targetTrackingConfiguration.disableScaleIn"
|
|
53
|
-
ng-change="$ctrl.scaleInChanged()"
|
|
54
|
-
/>
|
|
55
|
-
Disable Scale-downs
|
|
56
|
-
</label>
|
|
57
|
-
<div class="small" style="margin-top: 5px">
|
|
58
|
-
<p>
|
|
59
|
-
This option disables scale-downs for the target tracking policy, while keeping the scale-ups. This
|
|
60
|
-
means that ASG will not scale down unless you explicitly set up a separate step policy to scale it
|
|
61
|
-
down.
|
|
62
|
-
</p>
|
|
63
|
-
<p>This is useful when you have special requirements, such as gradual or delayed scale-down.</p>
|
|
64
|
-
</div>
|
|
65
|
-
</div>
|
|
66
|
-
</div>
|
|
67
|
-
</div>
|
|
68
|
-
|
|
69
|
-
<div class="row" ng-if="$ctrl.state.scaleInChanged">
|
|
70
|
-
<div class="col-md-10 col-md-offset-1 well">
|
|
71
|
-
<div ng-if="$ctrl.command.targetTrackingConfiguration.disableScaleIn">
|
|
72
|
-
This policy will not scale down. Make sure you have another policy (either TT or Step) that will scale
|
|
73
|
-
down this ASG.
|
|
74
|
-
</div>
|
|
75
|
-
<div ng-if="!$ctrl.command.targetTrackingConfiguration.disableScaleIn">
|
|
76
|
-
This policy will scale both up and down. Make sure you don't have other scaling policies, as they will
|
|
77
|
-
likely interfere with each other.
|
|
78
|
-
</div>
|
|
79
|
-
</div>
|
|
80
|
-
</div>
|
|
81
|
-
</div>
|
|
82
|
-
</form>
|
|
83
|
-
</div>
|
|
84
|
-
|
|
85
|
-
<div class="modal-footer">
|
|
86
|
-
<button class="btn btn-default" ng-click="$ctrl.cancel()">Cancel</button>
|
|
87
|
-
<submit-button
|
|
88
|
-
is-disabled="!form.$valid || $ctrl.taskMonitor.submitting"
|
|
89
|
-
submitting="$ctrl.taskMonitor.submitting"
|
|
90
|
-
on-click="$ctrl.save()"
|
|
91
|
-
is-new="!$ctrl.policy.policyName"
|
|
92
|
-
></submit-button>
|
|
93
|
-
</div>
|
|
94
|
-
</div>
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { module } from 'angular';
|
|
2
|
-
import { react2angular } from 'react2angular';
|
|
3
|
-
import { withErrorBoundary } from '@spinnaker/core';
|
|
4
|
-
|
|
5
|
-
import { SimplePolicyAction } from './SimplePolicyAction';
|
|
6
|
-
|
|
7
|
-
export const AMAZON_SERVERGROUP_DETAILS_SCALINGPOLICY_UPSERT_SIMPLE_SIMPLEPOLICYACTION_COMPONENT =
|
|
8
|
-
'spinnaker.amazon.serverGroup.details.scalingPolicy.upsert.actions.simplePolicy';
|
|
9
|
-
export const name = AMAZON_SERVERGROUP_DETAILS_SCALINGPOLICY_UPSERT_SIMPLE_SIMPLEPOLICYACTION_COMPONENT; // for backwards compatibility
|
|
10
|
-
|
|
11
|
-
module(AMAZON_SERVERGROUP_DETAILS_SCALINGPOLICY_UPSERT_SIMPLE_SIMPLEPOLICYACTION_COMPONENT, []).component(
|
|
12
|
-
'awsSimplePolicyAction',
|
|
13
|
-
react2angular(withErrorBoundary(SimplePolicyAction, 'awsSimplePolicyAction'), [
|
|
14
|
-
'adjustmentType',
|
|
15
|
-
'adjustmentTypeChanged',
|
|
16
|
-
'operator',
|
|
17
|
-
'scalingAdjustment',
|
|
18
|
-
'updateScalingAdjustment',
|
|
19
|
-
]),
|
|
20
|
-
);
|
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
import { module } from 'angular';
|
|
4
|
-
import { linen } from 'color-name';
|
|
5
|
-
import { cloneDeep } from 'lodash';
|
|
6
|
-
|
|
7
|
-
import { TaskMonitor } from '@spinnaker/core';
|
|
8
|
-
|
|
9
|
-
import { AMAZON_SERVERGROUP_DETAILS_SCALINGPOLICY_ADDITIONAL_SETTINGS_COMPONENT } from './ScalingPolicyAdditionalSettings';
|
|
10
|
-
import { ScalingPolicyWriter } from '../ScalingPolicyWriter';
|
|
11
|
-
import { AMAZON_SERVERGROUP_DETAILS_SCALINGPOLICY_UPSERT_ALARM_ALARMCONFIGURER_COMPONENT } from './alarm/alarmConfigurer.component';
|
|
12
|
-
import { AMAZON_SERVERGROUP_DETAILS_SCALINGPOLICY_ALARM_CONFIGURER_COMPONENT } from './alarm/awsAlarmConfigurer.component';
|
|
13
|
-
import { AMAZON_SERVERGROUP_DETAILS_SCALINGPOLICY_UPSERT_SIMPLE_SIMPLEPOLICYACTION_COMPONENT } from './simple/simplePolicyAction.component';
|
|
14
|
-
import { STEP_POLICY_ACTION_COMPONENT } from './step/stepPolicyAction.component';
|
|
15
|
-
|
|
16
|
-
import './upsertScalingPolicy.modal.less';
|
|
17
|
-
|
|
18
|
-
export const AMAZON_SERVERGROUP_DETAILS_SCALINGPOLICY_UPSERT_UPSERTSCALINGPOLICY_CONTROLLER =
|
|
19
|
-
'spinnaker.amazon.serverGroup.details.scalingPolicy.upsertScalingPolicy.controller';
|
|
20
|
-
export const name = AMAZON_SERVERGROUP_DETAILS_SCALINGPOLICY_UPSERT_UPSERTSCALINGPOLICY_CONTROLLER; // for backwards compatibility
|
|
21
|
-
module(AMAZON_SERVERGROUP_DETAILS_SCALINGPOLICY_UPSERT_UPSERTSCALINGPOLICY_CONTROLLER, [
|
|
22
|
-
AMAZON_SERVERGROUP_DETAILS_SCALINGPOLICY_UPSERT_SIMPLE_SIMPLEPOLICYACTION_COMPONENT,
|
|
23
|
-
STEP_POLICY_ACTION_COMPONENT,
|
|
24
|
-
AMAZON_SERVERGROUP_DETAILS_SCALINGPOLICY_UPSERT_ALARM_ALARMCONFIGURER_COMPONENT,
|
|
25
|
-
AMAZON_SERVERGROUP_DETAILS_SCALINGPOLICY_ALARM_CONFIGURER_COMPONENT,
|
|
26
|
-
AMAZON_SERVERGROUP_DETAILS_SCALINGPOLICY_ADDITIONAL_SETTINGS_COMPONENT,
|
|
27
|
-
]).controller('awsUpsertScalingPolicyCtrl', [
|
|
28
|
-
'$uibModalInstance',
|
|
29
|
-
'serverGroup',
|
|
30
|
-
'application',
|
|
31
|
-
'policy',
|
|
32
|
-
'$scope',
|
|
33
|
-
function ($uibModalInstance, serverGroup, application, policy, $scope) {
|
|
34
|
-
this.serverGroup = serverGroup;
|
|
35
|
-
|
|
36
|
-
this.viewState = {
|
|
37
|
-
isNew: !policy.policyARN,
|
|
38
|
-
multipleAlarms: policy.alarms.length > 1,
|
|
39
|
-
metricsLoaded: false,
|
|
40
|
-
namespacesLoaded: false,
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
function createCommand() {
|
|
44
|
-
return {
|
|
45
|
-
name: policy.policyName,
|
|
46
|
-
serverGroupName: serverGroup.name,
|
|
47
|
-
credentials: serverGroup.account,
|
|
48
|
-
region: serverGroup.region,
|
|
49
|
-
provider: serverGroup.type,
|
|
50
|
-
adjustmentType: policy.adjustmentType,
|
|
51
|
-
minAdjustmentMagnitude: policy.minAdjustmentMagnitude || 1,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function initializeAlarm(command, policy) {
|
|
56
|
-
const alarm = policy.alarms[0];
|
|
57
|
-
command.alarm = {
|
|
58
|
-
name: alarm.alarmName,
|
|
59
|
-
region: serverGroup.region,
|
|
60
|
-
actionsEnabled: true,
|
|
61
|
-
alarmDescription: alarm.alarmDescription,
|
|
62
|
-
comparisonOperator: alarm.comparisonOperator,
|
|
63
|
-
dimensions: alarm.dimensions,
|
|
64
|
-
evaluationPeriods: alarm.evaluationPeriods,
|
|
65
|
-
period: alarm.period,
|
|
66
|
-
threshold: alarm.threshold,
|
|
67
|
-
namespace: alarm.namespace,
|
|
68
|
-
metricName: alarm.metricName,
|
|
69
|
-
statistic: alarm.statistic,
|
|
70
|
-
unit: alarm.unit,
|
|
71
|
-
alarmActionArns: alarm.alarmActions,
|
|
72
|
-
insufficientDataActionArns: alarm.insufficientDataActions,
|
|
73
|
-
okActionArns: alarm.okActions,
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
this.initialize = () => {
|
|
78
|
-
const command = createCommand();
|
|
79
|
-
|
|
80
|
-
initializeAlarm(command, policy);
|
|
81
|
-
|
|
82
|
-
if (command.adjustmentType === 'ExactCapacity') {
|
|
83
|
-
this.viewState.operator = 'Set to';
|
|
84
|
-
this.viewState.adjustmentType = 'instances';
|
|
85
|
-
} else {
|
|
86
|
-
let adjustmentBasis = policy.scalingAdjustment;
|
|
87
|
-
if (policy.stepAdjustments && policy.stepAdjustments.length) {
|
|
88
|
-
adjustmentBasis = policy.stepAdjustments[0].scalingAdjustment;
|
|
89
|
-
}
|
|
90
|
-
this.viewState.operator = adjustmentBasis > 0 ? 'Add' : 'Remove';
|
|
91
|
-
this.viewState.adjustmentType = policy.adjustmentType === 'ChangeInCapacity' ? 'instances' : 'percent of group';
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (policy.stepAdjustments && policy.stepAdjustments.length) {
|
|
95
|
-
initializeStepPolicy(command, policy);
|
|
96
|
-
} else {
|
|
97
|
-
initializeSimplePolicy(command, policy);
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
this.command = command;
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
function initializeStepPolicy(command, policy) {
|
|
104
|
-
const threshold = command.alarm.threshold;
|
|
105
|
-
command.step = {
|
|
106
|
-
estimatedInstanceWarmup: policy.estimatedInstanceWarmup || command.cooldown || 600,
|
|
107
|
-
metricAggregationType: 'Average',
|
|
108
|
-
};
|
|
109
|
-
command.step.stepAdjustments = policy.stepAdjustments.map((adjustment) => {
|
|
110
|
-
const step = {
|
|
111
|
-
scalingAdjustment: Math.abs(adjustment.scalingAdjustment),
|
|
112
|
-
};
|
|
113
|
-
if (adjustment.metricIntervalUpperBound !== undefined) {
|
|
114
|
-
step.metricIntervalUpperBound = adjustment.metricIntervalUpperBound + threshold;
|
|
115
|
-
}
|
|
116
|
-
if (adjustment.metricIntervalLowerBound !== undefined) {
|
|
117
|
-
step.metricIntervalLowerBound = adjustment.metricIntervalLowerBound + threshold;
|
|
118
|
-
}
|
|
119
|
-
return step;
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function initializeSimplePolicy(command, policy) {
|
|
124
|
-
command.simple = {
|
|
125
|
-
cooldown: policy.cooldown || 600,
|
|
126
|
-
scalingAdjustment: Math.abs(policy.scalingAdjustment) || 1,
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
this.commandChanged = (updatedCommand) => {
|
|
131
|
-
this.$scope.$applyAsync(() => {
|
|
132
|
-
this.command = updatedCommand;
|
|
133
|
-
});
|
|
134
|
-
};
|
|
135
|
-
|
|
136
|
-
this.scalingAdjustmentChanged = (adjustment) => {
|
|
137
|
-
this.command.simple.scalingAdjustment = adjustment;
|
|
138
|
-
};
|
|
139
|
-
|
|
140
|
-
this.stepsChanged = (newSteps) => {
|
|
141
|
-
this.command.step.stepAdjustments = newSteps;
|
|
142
|
-
this.boundsChanged();
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
this.alarmChanged = (newAlarm) => {
|
|
146
|
-
this.command.alarm = newAlarm;
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
this.adjustmentTypeChanged = (action, type) => {
|
|
150
|
-
this.viewState.operator = action;
|
|
151
|
-
this.viewState.adjustmentType = type;
|
|
152
|
-
const newType =
|
|
153
|
-
type !== 'instances' ? 'PercentChangeInCapacity' : action === 'Set to' ? 'ExactCapacity' : 'ChangeInCapacity';
|
|
154
|
-
this.command.adjustmentType = newType;
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
this.boundsChanged = () => {
|
|
158
|
-
const source = this.viewState.comparatorBound === 'min' ? 'metricIntervalLowerBound' : 'metricIntervalUpperBound';
|
|
159
|
-
const target = source === 'metricIntervalLowerBound' ? 'metricIntervalUpperBound' : 'metricIntervalLowerBound';
|
|
160
|
-
|
|
161
|
-
if (this.command.step) {
|
|
162
|
-
const steps = this.command.step.stepAdjustments;
|
|
163
|
-
steps.forEach((step, index) => {
|
|
164
|
-
if (steps.length > index + 1) {
|
|
165
|
-
steps[index + 1][target] = step[source];
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
// remove the source boundary from the last step
|
|
169
|
-
delete steps[steps.length - 1][source];
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
|
|
173
|
-
this.switchMode = () => {
|
|
174
|
-
const command = this.command;
|
|
175
|
-
const cooldownOrWarmup = command.step ? command.step.estimatedInstanceWarmup : command.simple.cooldown;
|
|
176
|
-
if (command.step) {
|
|
177
|
-
const policy = { cooldown: cooldownOrWarmup };
|
|
178
|
-
delete command.step;
|
|
179
|
-
initializeSimplePolicy(command, policy);
|
|
180
|
-
} else {
|
|
181
|
-
const stepAdjustments = [
|
|
182
|
-
{
|
|
183
|
-
scalingAdjustment: command.simple.scalingAdjustment,
|
|
184
|
-
},
|
|
185
|
-
];
|
|
186
|
-
if (this.viewState.comparatorBound === 'min') {
|
|
187
|
-
stepAdjustments[0].metricIntervalUpperBound = 0;
|
|
188
|
-
} else {
|
|
189
|
-
stepAdjustments[0].metricIntervalLowerBound = 0;
|
|
190
|
-
}
|
|
191
|
-
delete command.simple;
|
|
192
|
-
initializeStepPolicy(command, {
|
|
193
|
-
estimatedInstanceWarmup: cooldownOrWarmup,
|
|
194
|
-
stepAdjustments: stepAdjustments,
|
|
195
|
-
});
|
|
196
|
-
this.boundsChanged();
|
|
197
|
-
}
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
this.action = this.viewState.isNew ? 'Create' : 'Edit';
|
|
201
|
-
|
|
202
|
-
const prepareCommandForSubmit = () => {
|
|
203
|
-
const command = cloneDeep(this.command);
|
|
204
|
-
|
|
205
|
-
if (command.adjustmentType !== 'PercentChangeInCapacity') {
|
|
206
|
-
delete command.minAdjustmentMagnitude;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
if (command.step) {
|
|
210
|
-
// adjust metricIntervalLowerBound/UpperBound for each step based on alarm threshold
|
|
211
|
-
command.step.stepAdjustments.forEach((step) => {
|
|
212
|
-
if (this.viewState.operator === 'Remove') {
|
|
213
|
-
step.scalingAdjustment = 0 - step.scalingAdjustment;
|
|
214
|
-
delete command.step.estimatedInstanceWarmup;
|
|
215
|
-
}
|
|
216
|
-
if (step.metricIntervalLowerBound !== undefined) {
|
|
217
|
-
step.metricIntervalLowerBound -= command.alarm.threshold;
|
|
218
|
-
}
|
|
219
|
-
if (step.metricIntervalUpperBound !== undefined) {
|
|
220
|
-
step.metricIntervalUpperBound -= command.alarm.threshold;
|
|
221
|
-
}
|
|
222
|
-
});
|
|
223
|
-
} else {
|
|
224
|
-
if (this.viewState.operator === 'Remove') {
|
|
225
|
-
command.simple.scalingAdjustment = 0 - command.simple.scalingAdjustment;
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
return command;
|
|
229
|
-
};
|
|
230
|
-
|
|
231
|
-
this.taskMonitor = new TaskMonitor({
|
|
232
|
-
application: application,
|
|
233
|
-
title: this.action + ' scaling policy for ' + serverGroup.name,
|
|
234
|
-
modalInstance: $uibModalInstance,
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
this.save = () => {
|
|
238
|
-
const command = prepareCommandForSubmit();
|
|
239
|
-
const submitMethod = () => ScalingPolicyWriter.upsertScalingPolicy(application, command);
|
|
240
|
-
|
|
241
|
-
this.taskMonitor.submit(submitMethod);
|
|
242
|
-
};
|
|
243
|
-
|
|
244
|
-
this.cancel = $uibModalInstance.dismiss;
|
|
245
|
-
|
|
246
|
-
this.initialize();
|
|
247
|
-
},
|
|
248
|
-
]);
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
<div modal-page class="scaling-policy-modal form-inline">
|
|
2
|
-
<task-monitor monitor="ctrl.taskMonitor"></task-monitor>
|
|
3
|
-
<modal-close dismiss="$dismiss()"></modal-close>
|
|
4
|
-
<div class="modal-header">
|
|
5
|
-
<h4 class="modal-title">{{ctrl.action}} scaling policy</h4>
|
|
6
|
-
</div>
|
|
7
|
-
<div class="modal-body">
|
|
8
|
-
<form name="form" novalidate>
|
|
9
|
-
<h4 class="section-heading">Conditions</h4>
|
|
10
|
-
<div class="section-body">
|
|
11
|
-
<alarm-configurer
|
|
12
|
-
alarm="ctrl.command.alarm"
|
|
13
|
-
multiple-alarms="ctrl.viewState.multipleAlarms"
|
|
14
|
-
server-group="ctrl.serverGroup"
|
|
15
|
-
step-adjustments="ctrl.command.step.stepAdjustments"
|
|
16
|
-
steps-changed="ctrl.stepsChanged"
|
|
17
|
-
update-alarm="ctrl.alarmChanged"
|
|
18
|
-
></alarm-configurer>
|
|
19
|
-
</div>
|
|
20
|
-
<h4 class="section-heading">Actions</h4>
|
|
21
|
-
<div class="section-body" ng-if="!ctrl.command.alarm.metricName">
|
|
22
|
-
<h4 class="text-center">Select a metric</h4>
|
|
23
|
-
</div>
|
|
24
|
-
<div class="section-body" ng-if="ctrl.command.alarm.metricName">
|
|
25
|
-
<div ng-if="ctrl.command.simple">
|
|
26
|
-
<div class="row">
|
|
27
|
-
<div class="col-md-10 col-md-offset-1">
|
|
28
|
-
<p>
|
|
29
|
-
This is a simple scaling policy. To declare different actions based on the magnitude of the alarm,
|
|
30
|
-
<strong>switch to a <a href ng-click="ctrl.switchMode()">step policy</a>.</strong>
|
|
31
|
-
</p>
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
<aws-simple-policy-action
|
|
35
|
-
adjustment-type="ctrl.viewState.adjustmentType"
|
|
36
|
-
adjustment-type-changed="ctrl.adjustmentTypeChanged"
|
|
37
|
-
operator="ctrl.viewState.operator"
|
|
38
|
-
scaling-adjustment="ctrl.command.simple.scalingAdjustment"
|
|
39
|
-
update-scaling-adjustment="ctrl.scalingAdjustmentChanged"
|
|
40
|
-
></aws-simple-policy-action>
|
|
41
|
-
</div>
|
|
42
|
-
<div ng-if="ctrl.command.step">
|
|
43
|
-
<step-policy-action
|
|
44
|
-
adjustment-type="ctrl.viewState.adjustmentType"
|
|
45
|
-
adjustment-type-changed="ctrl.adjustmentTypeChanged"
|
|
46
|
-
alarm="ctrl.command.alarm"
|
|
47
|
-
is-min="ctrl.viewState.comparatorBound === 'min'"
|
|
48
|
-
operator="ctrl.viewState.operator"
|
|
49
|
-
step="ctrl.command.step"
|
|
50
|
-
steps-changed="ctrl.stepsChanged"
|
|
51
|
-
>
|
|
52
|
-
</step-policy-action>
|
|
53
|
-
</div>
|
|
54
|
-
</div>
|
|
55
|
-
<scaling-policy-additional-settings
|
|
56
|
-
command="ctrl.command"
|
|
57
|
-
is-instance-type="ctrl.viewState.adjustmentType === 'instances'"
|
|
58
|
-
is-new="ctrl.viewState.isNew"
|
|
59
|
-
operator="ctrl.viewState.operator"
|
|
60
|
-
update-command="ctrl.commandChanged"
|
|
61
|
-
></scaling-policy-additional-settings>
|
|
62
|
-
</form>
|
|
63
|
-
</div>
|
|
64
|
-
|
|
65
|
-
<div class="modal-footer">
|
|
66
|
-
<button class="btn btn-default" ng-click="ctrl.cancel()">Cancel</button>
|
|
67
|
-
<submit-button
|
|
68
|
-
is-disabled="!form.$valid"
|
|
69
|
-
submitting="taskMonitor.submitting"
|
|
70
|
-
on-click="ctrl.save()"
|
|
71
|
-
is-new="ctrl.viewState.isNew"
|
|
72
|
-
></submit-button>
|
|
73
|
-
</div>
|
|
74
|
-
</div>
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
.scaling-policy-modal {
|
|
2
|
-
input,
|
|
3
|
-
select {
|
|
4
|
-
margin: 0 5px;
|
|
5
|
-
}
|
|
6
|
-
span.input-label,
|
|
7
|
-
.select-placeholder {
|
|
8
|
-
display: inline-block;
|
|
9
|
-
font-size: 12px;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
.section-additional-settings {
|
|
13
|
-
.row {
|
|
14
|
-
margin-bottom: 10px;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.number-input-sm {
|
|
18
|
-
width: 60px;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
aws-alarm-configurer > .row {
|
|
23
|
-
margin-bottom: 10px;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
.sm-label-right {
|
|
27
|
-
padding-right: 5px;
|
|
28
|
-
}
|
|
29
|
-
.content-fields {
|
|
30
|
-
padding-left: 0;
|
|
31
|
-
}
|
|
32
|
-
}
|