@spinnaker/amazon 0.11.0 → 0.12.2
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 +43 -0
- package/dist/aws.settings.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/instance/awsInstanceType.service.d.ts +10 -2
- package/dist/instance/awsInstanceTypes.d.ts +10 -0
- package/dist/instance/details/CostFactor.d.ts +6 -0
- package/dist/search/searchResultFormatter.d.ts +2 -2
- package/dist/serverGroup/configure/serverGroupConfiguration.service.d.ts +14 -1
- package/dist/serverGroup/configure/wizard/instanceType/CpuCreditsToggle.d.ts +3 -4
- package/dist/serverGroup/configure/wizard/instanceType/InstanceTypeSelector.d.ts +9 -0
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/AdvancedModeSelector.d.ts +13 -0
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceProfileSelector.d.ts +9 -0
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeRow.d.ts +11 -0
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTable.d.ts +14 -0
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTableBody.d.ts +12 -0
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTableParts.d.ts +15 -0
- package/dist/serverGroup/configure/wizard/instanceType/advancedMode/InstancesDistribution.d.ts +8 -0
- package/dist/serverGroup/configure/wizard/instanceType/simpleMode/SimpleModeSelector.d.ts +8 -0
- package/dist/serverGroup/configure/wizard/pages/ServerGroupInstanceType.d.ts +9 -6
- package/dist/serverGroup/details/scalingPolicy/ScalingPolicySummary.d.ts +0 -1
- package/dist/serverGroup/details/scalingPolicy/chart/MetricAlarmChart.d.ts +0 -4
- package/dist/serverGroup/details/scalingPolicy/index.d.ts +0 -1
- package/dist/serverGroup/details/scalingPolicy/targetTracking/TargetTrackingChart.d.ts +1 -3
- package/package.json +5 -5
- package/src/aws.module.ts +3 -3
- package/src/aws.settings.ts +2 -0
- package/src/function/details/FunctionActions.spec.tsx +15 -12
- package/src/function/details/FunctionActions.tsx +2 -1
- package/src/help/amazon.help.ts +9 -6
- package/src/image/image.reader.spec.ts +75 -0
- package/src/instance/awsInstanceType.service.spec.js +37 -71
- package/src/instance/awsInstanceType.service.ts +191 -0
- package/src/instance/awsInstanceTypes.ts +311 -0
- package/src/instance/details/CostFactor.tsx +29 -0
- package/src/instance/details/InstanceInformation.spec.tsx +2 -1
- package/src/instance/details/instance.details.controller.js +472 -473
- package/src/loadBalancer/details/LoadBalancerActions.tsx +2 -1
- package/src/loadBalancer/details/loadBalancerDetails.controller.spec.ts +5 -3
- package/src/search/{searchResultFormatter.js → searchResultFormatter.ts} +5 -4
- package/src/securityGroup/details/securityGroupDetail.controller.js +2 -1
- package/src/serverGroup/configure/AmazonImageSelectInput.spec.tsx +10 -7
- package/src/serverGroup/configure/serverGroupCommandBuilder.aws.service.spec.js +302 -1
- package/src/serverGroup/configure/serverGroupCommandBuilder.service.js +96 -24
- package/src/serverGroup/configure/serverGroupCommandBuilder.spec.js +25 -8
- package/src/serverGroup/configure/serverGroupConfiguration.service.spec.ts +6 -13
- package/src/serverGroup/configure/serverGroupConfiguration.service.ts +26 -1
- package/src/serverGroup/configure/wizard/AmazonCloneServerGroupModal.tsx +1 -1
- package/src/serverGroup/configure/wizard/instanceType/CpuCreditsToggle.tsx +31 -31
- package/src/serverGroup/configure/wizard/instanceType/InstanceTypeSelector.tsx +133 -0
- package/src/serverGroup/configure/wizard/instanceType/advancedMode/AdvancedModeSelector.tsx +99 -0
- package/src/serverGroup/configure/wizard/instanceType/advancedMode/InstanceProfileSelector.tsx +36 -0
- package/src/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeRow.tsx +144 -0
- package/src/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTable.tsx +137 -0
- package/src/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTableBody.tsx +135 -0
- package/src/serverGroup/configure/wizard/instanceType/advancedMode/InstanceTypeTableParts.tsx +137 -0
- package/src/serverGroup/configure/wizard/instanceType/advancedMode/InstancesDistribution.less +5 -0
- package/src/serverGroup/configure/wizard/instanceType/advancedMode/InstancesDistribution.tsx +108 -0
- package/src/serverGroup/configure/wizard/instanceType/advancedMode/advancedMode.less +110 -0
- package/src/serverGroup/configure/wizard/instanceType/simpleMode/SimpleModeSelector.tsx +62 -0
- package/src/serverGroup/configure/wizard/pages/ServerGroupInstanceType.tsx +106 -62
- package/src/serverGroup/configure/wizard/pages/advancedSettings/ServerGroupAdvancedSettingsCommon.tsx +1 -1
- package/src/serverGroup/details/AmazonServerGroupActions.tsx +2 -1
- package/src/serverGroup/details/scalingPolicy/ScalingPolicySummary.tsx +7 -3
- package/src/serverGroup/details/scalingPolicy/StepPolicySummary.tsx +26 -28
- package/src/serverGroup/details/scalingPolicy/chart/MetricAlarmChart.tsx +1 -25
- package/src/serverGroup/details/scalingPolicy/index.ts +0 -1
- package/src/serverGroup/details/scalingPolicy/scalingPolicy.module.ts +1 -9
- package/src/serverGroup/details/scalingPolicy/scalingPolicySummary.component.ts +6 -2
- package/src/serverGroup/details/scalingPolicy/targetTracking/TargetTrackingChart.tsx +2 -17
- package/src/serverGroup/details/scalingPolicy/upsert/alarm/AlarmConfigurer.less +1 -1
- package/src/serverGroup/details/scalingProcesses/AutoScalingProcessService.spec.ts +1 -2
- package/src/serverGroup/details/sections/AdvancedSettingsDetailsSection.tsx +3 -2
- package/src/serverGroup/details/sections/AmazonCapacityDetailsSection.tsx +3 -8
- package/src/serverGroup/details/sections/InstancesDistributionDetailsSection.spec.tsx +8 -5
- package/src/serverGroup/details/sections/LaunchTemplateDetailsSection.spec.tsx +8 -5
- package/src/serverGroup/details/sections/ScalingPoliciesDetailsSection.tsx +3 -3
- package/src/serverGroup/details/sections/ScalingProcessesDetailsSection.tsx +3 -10
- package/src/serverGroup/details/sections/ScheduledActionsDetailsSection.tsx +3 -2
- package/src/serverGroup/details/sections/SecurityGroupsDetailsSection.tsx +3 -2
- package/src/serverGroup/serverGroup.transformer.spec.ts +5 -3
- package/src/subnet/SubnetSelectInput.spec.tsx +7 -4
- package/src/vpc/{VpcReader.spec.js → VpcReader.spec.ts} +2 -10
- package/src/vpc/VpcTag.spec.tsx +37 -0
- package/src/vpc/vpc.module.ts +6 -2
- package/dist/reactShims/aws.ngReact.d.ts +0 -11
- package/dist/serverGroup/details/scalingPolicy/ScalingPolicyTypeRegistry.d.ts +0 -10
- package/dist/serverGroup/details/scalingPolicy/alarmBasedSummary.component.d.ts +0 -2
- package/dist/serverGroup/details/scalingPolicy/detailsSummary.component.d.ts +0 -12
- package/dist/serverGroup/details/scalingPolicy/popover/scalingPolicyPopover.component.d.ts +0 -1
- package/dist/serverGroup/details/scalingPolicy/stepPolicySummary.component.d.ts +0 -1
- package/dist/serverGroup/details/scalingPolicy/targetTracking/TargetTrackingPolicy.config.d.ts +0 -1
- package/dist/serverGroup/details/scalingPolicy/targetTracking/targetTracking.module.d.ts +0 -2
- package/dist/serverGroup/details/scalingPolicy/targetTracking/targetTrackingChart.component.d.ts +0 -1
- package/dist/serverGroup/details/scalingPolicy/targetTracking/targetTrackingSummary.component.d.ts +0 -1
- package/dist/vpc/vpcTag.directive.d.ts +0 -2
- package/src/image/image.reader.spec.js +0 -123
- package/src/instance/awsInstanceType.service.js +0 -437
- package/src/reactShims/aws.ngReact.ts +0 -27
- package/src/serverGroup/details/scalingPolicy/ScalingPolicyTypeRegistry.ts +0 -18
- package/src/serverGroup/details/scalingPolicy/alarmBasedSummary.component.html +0 -35
- package/src/serverGroup/details/scalingPolicy/alarmBasedSummary.component.js +0 -60
- package/src/serverGroup/details/scalingPolicy/alarmBasedSummary.template.html +0 -5
- package/src/serverGroup/details/scalingPolicy/detailsSummary.component.ts +0 -32
- package/src/serverGroup/details/scalingPolicy/popover/scalingPolicyDetails.popover.html +0 -1
- package/src/serverGroup/details/scalingPolicy/popover/scalingPolicyPopover.component.html +0 -107
- package/src/serverGroup/details/scalingPolicy/popover/scalingPolicyPopover.component.ts +0 -31
- package/src/serverGroup/details/scalingPolicy/scalingPolicySummary.component.less +0 -15
- package/src/serverGroup/details/scalingPolicy/stepPolicySummary.component.ts +0 -10
- package/src/serverGroup/details/scalingPolicy/targetTracking/TargetTrackingPolicy.config.ts +0 -6
- package/src/serverGroup/details/scalingPolicy/targetTracking/targetTracking.module.ts +0 -8
- package/src/serverGroup/details/scalingPolicy/targetTracking/targetTrackingChart.component.ts +0 -16
- package/src/serverGroup/details/scalingPolicy/targetTracking/targetTrackingSummary.component.ts +0 -14
- package/src/serverGroup/details/scalingPolicy/targetTracking/targetTrackingSummary.html +0 -5
- package/src/vpc/vpcTag.directive.js +0 -34
- package/src/vpc/vpcTag.directive.spec.js +0 -60
|
@@ -1,437 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
import { module } from 'angular';
|
|
4
|
-
import _ from 'lodash';
|
|
5
|
-
|
|
6
|
-
import { REST } from '@spinnaker/core';
|
|
7
|
-
import { AWSProviderSettings } from '../aws.settings';
|
|
8
|
-
|
|
9
|
-
export const AMAZON_INSTANCE_AWSINSTANCETYPE_SERVICE = 'spinnaker.amazon.instanceType.service';
|
|
10
|
-
export const name = AMAZON_INSTANCE_AWSINSTANCETYPE_SERVICE; // for backwards compatibility
|
|
11
|
-
module(AMAZON_INSTANCE_AWSINSTANCETYPE_SERVICE, []).factory('awsInstanceTypeService', [
|
|
12
|
-
'$q',
|
|
13
|
-
function ($q) {
|
|
14
|
-
const m5 = {
|
|
15
|
-
type: 'm5',
|
|
16
|
-
description:
|
|
17
|
-
'm5 instances provide a balance of compute, memory, and network resources. They are a good choice for most applications.',
|
|
18
|
-
instanceTypes: [
|
|
19
|
-
{
|
|
20
|
-
name: 'm5.large',
|
|
21
|
-
label: 'Large',
|
|
22
|
-
cpu: 2,
|
|
23
|
-
memory: 8,
|
|
24
|
-
storage: { type: 'EBS' },
|
|
25
|
-
costFactor: 2,
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
name: 'm5.xlarge',
|
|
29
|
-
label: 'XLarge',
|
|
30
|
-
cpu: 4,
|
|
31
|
-
memory: 16,
|
|
32
|
-
storage: { type: 'EBS' },
|
|
33
|
-
costFactor: 3,
|
|
34
|
-
},
|
|
35
|
-
{
|
|
36
|
-
name: 'm5.2xlarge',
|
|
37
|
-
label: '2XLarge',
|
|
38
|
-
cpu: 8,
|
|
39
|
-
memory: 32,
|
|
40
|
-
storage: { type: 'EBS' },
|
|
41
|
-
costFactor: 4,
|
|
42
|
-
},
|
|
43
|
-
],
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const t2gp = {
|
|
47
|
-
type: 't2',
|
|
48
|
-
description:
|
|
49
|
-
't2 instances are a good choice for workloads that don’t use the full CPU often or consistently, but occasionally need to burst (e.g. web servers, developer environments and small databases).',
|
|
50
|
-
instanceTypes: [
|
|
51
|
-
{
|
|
52
|
-
name: 't2.small',
|
|
53
|
-
label: 'Small',
|
|
54
|
-
cpu: 1,
|
|
55
|
-
memory: 2,
|
|
56
|
-
storage: { type: 'EBS' },
|
|
57
|
-
costFactor: 1,
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
name: 't2.medium',
|
|
61
|
-
label: 'Medium',
|
|
62
|
-
cpu: 2,
|
|
63
|
-
memory: 4,
|
|
64
|
-
storage: { type: 'EBS' },
|
|
65
|
-
costFactor: 1,
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
name: 't2.large',
|
|
69
|
-
label: 'Large',
|
|
70
|
-
cpu: 2,
|
|
71
|
-
memory: 8,
|
|
72
|
-
storage: { type: 'EBS' },
|
|
73
|
-
costFactor: 2,
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
name: 't2.xlarge',
|
|
77
|
-
label: 'XLarge',
|
|
78
|
-
cpu: 4,
|
|
79
|
-
memory: 16,
|
|
80
|
-
storage: { type: 'EBS' },
|
|
81
|
-
costFactor: 3,
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
name: 't2.2xlarge',
|
|
85
|
-
label: '2XLarge',
|
|
86
|
-
cpu: 8,
|
|
87
|
-
memory: 32,
|
|
88
|
-
storage: { type: 'EBS' },
|
|
89
|
-
costFactor: 4,
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
const t3gp = {
|
|
95
|
-
type: 't3',
|
|
96
|
-
description:
|
|
97
|
-
't3 instances are a good choice for workloads that don’t use the full CPU often or consistently, but occasionally need to burst (e.g. web servers, developer environments and small databases).',
|
|
98
|
-
instanceTypes: [
|
|
99
|
-
{
|
|
100
|
-
name: 't3.small',
|
|
101
|
-
label: 'Small',
|
|
102
|
-
cpu: 2,
|
|
103
|
-
memory: 2,
|
|
104
|
-
storage: { type: 'EBS' },
|
|
105
|
-
costFactor: 1,
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
name: 't3.medium',
|
|
109
|
-
label: 'Medium',
|
|
110
|
-
cpu: 2,
|
|
111
|
-
memory: 4,
|
|
112
|
-
storage: { type: 'EBS' },
|
|
113
|
-
costFactor: 1,
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
name: 't3.large',
|
|
117
|
-
label: 'Large',
|
|
118
|
-
cpu: 2,
|
|
119
|
-
memory: 8,
|
|
120
|
-
storage: { type: 'EBS' },
|
|
121
|
-
costFactor: 2,
|
|
122
|
-
},
|
|
123
|
-
{
|
|
124
|
-
name: 't3.xlarge',
|
|
125
|
-
label: 'XLarge',
|
|
126
|
-
cpu: 4,
|
|
127
|
-
memory: 16,
|
|
128
|
-
storage: { type: 'EBS' },
|
|
129
|
-
costFactor: 3,
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
name: 't3.2xlarge',
|
|
133
|
-
label: '2XLarge',
|
|
134
|
-
cpu: 8,
|
|
135
|
-
memory: 32,
|
|
136
|
-
storage: { type: 'EBS' },
|
|
137
|
-
costFactor: 4,
|
|
138
|
-
},
|
|
139
|
-
],
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
const t2 = {
|
|
143
|
-
type: 't2',
|
|
144
|
-
description:
|
|
145
|
-
't2 instances are a good choice for workloads that don’t use the full CPU often or consistently, but occasionally need to burst (e.g. web servers, developer environments and small databases).',
|
|
146
|
-
instanceTypes: [
|
|
147
|
-
{
|
|
148
|
-
name: 't2.nano',
|
|
149
|
-
label: 'Nano',
|
|
150
|
-
cpu: 1,
|
|
151
|
-
memory: 0.5,
|
|
152
|
-
storage: { type: 'EBS' },
|
|
153
|
-
costFactor: 1,
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
name: 't2.micro',
|
|
157
|
-
label: 'Micro',
|
|
158
|
-
cpu: 1,
|
|
159
|
-
memory: 1,
|
|
160
|
-
storage: { type: 'EBS' },
|
|
161
|
-
costFactor: 1,
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
name: 't2.small',
|
|
165
|
-
label: 'Small',
|
|
166
|
-
cpu: 1,
|
|
167
|
-
memory: 2,
|
|
168
|
-
storage: { type: 'EBS' },
|
|
169
|
-
costFactor: 1,
|
|
170
|
-
},
|
|
171
|
-
],
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
const t3 = {
|
|
175
|
-
type: 't3',
|
|
176
|
-
description:
|
|
177
|
-
't3 instances are a good choice for workloads that don’t use the full CPU often or consistently, but occasionally need to burst (e.g. web servers, developer environments and small databases).',
|
|
178
|
-
instanceTypes: [
|
|
179
|
-
{
|
|
180
|
-
name: 't3.nano',
|
|
181
|
-
label: 'Nano',
|
|
182
|
-
cpu: 2,
|
|
183
|
-
memory: 0.5,
|
|
184
|
-
storage: { type: 'EBS' },
|
|
185
|
-
costFactor: 1,
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
name: 't3.micro',
|
|
189
|
-
label: 'Micro',
|
|
190
|
-
cpu: 2,
|
|
191
|
-
memory: 1,
|
|
192
|
-
storage: { type: 'EBS' },
|
|
193
|
-
costFactor: 1,
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
name: 't3.small',
|
|
197
|
-
label: 'Small',
|
|
198
|
-
cpu: 2,
|
|
199
|
-
memory: 2,
|
|
200
|
-
storage: { type: 'EBS' },
|
|
201
|
-
costFactor: 1,
|
|
202
|
-
},
|
|
203
|
-
],
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
const r5 = {
|
|
207
|
-
type: 'r5',
|
|
208
|
-
description:
|
|
209
|
-
'r5 instances are optimized for memory-intensive applications and have the lowest cost per GiB of RAM among Amazon EC2 instance types.',
|
|
210
|
-
instanceTypes: [
|
|
211
|
-
{
|
|
212
|
-
name: 'r5.large',
|
|
213
|
-
label: 'Large',
|
|
214
|
-
cpu: 2,
|
|
215
|
-
memory: 16,
|
|
216
|
-
storage: { type: 'EBS' },
|
|
217
|
-
costFactor: 1,
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
name: 'r5.xlarge',
|
|
221
|
-
label: 'XLarge',
|
|
222
|
-
cpu: 4,
|
|
223
|
-
memory: 32,
|
|
224
|
-
storage: { type: 'EBS' },
|
|
225
|
-
costFactor: 2,
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
name: 'r5.2xlarge',
|
|
229
|
-
label: '2XLarge',
|
|
230
|
-
cpu: 8,
|
|
231
|
-
memory: 64,
|
|
232
|
-
storage: { type: 'EBS' },
|
|
233
|
-
costFactor: 2,
|
|
234
|
-
},
|
|
235
|
-
{
|
|
236
|
-
name: 'r5.4xlarge',
|
|
237
|
-
label: '4XLarge',
|
|
238
|
-
cpu: 16,
|
|
239
|
-
memory: 128,
|
|
240
|
-
storage: { type: 'EBS' },
|
|
241
|
-
costFactor: 3,
|
|
242
|
-
},
|
|
243
|
-
],
|
|
244
|
-
};
|
|
245
|
-
|
|
246
|
-
const defaultCategories = [
|
|
247
|
-
{
|
|
248
|
-
type: 'general',
|
|
249
|
-
label: 'General Purpose',
|
|
250
|
-
families: [m5, t2gp, t3gp],
|
|
251
|
-
icon: 'hdd',
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
type: 'memory',
|
|
255
|
-
label: 'High Memory',
|
|
256
|
-
families: [r5],
|
|
257
|
-
icon: 'hdd',
|
|
258
|
-
},
|
|
259
|
-
{
|
|
260
|
-
type: 'micro',
|
|
261
|
-
label: 'Micro Utility',
|
|
262
|
-
families: [t2, t3],
|
|
263
|
-
icon: 'hdd',
|
|
264
|
-
},
|
|
265
|
-
{
|
|
266
|
-
type: 'custom',
|
|
267
|
-
label: 'Custom Type',
|
|
268
|
-
families: [],
|
|
269
|
-
icon: 'asterisk',
|
|
270
|
-
},
|
|
271
|
-
];
|
|
272
|
-
|
|
273
|
-
const categories = defaultCategories
|
|
274
|
-
.filter(({ type }) => !_.get(AWSProviderSettings, 'instanceTypes.exclude.categories', []).includes(type))
|
|
275
|
-
.map((category) =>
|
|
276
|
-
Object.assign({}, category, {
|
|
277
|
-
families: category.families.filter(
|
|
278
|
-
({ type }) => !_.get(AWSProviderSettings, 'instanceTypes.exclude.families', []).includes(type),
|
|
279
|
-
),
|
|
280
|
-
}),
|
|
281
|
-
);
|
|
282
|
-
|
|
283
|
-
function getCategories() {
|
|
284
|
-
return $q.when(categories);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
const getAllTypesByRegion = function getAllTypesByRegion() {
|
|
288
|
-
return REST('/instanceTypes')
|
|
289
|
-
.get()
|
|
290
|
-
.then(function (types) {
|
|
291
|
-
return _.chain(types)
|
|
292
|
-
.map(function (type) {
|
|
293
|
-
return {
|
|
294
|
-
region: type.region,
|
|
295
|
-
account: type.account,
|
|
296
|
-
name: type.name,
|
|
297
|
-
key: [type.region, type.account, type.name].join(':'),
|
|
298
|
-
};
|
|
299
|
-
})
|
|
300
|
-
.uniqBy('key')
|
|
301
|
-
.groupBy('region')
|
|
302
|
-
.value();
|
|
303
|
-
});
|
|
304
|
-
};
|
|
305
|
-
|
|
306
|
-
const instanceClassOrder = ['xlarge', 'large', 'medium', 'small', 'micro', 'nano'];
|
|
307
|
-
|
|
308
|
-
function sortTypesByFamilyAndSize(o1, o2) {
|
|
309
|
-
const type1 = o1.split('.');
|
|
310
|
-
const type2 = o2.split('.');
|
|
311
|
-
|
|
312
|
-
const [family1, class1 = ''] = type1;
|
|
313
|
-
const [family2, class2 = ''] = type2;
|
|
314
|
-
|
|
315
|
-
if (family1 !== family2) {
|
|
316
|
-
if (family1 > family2) {
|
|
317
|
-
return 1;
|
|
318
|
-
} else if (family1 < family2) {
|
|
319
|
-
return -1;
|
|
320
|
-
}
|
|
321
|
-
return 0;
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
const t1Idx = instanceClassOrder.findIndex((el) => class1.endsWith(el));
|
|
325
|
-
const t2Idx = instanceClassOrder.findIndex((el) => class2.endsWith(el));
|
|
326
|
-
|
|
327
|
-
if (t1Idx === -1 || t2Idx === -1) {
|
|
328
|
-
return 0;
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
if (t1Idx === 0 && t2Idx === 0) {
|
|
332
|
-
const size1 = parseInt(class1.replace('xlarge', '')) || 0;
|
|
333
|
-
const size2 = parseInt(class2.replace('xlarge', '')) || 0;
|
|
334
|
-
|
|
335
|
-
if (size2 < size1) {
|
|
336
|
-
return 1;
|
|
337
|
-
} else if (size2 > size1) {
|
|
338
|
-
return -1;
|
|
339
|
-
}
|
|
340
|
-
return 0;
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
if (t1Idx > t2Idx) {
|
|
344
|
-
return -1;
|
|
345
|
-
} else if (t1Idx < t2Idx) {
|
|
346
|
-
return 1;
|
|
347
|
-
}
|
|
348
|
-
return 0;
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
function getAvailableTypesForRegions(availableRegions, selectedRegions) {
|
|
352
|
-
selectedRegions = selectedRegions || [];
|
|
353
|
-
let availableTypes = [];
|
|
354
|
-
|
|
355
|
-
// prime the list of available types
|
|
356
|
-
if (selectedRegions && selectedRegions.length) {
|
|
357
|
-
availableTypes = _.map(availableRegions[selectedRegions[0]], 'name');
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
// this will perform an unnecessary intersection with the first region, which is fine
|
|
361
|
-
selectedRegions.forEach(function (selectedRegion) {
|
|
362
|
-
if (availableRegions[selectedRegion]) {
|
|
363
|
-
availableTypes = _.intersection(availableTypes, _.map(availableRegions[selectedRegion], 'name'));
|
|
364
|
-
}
|
|
365
|
-
});
|
|
366
|
-
|
|
367
|
-
return availableTypes.sort(sortTypesByFamilyAndSize);
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
const families = {
|
|
371
|
-
paravirtual: ['c1', 'c3', 'hi1', 'hs1', 'm1', 'm2', 'm3', 't1'],
|
|
372
|
-
hvm: ['c3', 'c4', 'd2', 'i2', 'g2', 'm3', 'm4', 'm5', 'p2', 'r3', 'r4', 'r5', 't2', 'x1'],
|
|
373
|
-
vpcOnly: ['c4', 'm4', 'm5', 'r4', 'r5', 't2', 'x1'],
|
|
374
|
-
ebsOptimized: ['c4', 'd2', 'f1', 'g3', 'i3', 'm4', 'm5', 'p2', 'r4', 'r5', 'x1'],
|
|
375
|
-
burstablePerf: ['t2', 't3', 't3a', 't4g'],
|
|
376
|
-
};
|
|
377
|
-
|
|
378
|
-
function filterInstanceTypes(instanceTypes, virtualizationType, vpcOnly) {
|
|
379
|
-
return instanceTypes.filter((instanceType) => {
|
|
380
|
-
if (virtualizationType === '*') {
|
|
381
|
-
// show all instance types
|
|
382
|
-
return true;
|
|
383
|
-
}
|
|
384
|
-
const [family] = instanceType.split('.');
|
|
385
|
-
if (!vpcOnly && families.vpcOnly.includes(family)) {
|
|
386
|
-
return false;
|
|
387
|
-
}
|
|
388
|
-
if (!families.paravirtual.includes(family) && virtualizationType === 'hvm') {
|
|
389
|
-
return true;
|
|
390
|
-
}
|
|
391
|
-
return families[virtualizationType].includes(family);
|
|
392
|
-
});
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
function isEbsOptimized(instanceType) {
|
|
396
|
-
if (!instanceType) {
|
|
397
|
-
return false;
|
|
398
|
-
}
|
|
399
|
-
const [family] = instanceType.split('.');
|
|
400
|
-
return families.ebsOptimized.includes(family);
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
function isBurstingSupported(instanceType) {
|
|
404
|
-
if (!instanceType) {
|
|
405
|
-
return false;
|
|
406
|
-
}
|
|
407
|
-
const [family] = instanceType.split('.');
|
|
408
|
-
return families.burstablePerf.includes(family);
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
function isInstanceTypeInCategory(instanceType, category) {
|
|
412
|
-
if (!instanceType || !category) {
|
|
413
|
-
return false;
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
if (category === 'custom') {
|
|
417
|
-
return true;
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
const [family] = instanceType.split('.');
|
|
421
|
-
const instanceCategory = _.find(defaultCategories, { type: category });
|
|
422
|
-
const familyInCategory = instanceCategory && _.find(instanceCategory.families, { type: family });
|
|
423
|
-
|
|
424
|
-
return familyInCategory && familyInCategory.instanceTypes.map((t) => t.name).includes(instanceType);
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
return {
|
|
428
|
-
getCategories,
|
|
429
|
-
getAvailableTypesForRegions,
|
|
430
|
-
getAllTypesByRegion,
|
|
431
|
-
filterInstanceTypes,
|
|
432
|
-
isEbsOptimized,
|
|
433
|
-
isBurstingSupported,
|
|
434
|
-
isInstanceTypeInCategory,
|
|
435
|
-
};
|
|
436
|
-
},
|
|
437
|
-
]);
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { angular2react } from 'angular2react';
|
|
2
|
-
import type React from 'react';
|
|
3
|
-
|
|
4
|
-
import { ReactInject } from '@spinnaker/core';
|
|
5
|
-
import type { IScalingPolicySummaryProps } from '../serverGroup/details/scalingPolicy/ScalingPolicySummary';
|
|
6
|
-
import { scalingPolicyDetailsSummary } from '../serverGroup/details/scalingPolicy/detailsSummary.component';
|
|
7
|
-
|
|
8
|
-
import IInjectorService = angular.auto.IInjectorService;
|
|
9
|
-
|
|
10
|
-
// prettier-ignore
|
|
11
|
-
export class AwsNgReactInjector extends ReactInject {
|
|
12
|
-
public $injectorProxy = {} as IInjectorService;
|
|
13
|
-
|
|
14
|
-
// Reactified components
|
|
15
|
-
public ScalingPolicySummary: React.ComponentClass<IScalingPolicySummaryProps> = angular2react('scalingPolicySummary', scalingPolicyDetailsSummary, this.$injectorProxy) as any;
|
|
16
|
-
|
|
17
|
-
public initialize($injector: IInjectorService) {
|
|
18
|
-
const realInjector: { [key: string]: Function } = $injector as any;
|
|
19
|
-
const proxyInjector: { [key: string]: Function } = this.$injectorProxy as any;
|
|
20
|
-
|
|
21
|
-
Object.keys($injector)
|
|
22
|
-
.filter(key => typeof realInjector[key] === 'function')
|
|
23
|
-
.forEach(key => proxyInjector[key] = realInjector[key].bind(realInjector));
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export const AwsNgReact = new AwsNgReactInjector();
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export interface IScalingPolicyTypeConfig {
|
|
2
|
-
type: string;
|
|
3
|
-
summaryTemplateUrl: string;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export class ScalingPolicyTypeRegistrar {
|
|
7
|
-
private policyTypes: IScalingPolicyTypeConfig[] = [];
|
|
8
|
-
|
|
9
|
-
public registerPolicyType(policyConfig: IScalingPolicyTypeConfig): void {
|
|
10
|
-
this.policyTypes.push(policyConfig);
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
public getPolicyConfig(policyType: string): IScalingPolicyTypeConfig {
|
|
14
|
-
return this.policyTypes.find((p) => p.type === policyType);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export const ScalingPolicyTypeRegistry = new ScalingPolicyTypeRegistrar();
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<span class="label label-default">{{ $ctrl.policy.policyType | robotToHuman | uppercase }}</span>
|
|
2
|
-
|
|
3
|
-
<div ng-repeat="alarm in $ctrl.policy.alarms track by $index">
|
|
4
|
-
<div
|
|
5
|
-
uib-popover-template="$ctrl.popoverTemplate"
|
|
6
|
-
popover-placement="left"
|
|
7
|
-
popover-title="{{ $ctrl.policy.policyName }}"
|
|
8
|
-
popover-trigger="'mouseenter'"
|
|
9
|
-
>
|
|
10
|
-
<div>
|
|
11
|
-
<strong>Whenever</strong>
|
|
12
|
-
{{ alarm.statistic }} of <span class="alarm-name">{{ alarm.metricName }}</span> is
|
|
13
|
-
<span ng-bind-html="alarm.comparator"></span> {{ alarm.threshold }}
|
|
14
|
-
</div>
|
|
15
|
-
<div>
|
|
16
|
-
<strong>for at least</strong>
|
|
17
|
-
{{ alarm.evaluationPeriods }} consecutive periods of {{ alarm.period }} seconds
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
|
|
22
|
-
<div ng-if="!$ctrl.policy.alarms.length">
|
|
23
|
-
<em>No alarms configured for this policy — it's safe to delete.</em>
|
|
24
|
-
</div>
|
|
25
|
-
|
|
26
|
-
<div class="actions text-right">
|
|
27
|
-
<button class="btn btn-xs btn-link" ng-click="$ctrl.editPolicy()" ng-if="$ctrl.policy.alarms.length">
|
|
28
|
-
<span class="glyphicon glyphicon-cog" uib-tooltip="Edit policy"></span>
|
|
29
|
-
<span class="sr-only">Edit policy</span>
|
|
30
|
-
</button>
|
|
31
|
-
<button class="btn btn-xs btn-link" ng-click="$ctrl.deletePolicy()">
|
|
32
|
-
<span class="glyphicon glyphicon-trash" uib-tooltip="Delete policy"></span>
|
|
33
|
-
<span class="sr-only">Delete policy</span>
|
|
34
|
-
</button>
|
|
35
|
-
</div>
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
import { module } from 'angular';
|
|
4
|
-
|
|
5
|
-
import { ConfirmationModalService, ReactModal } from '@spinnaker/core';
|
|
6
|
-
|
|
7
|
-
import { ScalingPolicyWriter } from './ScalingPolicyWriter';
|
|
8
|
-
import { SCALING_POLICY_POPOVER } from './popover/scalingPolicyPopover.component';
|
|
9
|
-
import { UpsertScalingPolicyModal } from './upsert/UpsertScalingPolicyModal';
|
|
10
|
-
|
|
11
|
-
import './scalingPolicySummary.component.less';
|
|
12
|
-
|
|
13
|
-
export const AMAZON_SERVERGROUP_DETAILS_SCALINGPOLICY_ALARMBASEDSUMMARY_COMPONENT =
|
|
14
|
-
'spinnaker.amazon.serverGroup.details.scalingPolicy.alarmBasedSummary.component';
|
|
15
|
-
export const name = AMAZON_SERVERGROUP_DETAILS_SCALINGPOLICY_ALARMBASEDSUMMARY_COMPONENT; // for backwards compatibility
|
|
16
|
-
module(AMAZON_SERVERGROUP_DETAILS_SCALINGPOLICY_ALARMBASEDSUMMARY_COMPONENT, [SCALING_POLICY_POPOVER]).component(
|
|
17
|
-
'alarmBasedSummary',
|
|
18
|
-
{
|
|
19
|
-
bindings: {
|
|
20
|
-
policy: '=',
|
|
21
|
-
serverGroup: '=',
|
|
22
|
-
application: '=',
|
|
23
|
-
},
|
|
24
|
-
templateUrl: require('./alarmBasedSummary.component.html'),
|
|
25
|
-
controller: [
|
|
26
|
-
'$uibModal',
|
|
27
|
-
function ($uibModal) {
|
|
28
|
-
this.popoverTemplate = require('./popover/scalingPolicyDetails.popover.html');
|
|
29
|
-
|
|
30
|
-
this.editPolicy = () => {
|
|
31
|
-
const upsertProps = {
|
|
32
|
-
app: this.application,
|
|
33
|
-
policy: this.policy,
|
|
34
|
-
serverGroup: this.serverGroup,
|
|
35
|
-
};
|
|
36
|
-
const modalProps = { dialogClassName: 'wizard-modal modal-lg' };
|
|
37
|
-
ReactModal.show(UpsertScalingPolicyModal, upsertProps, modalProps);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
this.deletePolicy = () => {
|
|
41
|
-
const taskMonitor = {
|
|
42
|
-
application: this.application,
|
|
43
|
-
title: 'Deleting scaling policy ' + this.policy.policyName,
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const submitMethod = () =>
|
|
47
|
-
ScalingPolicyWriter.deleteScalingPolicy(this.application, this.serverGroup, this.policy);
|
|
48
|
-
|
|
49
|
-
ConfirmationModalService.confirm({
|
|
50
|
-
header: 'Really delete ' + this.policy.policyName + '?',
|
|
51
|
-
buttonText: 'Delete scaling policy',
|
|
52
|
-
account: this.policy.alarms.length ? this.serverGroup.account : null, // don't confirm if it's a junk policy
|
|
53
|
-
taskMonitorConfig: taskMonitor,
|
|
54
|
-
submitMethod: submitMethod,
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
},
|
|
60
|
-
);
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { IComponentOptions, IController } from 'angular';
|
|
2
|
-
import { module } from 'angular';
|
|
3
|
-
|
|
4
|
-
import type { Application, IServerGroup } from '@spinnaker/core';
|
|
5
|
-
|
|
6
|
-
import { ScalingPolicyTypeRegistry } from './ScalingPolicyTypeRegistry';
|
|
7
|
-
import type { IScalingPolicy } from '../../../domain';
|
|
8
|
-
|
|
9
|
-
export class ScalingPolicyDetailsSummaryController implements IController {
|
|
10
|
-
public templateUrl: string;
|
|
11
|
-
public policy: IScalingPolicy;
|
|
12
|
-
public serverGroup: IServerGroup;
|
|
13
|
-
public application: Application;
|
|
14
|
-
|
|
15
|
-
public $onInit() {
|
|
16
|
-
const config = ScalingPolicyTypeRegistry.getPolicyConfig(this.policy.policyType);
|
|
17
|
-
this.templateUrl = config ? config.summaryTemplateUrl : require('./alarmBasedSummary.template.html');
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export const scalingPolicyDetailsSummary: IComponentOptions = {
|
|
22
|
-
bindings: {
|
|
23
|
-
policy: '<',
|
|
24
|
-
serverGroup: '<',
|
|
25
|
-
application: '<',
|
|
26
|
-
},
|
|
27
|
-
controller: ScalingPolicyDetailsSummaryController,
|
|
28
|
-
template: `<div ng-include src="$ctrl.templateUrl"></div>`,
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export const DETAILS_SUMMARY = 'spinnaker.amazon.scalingPolicy.details.summary.component';
|
|
32
|
-
module(DETAILS_SUMMARY, []).component('scalingPolicySummary', scalingPolicyDetailsSummary);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<aws-scaling-policy-popover policy="$ctrl.policy" server-group="$ctrl.serverGroup"></aws-scaling-policy-popover>
|