@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
|
@@ -9,7 +9,7 @@ export interface ITargetMetricFieldsProps {
|
|
|
9
9
|
isCustomMetric: boolean;
|
|
10
10
|
serverGroup: IAmazonServerGroup;
|
|
11
11
|
toggleMetricType?: (type: MetricType) => void;
|
|
12
|
-
unit
|
|
12
|
+
unit?: string;
|
|
13
13
|
updateCommand: (command: ITargetTrackingPolicyCommand) => void;
|
|
14
14
|
}
|
|
15
15
|
export declare const TargetMetricFields: ({ allowDualMode, cloudwatch, command, isCustomMetric, serverGroup, toggleMetricType, unit, updateCommand, }: ITargetMetricFieldsProps) => JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Application, IModalComponentProps } from '@spinnaker/core';
|
|
2
|
+
import { IAmazonServerGroup, ITargetTrackingPolicy } from '../../../../domain';
|
|
3
|
+
export interface IUpsertTargetTrackingModalProps extends IModalComponentProps {
|
|
4
|
+
app: Application;
|
|
5
|
+
policy: ITargetTrackingPolicy;
|
|
6
|
+
serverGroup: IAmazonServerGroup;
|
|
7
|
+
}
|
|
8
|
+
export declare const UpsertTargetTrackingModal: ({ app, closeModal, dismissModal, policy, serverGroup, }: IUpsertTargetTrackingModalProps) => JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Application, IModalComponentProps } from '@spinnaker/core';
|
|
2
|
+
import { IAmazonServerGroup, IScalingPolicy } from '../../../../domain';
|
|
3
|
+
export interface IUpsertScalingPolicyModalProps extends IModalComponentProps {
|
|
4
|
+
app: Application;
|
|
5
|
+
policy: IScalingPolicy;
|
|
6
|
+
serverGroup: IAmazonServerGroup;
|
|
7
|
+
}
|
|
8
|
+
export declare const UpsertScalingPolicyModal: ({ app, closeModal, dismissModal, policy, serverGroup, }: IUpsertScalingPolicyModalProps) => JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { IScalingPolicyAlarm, IStepAdjustment } from '../../../../../domain';
|
|
2
2
|
import './StepPolicyAction.less';
|
|
3
|
-
declare type Operator = 'Add' | 'Remove' | 'Set to';
|
|
4
|
-
declare type AdjustmentTypeView = 'instances' | 'percent of group';
|
|
3
|
+
export declare type Operator = 'Add' | 'Remove' | 'Set to';
|
|
4
|
+
export declare type AdjustmentTypeView = 'instances' | 'percent of group';
|
|
5
5
|
export interface IStepPolicyActionProps {
|
|
6
6
|
adjustmentType: AdjustmentTypeView;
|
|
7
7
|
adjustmentTypeChanged: (action: Operator, type: AdjustmentTypeView) => void;
|
|
@@ -15,4 +15,3 @@ export interface IStepPolicyActionProps {
|
|
|
15
15
|
stepsChanged: (steps: IStepAdjustment[]) => void;
|
|
16
16
|
}
|
|
17
17
|
export declare const StepPolicyAction: ({ adjustmentType, adjustmentTypeChanged, alarm, isMin, operator, step, stepAdjustments, stepsChanged, }: IStepPolicyActionProps) => JSX.Element;
|
|
18
|
-
export {};
|
|
@@ -3,7 +3,7 @@ export * from './AmazonInfoDetailsSection';
|
|
|
3
3
|
export * from './AmazonCapacityDetailsSection';
|
|
4
4
|
export * from './HealthDetailsSection';
|
|
5
5
|
export * from './IAmazonServerGroupDetailsSectionProps';
|
|
6
|
-
export * from './
|
|
6
|
+
export * from './InstancesDistributionDetailsSection';
|
|
7
7
|
export * from './LaunchConfigDetailsSection';
|
|
8
8
|
export * from './LaunchTemplateDetailsSection';
|
|
9
9
|
export * from './LogsDetailsSection';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spinnaker/amazon",
|
|
3
3
|
"license": "Apache-2.0",
|
|
4
|
-
"version": "0.8.
|
|
4
|
+
"version": "0.8.11",
|
|
5
5
|
"module": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
7
7
|
"scripts": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"lib": "npm run build"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@spinnaker/core": "^0.11.
|
|
16
|
+
"@spinnaker/core": "^0.11.4",
|
|
17
17
|
"@uirouter/angularjs": "1.0.26",
|
|
18
18
|
"@uirouter/core": "6.0.8",
|
|
19
19
|
"@uirouter/react": "1.0.7",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"shx": "0.3.3",
|
|
56
56
|
"typescript": "4.3.5"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "d28eac29c463069358e8c07413a56b290af9f7ce"
|
|
59
59
|
}
|
package/src/aws.module.ts
CHANGED
|
@@ -52,7 +52,7 @@ import {
|
|
|
52
52
|
AmazonCapacityDetailsSection,
|
|
53
53
|
AmazonInfoDetailsSection,
|
|
54
54
|
HealthDetailsSection,
|
|
55
|
-
|
|
55
|
+
InstancesDistributionDetailsSection,
|
|
56
56
|
LaunchConfigDetailsSection,
|
|
57
57
|
LaunchTemplateDetailsSection,
|
|
58
58
|
LogsDetailsSection,
|
|
@@ -125,7 +125,7 @@ module(AMAZON_MODULE, [
|
|
|
125
125
|
AmazonInfoDetailsSection,
|
|
126
126
|
AmazonCapacityDetailsSection,
|
|
127
127
|
HealthDetailsSection,
|
|
128
|
-
|
|
128
|
+
InstancesDistributionDetailsSection,
|
|
129
129
|
LaunchConfigDetailsSection,
|
|
130
130
|
LaunchTemplateDetailsSection,
|
|
131
131
|
SecurityGroupsDetailsSection,
|
|
@@ -22,6 +22,7 @@ export interface IAmazonServerGroup extends IServerGroup {
|
|
|
22
22
|
scalingPolicies?: IScalingPolicy[];
|
|
23
23
|
targetGroups?: string[];
|
|
24
24
|
asg: IAmazonAsg;
|
|
25
|
+
awsAccount?: string;
|
|
25
26
|
launchTemplate?: IAmazonLaunchTemplate;
|
|
26
27
|
mixedInstancesPolicy?: IAmazonMixedInstancesPolicy;
|
|
27
28
|
}
|
|
@@ -35,12 +36,12 @@ export interface IScheduledAction {
|
|
|
35
36
|
|
|
36
37
|
export interface IAmazonMixedInstancesPolicy {
|
|
37
38
|
allowedInstanceTypes: string[];
|
|
38
|
-
|
|
39
|
+
instancesDistribution: IAmazonInstancesDistribution;
|
|
39
40
|
launchTemplates: IAmazonLaunchTemplate[];
|
|
40
41
|
launchTemplateOverridesForInstanceType: IAmazonLaunchTemplateOverrides[];
|
|
41
42
|
}
|
|
42
43
|
|
|
43
|
-
export interface
|
|
44
|
+
export interface IAmazonInstancesDistribution {
|
|
44
45
|
onDemandAllocationStrategy: string;
|
|
45
46
|
onDemandBaseCapacity: number;
|
|
46
47
|
onDemandPercentageAboveBaseCapacity: number;
|
|
@@ -51,7 +52,8 @@ export interface IAmazonInstancesDiversification {
|
|
|
51
52
|
|
|
52
53
|
export interface IAmazonLaunchTemplateOverrides {
|
|
53
54
|
instanceType: string;
|
|
54
|
-
weightedCapacity
|
|
55
|
+
weightedCapacity?: string;
|
|
56
|
+
priority?: number;
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
export interface IAmazonServerGroupView extends IAmazonServerGroup {
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import { Application,
|
|
3
|
+
import { Application, ReactModal } from '@spinnaker/core';
|
|
4
4
|
import { IAmazonServerGroupView } from '../../../domain';
|
|
5
5
|
import { AwsReactInjector } from '../../../reactShims';
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { IUpsertTargetTrackingModalProps, UpsertTargetTrackingModal } from './targetTracking/UpsertTargetTrackingModal';
|
|
8
8
|
import { PolicyTypeSelectionModal } from './upsert/PolicyTypeSelectionModal';
|
|
9
|
+
import { IUpsertScalingPolicyModalProps, UpsertScalingPolicyModal } from './upsert/UpsertScalingPolicyModal';
|
|
9
10
|
|
|
10
11
|
export interface ICreateScalingPolicyButtonProps {
|
|
11
12
|
application: Application;
|
|
@@ -38,37 +39,25 @@ export class CreateScalingPolicyButton extends React.Component<
|
|
|
38
39
|
public createStepPolicy(): void {
|
|
39
40
|
const { serverGroup, application } = this.props;
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
policy: () => AwsReactInjector.awsServerGroupTransformer.constructNewStepScalingPolicyTemplate(serverGroup),
|
|
49
|
-
serverGroup: () => serverGroup,
|
|
50
|
-
application: () => application,
|
|
51
|
-
},
|
|
52
|
-
})
|
|
53
|
-
.result.catch(() => {});
|
|
42
|
+
const upsertProps = {
|
|
43
|
+
app: application,
|
|
44
|
+
policy: AwsReactInjector.awsServerGroupTransformer.constructNewStepScalingPolicyTemplate(serverGroup),
|
|
45
|
+
serverGroup,
|
|
46
|
+
} as IUpsertScalingPolicyModalProps;
|
|
47
|
+
const modalProps = { dialogClassName: 'wizard-modal modal-lg' };
|
|
48
|
+
ReactModal.show(UpsertScalingPolicyModal, upsertProps, modalProps);
|
|
54
49
|
}
|
|
55
50
|
|
|
56
51
|
public createTargetTrackingPolicy(): void {
|
|
57
52
|
const { serverGroup, application } = this.props;
|
|
58
53
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
policy: () => AwsReactInjector.awsServerGroupTransformer.constructNewTargetTrackingPolicyTemplate(),
|
|
67
|
-
serverGroup: () => serverGroup,
|
|
68
|
-
application: () => application,
|
|
69
|
-
},
|
|
70
|
-
})
|
|
71
|
-
.result.catch(() => {});
|
|
54
|
+
const upsertProps = {
|
|
55
|
+
app: application,
|
|
56
|
+
policy: AwsReactInjector.awsServerGroupTransformer.constructNewTargetTrackingPolicyTemplate(),
|
|
57
|
+
serverGroup,
|
|
58
|
+
} as IUpsertTargetTrackingModalProps;
|
|
59
|
+
const modalProps = { dialogClassName: 'wizard-modal modal-lg' };
|
|
60
|
+
ReactModal.show(UpsertTargetTrackingModal, upsertProps, modalProps);
|
|
72
61
|
}
|
|
73
62
|
|
|
74
63
|
public typeSelected = (typeSelection: string): void => {
|
|
@@ -2,63 +2,59 @@
|
|
|
2
2
|
|
|
3
3
|
import { module } from 'angular';
|
|
4
4
|
|
|
5
|
-
import { ConfirmationModalService } from '@spinnaker/core';
|
|
5
|
+
import { ConfirmationModalService, ReactModal } from '@spinnaker/core';
|
|
6
6
|
|
|
7
7
|
import { ScalingPolicyWriter } from './ScalingPolicyWriter';
|
|
8
8
|
import { SCALING_POLICY_POPOVER } from './popover/scalingPolicyPopover.component';
|
|
9
|
-
import {
|
|
9
|
+
import { UpsertScalingPolicyModal } from './upsert/UpsertScalingPolicyModal';
|
|
10
10
|
|
|
11
11
|
import './scalingPolicySummary.component.less';
|
|
12
12
|
|
|
13
13
|
export const AMAZON_SERVERGROUP_DETAILS_SCALINGPOLICY_ALARMBASEDSUMMARY_COMPONENT =
|
|
14
14
|
'spinnaker.amazon.serverGroup.details.scalingPolicy.alarmBasedSummary.component';
|
|
15
15
|
export const name = AMAZON_SERVERGROUP_DETAILS_SCALINGPOLICY_ALARMBASEDSUMMARY_COMPONENT; // for backwards compatibility
|
|
16
|
-
module(AMAZON_SERVERGROUP_DETAILS_SCALINGPOLICY_ALARMBASEDSUMMARY_COMPONENT, [
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
policy: () => this.policy,
|
|
39
|
-
serverGroup: () => this.serverGroup,
|
|
40
|
-
application: () => this.application,
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
this.deletePolicy = () => {
|
|
46
|
-
const taskMonitor = {
|
|
47
|
-
application: this.application,
|
|
48
|
-
title: 'Deleting scaling policy ' + this.policy.policyName,
|
|
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);
|
|
49
38
|
};
|
|
50
39
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
+
);
|
|
@@ -32,7 +32,7 @@ export function MetricAlarmChart(props: IMetricAlarmChartProps) {
|
|
|
32
32
|
export function MetricAlarmChartImpl(props: IMetricAlarmChartProps) {
|
|
33
33
|
const alarm = props.alarm ?? ({} as IScalingPolicyAlarm);
|
|
34
34
|
const serverGroup = props.serverGroup ?? ({} as IAmazonServerGroup);
|
|
35
|
-
const {
|
|
35
|
+
const { account, awsAccount, cloudProvider, region, type } = serverGroup;
|
|
36
36
|
const { metricName, namespace, statistic, period } = alarm;
|
|
37
37
|
|
|
38
38
|
const { status, result } = useData<ICloudMetricStatistics>(
|
|
@@ -40,7 +40,8 @@ export function MetricAlarmChartImpl(props: IMetricAlarmChartProps) {
|
|
|
40
40
|
const parameters: Record<string, string | number> = { namespace, statistics: statistic, period };
|
|
41
41
|
alarm.dimensions.forEach((dimension) => (parameters[dimension.name] = dimension.value));
|
|
42
42
|
|
|
43
|
-
const
|
|
43
|
+
const metricAccount = cloudProvider === 'aws' ? account : awsAccount;
|
|
44
|
+
const result = await CloudMetricsReader.getMetricStatistics('aws', metricAccount, region, metricName, parameters);
|
|
44
45
|
result.datapoints = result.datapoints || [];
|
|
45
46
|
props.onChartLoaded?.(result);
|
|
46
47
|
|
|
@@ -18,7 +18,7 @@ export interface ITargetMetricFieldsProps {
|
|
|
18
18
|
isCustomMetric: boolean;
|
|
19
19
|
serverGroup: IAmazonServerGroup;
|
|
20
20
|
toggleMetricType?: (type: MetricType) => void;
|
|
21
|
-
unit
|
|
21
|
+
unit?: string;
|
|
22
22
|
updateCommand: (command: ITargetTrackingPolicyCommand) => void;
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -131,7 +131,7 @@ export const TargetMetricFields = ({
|
|
|
131
131
|
<span className="sp-margin-xs-xaxis">of</span>
|
|
132
132
|
</div>
|
|
133
133
|
)}
|
|
134
|
-
<div>
|
|
134
|
+
<div className="horizontal middle">
|
|
135
135
|
<NumberInput
|
|
136
136
|
value={commandView.targetTrackingConfiguration.targetValue}
|
|
137
137
|
onChange={(e) =>
|
package/src/serverGroup/details/scalingPolicy/targetTracking/TargetTrackingAdditionalSettings.tsx
CHANGED
|
@@ -3,6 +3,8 @@ import * as React from 'react';
|
|
|
3
3
|
import { CheckboxInput, HelpField, NumberInput } from '@spinnaker/core';
|
|
4
4
|
import { IUpsertScalingPolicyCommand } from '../ScalingPolicyWriter';
|
|
5
5
|
|
|
6
|
+
import './TargetTrackingAdditionalSettings.less';
|
|
7
|
+
|
|
6
8
|
export interface ITargetTrackingAdditionalSettingsProps {
|
|
7
9
|
command: IUpsertScalingPolicyCommand;
|
|
8
10
|
cooldowns?: Boolean;
|
|
@@ -21,24 +23,24 @@ export const TargetTrackingAdditionalSettings = ({
|
|
|
21
23
|
set(newCommand, path, value);
|
|
22
24
|
updateCommand(newCommand);
|
|
23
25
|
};
|
|
24
|
-
const scaleInDisabled =
|
|
26
|
+
const scaleInDisabled = command.targetTrackingConfiguration?.disableScaleIn;
|
|
25
27
|
return (
|
|
26
|
-
<div className="section-body
|
|
28
|
+
<div className="section-body TargetTrackingAdditionalSettings">
|
|
27
29
|
{policyName && (
|
|
28
30
|
<div className="row">
|
|
29
31
|
<div className="col-md-2 sm-label-right">Policy Name</div>
|
|
30
|
-
<div className="col-md-10
|
|
32
|
+
<div className="col-md-10 horizontal middle">{policyName}</div>
|
|
31
33
|
</div>
|
|
32
34
|
)}
|
|
33
|
-
{Boolean(command.
|
|
35
|
+
{Boolean(command.estimatedInstanceWarmup) && (
|
|
34
36
|
<div className="row">
|
|
35
37
|
<div className="col-md-2 sm-label-right">Warmup</div>
|
|
36
|
-
<div className="col-md-10
|
|
37
|
-
<span className="form-control-static
|
|
38
|
+
<div className="col-md-10 horizontal middle">
|
|
39
|
+
<span className="form-control-static">Instances need</span>
|
|
38
40
|
<NumberInput
|
|
39
41
|
value={command.estimatedInstanceWarmup}
|
|
40
42
|
onChange={(e) => setCommandField('estimatedInstanceWarmup', Number.parseInt(e.target.value))}
|
|
41
|
-
inputClassName="form-control input-sm sp-margin-xs-xaxis"
|
|
43
|
+
inputClassName="form-control number-input-sm sp-margin-xs-xaxis"
|
|
42
44
|
/>
|
|
43
45
|
<span className="input-label"> seconds to warm up </span>
|
|
44
46
|
</div>
|
|
@@ -64,15 +66,15 @@ export const TargetTrackingAdditionalSettings = ({
|
|
|
64
66
|
</div>
|
|
65
67
|
</div>
|
|
66
68
|
<div className="row">
|
|
67
|
-
<div className="col-md-10 col-md-offset-1
|
|
69
|
+
<div className="col-md-10 col-md-offset-1">
|
|
68
70
|
{scaleInDisabled && (
|
|
69
|
-
<div>
|
|
71
|
+
<div className="well">
|
|
70
72
|
This policy will not scale down. Make sure you have another policy (either TT or Step) that will scale
|
|
71
73
|
down this ASG.
|
|
72
74
|
</div>
|
|
73
75
|
)}
|
|
74
|
-
{
|
|
75
|
-
<div>
|
|
76
|
+
{scaleInDisabled === false && (
|
|
77
|
+
<div className="well">
|
|
76
78
|
This policy will scale both up and down. Make sure you don't have other scaling policies, as they will
|
|
77
79
|
likely interfere with each other.
|
|
78
80
|
</div>
|
|
@@ -85,13 +87,13 @@ export const TargetTrackingAdditionalSettings = ({
|
|
|
85
87
|
<span className="sp-margin-xs-right">Scale In Cooldown</span>
|
|
86
88
|
<HelpField id="titus.autoscaling.scaleIn.cooldown" />
|
|
87
89
|
</div>
|
|
88
|
-
<div className="col-md-9
|
|
90
|
+
<div className="col-md-9 horizontal middle">
|
|
89
91
|
<NumberInput
|
|
90
92
|
value={command.targetTrackingConfiguration.scaleInCooldown}
|
|
91
93
|
onChange={(e) =>
|
|
92
94
|
setCommandField('targetTrackingConfiguration.scaleInCooldown', Number.parseInt(e.target.value))
|
|
93
95
|
}
|
|
94
|
-
inputClassName="sp-margin-xs-xaxis"
|
|
96
|
+
inputClassName="sp-margin-xs-xaxis number-input-sm"
|
|
95
97
|
/>
|
|
96
98
|
<span className="input-label"> seconds </span>
|
|
97
99
|
</div>
|
|
@@ -103,13 +105,13 @@ export const TargetTrackingAdditionalSettings = ({
|
|
|
103
105
|
<span className="sp-margin-xs-right">Scale Out Cooldown</span>
|
|
104
106
|
<HelpField id="titus.autoscaling.scaleOut.cooldown" />
|
|
105
107
|
</div>
|
|
106
|
-
<div className="col-md-9
|
|
108
|
+
<div className="col-md-9 horizontal middle">
|
|
107
109
|
<NumberInput
|
|
108
|
-
value={command.targetTrackingConfiguration.
|
|
110
|
+
value={command.targetTrackingConfiguration.scaleOutCooldown}
|
|
109
111
|
onChange={(e) =>
|
|
110
112
|
setCommandField('targetTrackingConfiguration.scaleOutCooldown', Number.parseInt(e.target.value))
|
|
111
113
|
}
|
|
112
|
-
inputClassName="sp-margin-xs-xaxis"
|
|
114
|
+
inputClassName="sp-margin-xs-xaxis number-input-sm"
|
|
113
115
|
/>
|
|
114
116
|
<span className="input-label"> seconds </span>
|
|
115
117
|
</div>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Application, IModalComponentProps, TaskMonitorModal } from '@spinnaker/core';
|
|
4
|
+
|
|
5
|
+
import { ITargetTrackingPolicyCommand, IUpsertScalingPolicyCommand } from '../ScalingPolicyWriter';
|
|
6
|
+
import { TargetMetricFields } from './TargetMetricFields';
|
|
7
|
+
import { TargetTrackingAdditionalSettings } from './TargetTrackingAdditionalSettings';
|
|
8
|
+
import { IAmazonServerGroup, ITargetTrackingPolicy } from '../../../../domain';
|
|
9
|
+
import { ScalingPolicyCommandBuilder } from '../upsert/ScalingPolicyCommandBuilderService';
|
|
10
|
+
|
|
11
|
+
export interface IUpsertTargetTrackingModalProps extends IModalComponentProps {
|
|
12
|
+
app: Application;
|
|
13
|
+
policy: ITargetTrackingPolicy;
|
|
14
|
+
serverGroup: IAmazonServerGroup;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const UpsertTargetTrackingModal = ({
|
|
18
|
+
app,
|
|
19
|
+
closeModal,
|
|
20
|
+
dismissModal,
|
|
21
|
+
policy,
|
|
22
|
+
serverGroup,
|
|
23
|
+
}: IUpsertTargetTrackingModalProps) => {
|
|
24
|
+
const [isCustom, setIsCustom] = React.useState<boolean>(
|
|
25
|
+
Boolean(policy.targetTrackingConfiguration?.customizedMetricSpecification),
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
const [command, setCommand] = React.useState<IUpsertScalingPolicyCommand>({} as IUpsertScalingPolicyCommand);
|
|
29
|
+
React.useEffect(() => {
|
|
30
|
+
const baseCommand = ScalingPolicyCommandBuilder.buildNewCommand('TargetTracking', serverGroup, policy);
|
|
31
|
+
setCommand(baseCommand);
|
|
32
|
+
}, []);
|
|
33
|
+
|
|
34
|
+
const mode = policy.policyName ? 'Update' : 'Create';
|
|
35
|
+
return (
|
|
36
|
+
<TaskMonitorModal<IUpsertScalingPolicyCommand>
|
|
37
|
+
closeModal={closeModal}
|
|
38
|
+
dismissModal={dismissModal}
|
|
39
|
+
title={`${mode} scaling policy`}
|
|
40
|
+
application={app}
|
|
41
|
+
description={`${mode} scaling policy for ${serverGroup.name}`}
|
|
42
|
+
initialValues={command}
|
|
43
|
+
mapValuesToTask={() => ({
|
|
44
|
+
application: app,
|
|
45
|
+
job: [
|
|
46
|
+
{
|
|
47
|
+
type: 'upsertScalingPolicy',
|
|
48
|
+
...command,
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
})}
|
|
52
|
+
render={() => (
|
|
53
|
+
<div className="modal-body">
|
|
54
|
+
<h4 className="section-heading">Target Metric</h4>
|
|
55
|
+
<TargetMetricFields
|
|
56
|
+
allowDualMode={true}
|
|
57
|
+
cloudwatch={false}
|
|
58
|
+
command={command as ITargetTrackingPolicyCommand}
|
|
59
|
+
isCustomMetric={isCustom}
|
|
60
|
+
serverGroup={serverGroup}
|
|
61
|
+
toggleMetricType={(t) => setIsCustom(t === 'custom')}
|
|
62
|
+
updateCommand={setCommand}
|
|
63
|
+
/>
|
|
64
|
+
<h4 className="section-heading">Additional Settings</h4>
|
|
65
|
+
<TargetTrackingAdditionalSettings
|
|
66
|
+
command={command}
|
|
67
|
+
cooldowns={false}
|
|
68
|
+
policyName={policy.policyName}
|
|
69
|
+
updateCommand={setCommand}
|
|
70
|
+
/>
|
|
71
|
+
</div>
|
|
72
|
+
)}
|
|
73
|
+
/>
|
|
74
|
+
);
|
|
75
|
+
};
|
package/src/serverGroup/details/scalingPolicy/targetTracking/targetTrackingSummary.component.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { IComponentController, IComponentOptions, module } from 'angular';
|
|
2
|
-
import { IModalService } from 'angular-ui-bootstrap';
|
|
3
2
|
|
|
4
|
-
import { Application, ConfirmationModalService, IServerGroup, ITaskMonitorConfig } from '@spinnaker/core';
|
|
3
|
+
import { Application, ConfirmationModalService, IServerGroup, ITaskMonitorConfig, ReactModal } from '@spinnaker/core';
|
|
5
4
|
|
|
6
5
|
import { ScalingPolicyWriter } from '../ScalingPolicyWriter';
|
|
6
|
+
import { IUpsertTargetTrackingModalProps, UpsertTargetTrackingModal } from './UpsertTargetTrackingModal';
|
|
7
7
|
import { ITargetTrackingConfiguration, ITargetTrackingPolicy } from '../../../../domain/ITargetTrackingPolicy';
|
|
8
|
-
import { UpsertTargetTrackingController } from './upsertTargetTracking.controller';
|
|
9
8
|
|
|
10
9
|
class TargetTrackingSummaryController implements IComponentController {
|
|
11
10
|
public policy: ITargetTrackingPolicy;
|
|
@@ -14,25 +13,20 @@ class TargetTrackingSummaryController implements IComponentController {
|
|
|
14
13
|
public config: ITargetTrackingConfiguration;
|
|
15
14
|
public popoverTemplate = require('./targetTrackingPopover.html');
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
constructor(private $uibModal: IModalService) {}
|
|
16
|
+
constructor() {}
|
|
19
17
|
|
|
20
18
|
public $onInit() {
|
|
21
19
|
this.config = this.policy.targetTrackingConfiguration;
|
|
22
20
|
}
|
|
23
21
|
|
|
24
22
|
public editPolicy(): void {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
serverGroup: () => this.serverGroup,
|
|
33
|
-
application: () => this.application,
|
|
34
|
-
},
|
|
35
|
-
});
|
|
23
|
+
const upsertProps = {
|
|
24
|
+
app: this.application,
|
|
25
|
+
policy: this.policy,
|
|
26
|
+
serverGroup: this.serverGroup,
|
|
27
|
+
} as IUpsertTargetTrackingModalProps;
|
|
28
|
+
const modalProps = { dialogClassName: 'wizard-modal modal-lg' };
|
|
29
|
+
ReactModal.show(UpsertTargetTrackingModal, upsertProps, modalProps);
|
|
36
30
|
}
|
|
37
31
|
|
|
38
32
|
public deletePolicy(): void {
|