@spinnaker/titus 0.0.0-main-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 +2661 -0
- package/LICENSE.txt +203 -0
- package/dist/domain/IJobDisruptionBudget.d.ts +35 -0
- package/dist/domain/ITitusCredentials.d.ts +5 -0
- package/dist/domain/ITitusInstance.d.ts +28 -0
- package/dist/domain/ITitusScalingPolicy.d.ts +4 -0
- package/dist/domain/ITitusServerGroup.d.ts +52 -0
- package/dist/domain/ITitusServiceJobProcesses.d.ts +3 -0
- package/dist/domain/index.d.ts +5 -0
- package/dist/help/titus.help.d.ts +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +12828 -0
- package/dist/index.js.map +1 -0
- package/dist/instance/details/TitusInstanceDetails.d.ts +25 -0
- package/dist/instance/details/TitusInstanceDns.d.ts +8 -0
- package/dist/instance/details/TitusInstanceInformation.d.ts +7 -0
- package/dist/instance/details/index.d.ts +4 -0
- package/dist/instance/details/titusInstanceDetailsUtils.d.ts +14 -0
- package/dist/pipeline/stages/cloneServerGroup/cloneServerGroupExecutionDetails.controller.d.ts +2 -0
- package/dist/pipeline/stages/cloneServerGroup/titusCloneServerGroupStage.d.ts +2 -0
- package/dist/pipeline/stages/destroyAsg/titusDestroyAsgStage.d.ts +2 -0
- package/dist/pipeline/stages/disableAsg/titusDisableAsgStage.d.ts +2 -0
- package/dist/pipeline/stages/disableCluster/titusDisableClusterStage.d.ts +2 -0
- package/dist/pipeline/stages/enableAsg/titusEnableAsgStage.d.ts +2 -0
- package/dist/pipeline/stages/findAmi/titusFindAmiStage.d.ts +2 -0
- package/dist/pipeline/stages/resizeAsg/titusResizeAsgStage.d.ts +2 -0
- package/dist/pipeline/stages/runJob/RunJobExecutionDetails.d.ts +16 -0
- package/dist/pipeline/stages/runJob/TitusRunJobStageConfig.d.ts +25 -0
- package/dist/pipeline/stages/runJob/TitusSecurityGroupPicker.d.ts +34 -0
- package/dist/pipeline/stages/runJob/titusRunJobStage.d.ts +1 -0
- package/dist/pipeline/stages/scaleDownCluster/titusScaleDownClusterStage.d.ts +2 -0
- package/dist/pipeline/stages/shrinkCluster/titusShrinkClusterStage.d.ts +2 -0
- package/dist/reactShims/index.d.ts +1 -0
- package/dist/reactShims/titus.react.injector.d.ts +11 -0
- package/dist/reactShims/titus.react.module.d.ts +1 -0
- package/dist/securityGroup/securityGroup.read.service.d.ts +2 -0
- package/dist/serverGroup/configure/ServerGroupCommandBuilder.d.ts +2 -0
- package/dist/serverGroup/configure/serverGroup.configure.titus.module.d.ts +2 -0
- package/dist/serverGroup/configure/serverGroupConfiguration.service.d.ts +89 -0
- package/dist/serverGroup/configure/wizard/TitusCloneServerGroupModal.d.ts +31 -0
- package/dist/serverGroup/configure/wizard/pages/ServerGroupBasicSettings.d.ts +28 -0
- package/dist/serverGroup/configure/wizard/pages/ServerGroupParameters.d.ts +15 -0
- package/dist/serverGroup/configure/wizard/pages/ServerGroupResources.d.ts +11 -0
- package/dist/serverGroup/configure/wizard/pages/TitusMapLayout.d.ts +4 -0
- package/dist/serverGroup/configure/wizard/pages/disruptionBudget/JobDisruptionBudget.d.ts +40 -0
- package/dist/serverGroup/configure/wizard/pages/disruptionBudget/PolicyOptions.d.ts +2 -0
- package/dist/serverGroup/configure/wizard/pages/disruptionBudget/RateOptions.d.ts +2 -0
- package/dist/serverGroup/configure/wizard/pages/disruptionBudget/WindowPicker.d.ts +23 -0
- package/dist/serverGroup/configure/wizard/pages/index.d.ts +4 -0
- package/dist/serverGroup/details/TitusCapacityDetailsSection.d.ts +11 -0
- package/dist/serverGroup/details/TitusLaunchConfigSection.d.ts +9 -0
- package/dist/serverGroup/details/TitusPackageDetailsSection.d.ts +6 -0
- package/dist/serverGroup/details/TitusSecurityGroups.d.ts +17 -0
- package/dist/serverGroup/details/capacityDetailsSection.component.d.ts +1 -0
- package/dist/serverGroup/details/disruptionBudget/DisruptionBudgetSection.d.ts +19 -0
- package/dist/serverGroup/details/disruptionBudget/EditDisruptionBudgetModal.d.ts +14 -0
- package/dist/serverGroup/details/index.d.ts +5 -0
- package/dist/serverGroup/details/launchConfigSection.component.d.ts +1 -0
- package/dist/serverGroup/details/resize/TitusResizeServerGroupModal.d.ts +8 -0
- package/dist/serverGroup/details/resize/useTaskMonitor.d.ts +25 -0
- package/dist/serverGroup/details/rollback/rollbackServerGroup.controller.d.ts +2 -0
- package/dist/serverGroup/details/scalingActivity/TitusScalingActivitiesModal.d.ts +7 -0
- package/dist/serverGroup/details/scalingPolicy/CreateScalingPolicyButton.d.ts +21 -0
- package/dist/serverGroup/details/scalingPolicy/TitusCustomScalingPolicy.d.ts +7 -0
- package/dist/serverGroup/details/scalingPolicy/createScalingPolicyButton.component.d.ts +1 -0
- package/dist/serverGroup/details/scalingPolicy/index.d.ts +3 -0
- package/dist/serverGroup/details/scalingPolicy/scalingPolicy.module.d.ts +1 -0
- package/dist/serverGroup/details/scalingPolicy/targetTracking/TitusTargetTrackingChart.d.ts +9 -0
- package/dist/serverGroup/details/scalingPolicy/targetTracking/UpsertTargetTrackingModal.d.ts +10 -0
- package/dist/serverGroup/details/scalingPolicy/titusCustomScalingPolicy.component.d.ts +1 -0
- package/dist/serverGroup/details/scalingPolicy/upsert/TitusScalingPolicyCommandBuilderService.d.ts +10 -0
- package/dist/serverGroup/details/scalingPolicy/upsert/UpsertScalingPolicyModal.d.ts +10 -0
- package/dist/serverGroup/details/sections/ITitusServerGroupDetailsSectionProps.d.ts +5 -0
- package/dist/serverGroup/details/serverGroupDetails.titus.controller.d.ts +2 -0
- package/dist/serverGroup/details/serviceJobProcesses/ServiceJobProcesses.d.ts +3 -0
- package/dist/serverGroup/details/serviceJobProcesses/ServiceJobProcessesSection.d.ts +7 -0
- package/dist/serverGroup/details/titusPackageDetailsSection.component.d.ts +1 -0
- package/dist/serverGroup/details/titusSecurityGroups.component.d.ts +1 -0
- package/dist/serverGroup/serverGroup.transformer.d.ts +2 -0
- package/dist/titus.module.d.ts +5 -0
- package/dist/titus.settings.d.ts +14 -0
- package/dist/validation/ApplicationNameValidator.d.ts +1 -0
- package/package.json +52 -0
- package/src/domain/IJobDisruptionBudget.ts +19 -0
- package/src/domain/ITitusCredentials.ts +6 -0
- package/src/domain/ITitusInstance.ts +30 -0
- package/src/domain/ITitusScalingPolicy.ts +5 -0
- package/src/domain/ITitusServerGroup.ts +56 -0
- package/src/domain/ITitusServiceJobProcesses.ts +3 -0
- package/src/domain/index.ts +5 -0
- package/src/help/titus.help.ts +99 -0
- package/src/index.ts +6 -0
- package/src/instance/details/TitusInstanceDetails.tsx +234 -0
- package/src/instance/details/TitusInstanceDns.tsx +40 -0
- package/src/instance/details/TitusInstanceInformation.tsx +42 -0
- package/src/instance/details/index.ts +4 -0
- package/src/instance/details/titusInstanceDetailsUtils.spec.ts +124 -0
- package/src/instance/details/titusInstanceDetailsUtils.ts +181 -0
- package/src/logo/titus.logo.less +5 -0
- package/src/logo/titus.logo.png +0 -0
- package/src/logo/titus.logo.svg +7 -0
- package/src/pipeline/stages/cloneServerGroup/cloneServerGroupExecutionDetails.controller.js +66 -0
- package/src/pipeline/stages/cloneServerGroup/cloneServerGroupExecutionDetails.html +46 -0
- package/src/pipeline/stages/cloneServerGroup/cloneServerGroupStage.html +106 -0
- package/src/pipeline/stages/cloneServerGroup/cloneServerGroupStepLabel.html +1 -0
- package/src/pipeline/stages/cloneServerGroup/titusCloneServerGroupStage.js +104 -0
- package/src/pipeline/stages/destroyAsg/destroyAsgStage.html +9 -0
- package/src/pipeline/stages/destroyAsg/destroyAsgStepLabel.html +1 -0
- package/src/pipeline/stages/destroyAsg/titusDestroyAsgStage.js +65 -0
- package/src/pipeline/stages/disableAsg/disableAsgStage.html +11 -0
- package/src/pipeline/stages/disableAsg/disableAsgStepLabel.html +1 -0
- package/src/pipeline/stages/disableAsg/titusDisableAsgStage.js +69 -0
- package/src/pipeline/stages/disableCluster/disableClusterStage.html +26 -0
- package/src/pipeline/stages/disableCluster/titusDisableClusterStage.js +85 -0
- package/src/pipeline/stages/enableAsg/enableAsgStage.html +11 -0
- package/src/pipeline/stages/enableAsg/enableAsgStepLabel.html +1 -0
- package/src/pipeline/stages/enableAsg/titusEnableAsgStage.js +73 -0
- package/src/pipeline/stages/findAmi/findAmiStage.html +24 -0
- package/src/pipeline/stages/findAmi/titusFindAmiStage.js +79 -0
- package/src/pipeline/stages/resizeAsg/resizeAsgStage.html +99 -0
- package/src/pipeline/stages/resizeAsg/resizeAsgStepLabel.html +1 -0
- package/src/pipeline/stages/resizeAsg/titusResizeAsgStage.js +125 -0
- package/src/pipeline/stages/runJob/RunJobExecutionDetails.tsx +165 -0
- package/src/pipeline/stages/runJob/TitusRunJobStageConfig.tsx +466 -0
- package/src/pipeline/stages/runJob/TitusSecurityGroupPicker.tsx +170 -0
- package/src/pipeline/stages/runJob/titusRunJobStage.ts +30 -0
- package/src/pipeline/stages/scaleDownCluster/scaleDownClusterStage.html +35 -0
- package/src/pipeline/stages/scaleDownCluster/titusScaleDownClusterStage.js +79 -0
- package/src/pipeline/stages/shrinkCluster/shrinkClusterStage.html +34 -0
- package/src/pipeline/stages/shrinkCluster/titusShrinkClusterStage.js +73 -0
- package/src/reactShims/index.ts +1 -0
- package/src/reactShims/titus.react.injector.ts +17 -0
- package/src/reactShims/titus.react.module.ts +10 -0
- package/src/securityGroup/securityGroup.read.service.js +15 -0
- package/src/serverGroup/configure/ServerGroupCommandBuilder.js +247 -0
- package/src/serverGroup/configure/serverGroup.configure.titus.module.js +9 -0
- package/src/serverGroup/configure/serverGroupCommandBuilder.spec.js +63 -0
- package/src/serverGroup/configure/serverGroupConfiguration.service.ts +410 -0
- package/src/serverGroup/configure/wizard/TitusCloneServerGroupModal.tsx +293 -0
- package/src/serverGroup/configure/wizard/pages/ServerGroupBasicSettings.tsx +339 -0
- package/src/serverGroup/configure/wizard/pages/ServerGroupParameters.less +5 -0
- package/src/serverGroup/configure/wizard/pages/ServerGroupParameters.tsx +217 -0
- package/src/serverGroup/configure/wizard/pages/ServerGroupResources.tsx +200 -0
- package/src/serverGroup/configure/wizard/pages/TitusMapLayout.less +3 -0
- package/src/serverGroup/configure/wizard/pages/TitusMapLayout.tsx +29 -0
- package/src/serverGroup/configure/wizard/pages/disruptionBudget/JobDisruptionBudget.tsx +285 -0
- package/src/serverGroup/configure/wizard/pages/disruptionBudget/PolicyOptions.tsx +112 -0
- package/src/serverGroup/configure/wizard/pages/disruptionBudget/RateOptions.tsx +89 -0
- package/src/serverGroup/configure/wizard/pages/disruptionBudget/WindowPicker.tsx +202 -0
- package/src/serverGroup/configure/wizard/pages/index.ts +4 -0
- package/src/serverGroup/details/TitusCapacityDetailsSection.tsx +66 -0
- package/src/serverGroup/details/TitusLaunchConfigSection.tsx +35 -0
- package/src/serverGroup/details/TitusPackageDetailsSection.tsx +40 -0
- package/src/serverGroup/details/TitusSecurityGroups.tsx +107 -0
- package/src/serverGroup/details/capacityDetailsSection.component.ts +12 -0
- package/src/serverGroup/details/disruptionBudget/DisruptionBudgetSection.tsx +226 -0
- package/src/serverGroup/details/disruptionBudget/EditDisruptionBudgetModal.tsx +92 -0
- package/src/serverGroup/details/index.ts +5 -0
- package/src/serverGroup/details/launchConfigSection.component.ts +12 -0
- package/src/serverGroup/details/resize/TitusResizeServerGroupModal.tsx +302 -0
- package/src/serverGroup/details/resize/useTaskMonitor.ts +30 -0
- package/src/serverGroup/details/rollback/rollbackServerGroup.controller.js +149 -0
- package/src/serverGroup/details/rollback/rollbackServerGroup.html +133 -0
- package/src/serverGroup/details/scalingActivity/TitusScalingActivitiesModal.tsx +81 -0
- package/src/serverGroup/details/scalingPolicy/CreateScalingPolicyButton.tsx +102 -0
- package/src/serverGroup/details/scalingPolicy/TitusCustomScalingPolicy.tsx +13 -0
- package/src/serverGroup/details/scalingPolicy/createScalingPolicyButton.component.ts +15 -0
- package/src/serverGroup/details/scalingPolicy/index.js +3 -0
- package/src/serverGroup/details/scalingPolicy/scalingPolicy.module.ts +7 -0
- package/src/serverGroup/details/scalingPolicy/targetTracking/TitusTargetTrackingChart.tsx +57 -0
- package/src/serverGroup/details/scalingPolicy/targetTracking/UpsertTargetTrackingModal.tsx +82 -0
- package/src/serverGroup/details/scalingPolicy/titusCustomScalingPolicy.component.ts +17 -0
- package/src/serverGroup/details/scalingPolicy/upsert/TitusScalingPolicyCommandBuilderService.ts +115 -0
- package/src/serverGroup/details/scalingPolicy/upsert/UpsertScalingPolicyModal.tsx +157 -0
- package/src/serverGroup/details/sections/ITitusServerGroupDetailsSectionProps.ts +6 -0
- package/src/serverGroup/details/serverGroupDetails.html +191 -0
- package/src/serverGroup/details/serverGroupDetails.titus.controller.js +457 -0
- package/src/serverGroup/details/serviceJobProcesses/ServiceJobProcesses.ts +12 -0
- package/src/serverGroup/details/serviceJobProcesses/ServiceJobProcessesSection.tsx +136 -0
- package/src/serverGroup/details/titusPackageDetailsSection.component.ts +12 -0
- package/src/serverGroup/details/titusSecurityGroups.component.ts +12 -0
- package/src/serverGroup/serverGroup.transformer.js +90 -0
- package/src/titus.module.ts +95 -0
- package/src/titus.settings.ts +22 -0
- package/src/validation/ApplicationNameValidator.ts +43 -0
package/src/serverGroup/details/scalingPolicy/upsert/TitusScalingPolicyCommandBuilderService.ts
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { cloneDeep } from 'lodash';
|
|
2
|
+
|
|
3
|
+
import type {
|
|
4
|
+
IScalingPolicy,
|
|
5
|
+
IScalingPolicyAlarmView,
|
|
6
|
+
IStepAdjustment,
|
|
7
|
+
IStepPolicyDescription,
|
|
8
|
+
ITargetTrackingPolicy,
|
|
9
|
+
IUpsertAlarmDescription,
|
|
10
|
+
IUpsertScalingPolicyCommand,
|
|
11
|
+
} from '@spinnaker/amazon';
|
|
12
|
+
import type { ITitusServerGroup } from '../../../../domain';
|
|
13
|
+
|
|
14
|
+
type PolicyType = 'Step' | 'TargetTracking';
|
|
15
|
+
|
|
16
|
+
export const TitusScalingPolicyCommandBuilder = {
|
|
17
|
+
buildAlarm: (policy: IScalingPolicy, region: string): IUpsertAlarmDescription => {
|
|
18
|
+
const alarm = policy?.alarms[0] as IScalingPolicyAlarmView;
|
|
19
|
+
return {
|
|
20
|
+
comparisonOperator: alarm.comparisonOperator,
|
|
21
|
+
region,
|
|
22
|
+
dimensions: alarm.dimensions,
|
|
23
|
+
disableEditingDimensions: alarm.disableEditingDimensions,
|
|
24
|
+
evaluationPeriods: alarm.evaluationPeriods,
|
|
25
|
+
metricName: alarm.metricName,
|
|
26
|
+
namespace: alarm.namespace,
|
|
27
|
+
period: alarm.period,
|
|
28
|
+
statistic: alarm.statistic,
|
|
29
|
+
threshold: alarm.threshold,
|
|
30
|
+
unit: alarm.unit,
|
|
31
|
+
} as IUpsertAlarmDescription;
|
|
32
|
+
},
|
|
33
|
+
|
|
34
|
+
buildStepPolicy: (policy: IScalingPolicy, threshold: number, cooldown: number): IStepPolicyDescription => {
|
|
35
|
+
const stepAdjustments = policy.stepAdjustments.map((adjustment) => {
|
|
36
|
+
const step = {
|
|
37
|
+
scalingAdjustment: Math.abs(adjustment.scalingAdjustment),
|
|
38
|
+
} as IStepAdjustment;
|
|
39
|
+
|
|
40
|
+
if (adjustment.metricIntervalUpperBound !== undefined) {
|
|
41
|
+
step.metricIntervalUpperBound = adjustment.metricIntervalUpperBound + threshold;
|
|
42
|
+
}
|
|
43
|
+
if (adjustment.metricIntervalLowerBound !== undefined) {
|
|
44
|
+
step.metricIntervalLowerBound = adjustment.metricIntervalLowerBound + threshold;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return step;
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
cooldown: cooldown || 600,
|
|
52
|
+
estimatedInstanceWarmup: null,
|
|
53
|
+
metricAggregationType: 'Average',
|
|
54
|
+
stepAdjustments,
|
|
55
|
+
};
|
|
56
|
+
},
|
|
57
|
+
|
|
58
|
+
buildNewCommand: (
|
|
59
|
+
type: PolicyType,
|
|
60
|
+
serverGroup: ITitusServerGroup,
|
|
61
|
+
policy: ITargetTrackingPolicy,
|
|
62
|
+
): IUpsertScalingPolicyCommand => {
|
|
63
|
+
const command = {
|
|
64
|
+
adjustmentType: type === 'Step' ? policy.adjustmentType : null,
|
|
65
|
+
cloudProvider: serverGroup.cloudProvider,
|
|
66
|
+
credentials: serverGroup.account,
|
|
67
|
+
jobId: serverGroup.id,
|
|
68
|
+
name: policy.id,
|
|
69
|
+
region: serverGroup.region,
|
|
70
|
+
scalingPolicyID: policy.id,
|
|
71
|
+
serverGroupName: serverGroup.name,
|
|
72
|
+
} as IUpsertScalingPolicyCommand;
|
|
73
|
+
|
|
74
|
+
if (type === 'Step') {
|
|
75
|
+
command.alarm = TitusScalingPolicyCommandBuilder.buildAlarm(policy, serverGroup.region);
|
|
76
|
+
command.minAdjustmentMagnitude = policy.minAdjustmentMagnitude || 1;
|
|
77
|
+
command.step = TitusScalingPolicyCommandBuilder.buildStepPolicy(policy, command.alarm.threshold, policy.cooldown);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (type === 'TargetTracking') {
|
|
81
|
+
command.targetTrackingConfiguration = { ...policy.targetTrackingConfiguration };
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return command;
|
|
85
|
+
},
|
|
86
|
+
|
|
87
|
+
prepareCommandForUpsert: (command: IUpsertScalingPolicyCommand, isRemove: boolean): IUpsertScalingPolicyCommand => {
|
|
88
|
+
const commandToSubmit = cloneDeep(command);
|
|
89
|
+
|
|
90
|
+
if (commandToSubmit.adjustmentType !== 'PercentChangeInCapacity') {
|
|
91
|
+
delete commandToSubmit.minAdjustmentMagnitude;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (commandToSubmit.step) {
|
|
95
|
+
// adjust metricIntervalLowerBound/UpperBound for each step based on alarm threshold
|
|
96
|
+
commandToSubmit.step.stepAdjustments.forEach((step) => {
|
|
97
|
+
if (isRemove) {
|
|
98
|
+
step.scalingAdjustment = 0 - step.scalingAdjustment;
|
|
99
|
+
delete commandToSubmit.step.estimatedInstanceWarmup;
|
|
100
|
+
}
|
|
101
|
+
if (step.metricIntervalLowerBound !== undefined) {
|
|
102
|
+
step.metricIntervalLowerBound -= commandToSubmit.alarm.threshold;
|
|
103
|
+
}
|
|
104
|
+
if (step.metricIntervalUpperBound !== undefined) {
|
|
105
|
+
step.metricIntervalUpperBound -= commandToSubmit.alarm.threshold;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
} else {
|
|
109
|
+
if (isRemove) {
|
|
110
|
+
command.simple.scalingAdjustment = 0 - command.simple.scalingAdjustment;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
return commandToSubmit;
|
|
114
|
+
},
|
|
115
|
+
};
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { cloneDeep } from 'lodash';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
|
|
4
|
+
import type {
|
|
5
|
+
IScalingPolicy,
|
|
6
|
+
IStepAdjustment,
|
|
7
|
+
IStepPolicyDescription,
|
|
8
|
+
ITargetTrackingPolicy,
|
|
9
|
+
IUpsertScalingPolicyCommand,
|
|
10
|
+
} from '@spinnaker/amazon';
|
|
11
|
+
import { AlarmConfigurer, ScalingPolicyAdditionalSettings, StepPolicyAction } from '@spinnaker/amazon';
|
|
12
|
+
import type { IAmazonServerGroup, IScalingPolicyAlarm } from '@spinnaker/amazon/src/domain';
|
|
13
|
+
import type { Application, IModalComponentProps } from '@spinnaker/core';
|
|
14
|
+
import { TaskMonitorModal } from '@spinnaker/core';
|
|
15
|
+
|
|
16
|
+
import { TitusScalingPolicyCommandBuilder } from './TitusScalingPolicyCommandBuilderService';
|
|
17
|
+
import type { ITitusServerGroup } from '../../../../domain';
|
|
18
|
+
|
|
19
|
+
type Operator = 'Add' | 'Remove' | 'Set to';
|
|
20
|
+
type AdjustmentTypeView = 'instances' | 'percent of group';
|
|
21
|
+
|
|
22
|
+
export interface IUpsertScalingPolicyModalProps extends IModalComponentProps {
|
|
23
|
+
app: Application;
|
|
24
|
+
policy: IScalingPolicy;
|
|
25
|
+
serverGroup: ITitusServerGroup;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const UpsertScalingPolicyModal = ({
|
|
29
|
+
app,
|
|
30
|
+
closeModal,
|
|
31
|
+
dismissModal,
|
|
32
|
+
policy,
|
|
33
|
+
serverGroup,
|
|
34
|
+
}: IUpsertScalingPolicyModalProps) => {
|
|
35
|
+
const [command, setCommand] = React.useState<IUpsertScalingPolicyCommand>({} as IUpsertScalingPolicyCommand);
|
|
36
|
+
React.useEffect(() => {
|
|
37
|
+
const baseCommand = TitusScalingPolicyCommandBuilder.buildNewCommand(
|
|
38
|
+
'Step',
|
|
39
|
+
serverGroup,
|
|
40
|
+
policy as ITargetTrackingPolicy,
|
|
41
|
+
);
|
|
42
|
+
setCommand(baseCommand);
|
|
43
|
+
}, []);
|
|
44
|
+
|
|
45
|
+
const adjustmentBasis = policy.stepAdjustments?.length
|
|
46
|
+
? policy.stepAdjustments[0].scalingAdjustment
|
|
47
|
+
: policy.scalingAdjustment;
|
|
48
|
+
const [action, setAction] = React.useState<Operator>(
|
|
49
|
+
command.adjustmentType === 'ExactCapacity' ? 'Set to' : adjustmentBasis > 0 ? 'Add' : 'Remove',
|
|
50
|
+
);
|
|
51
|
+
const adjustmentTypeView =
|
|
52
|
+
command.adjustmentType === 'ExactCapacity' || command.adjustmentType === 'ChangeInCapacity'
|
|
53
|
+
? 'instances'
|
|
54
|
+
: 'percent of group';
|
|
55
|
+
|
|
56
|
+
const mode = !policy.id ? 'Create' : 'Edit';
|
|
57
|
+
const comparatorBound = command?.alarm?.comparisonOperator?.indexOf('Greater') === 0 ? 'max' : 'min';
|
|
58
|
+
|
|
59
|
+
const boundsChanged = (step: IStepPolicyDescription) => {
|
|
60
|
+
const source = comparatorBound === 'min' ? 'metricIntervalLowerBound' : 'metricIntervalUpperBound';
|
|
61
|
+
const target = source === 'metricIntervalLowerBound' ? 'metricIntervalUpperBound' : 'metricIntervalLowerBound';
|
|
62
|
+
|
|
63
|
+
const adjustments = step.stepAdjustments;
|
|
64
|
+
(adjustments || []).forEach((a, index) => {
|
|
65
|
+
if (adjustments.length > index + 1) {
|
|
66
|
+
adjustments[index + 1][target] = a[source];
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
// Remove the source boundary from the last step
|
|
70
|
+
delete adjustments[adjustments.length - 1][source];
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const stepsChanged = (newSteps: IStepAdjustment[]) => {
|
|
74
|
+
const newCommand = cloneDeep(command);
|
|
75
|
+
newCommand.step.stepAdjustments = newSteps;
|
|
76
|
+
boundsChanged(newCommand.step);
|
|
77
|
+
setCommand(newCommand);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const adjustmentTypeChanged = (action: Operator, type: AdjustmentTypeView) => {
|
|
81
|
+
setAction(action);
|
|
82
|
+
|
|
83
|
+
const newType =
|
|
84
|
+
type !== 'instances' ? 'PercentChangeInCapacity' : action === 'Set to' ? 'ExactCapacity' : 'ChangeInCapacity';
|
|
85
|
+
setCommand({
|
|
86
|
+
...command,
|
|
87
|
+
adjustmentType: newType,
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<TaskMonitorModal<IUpsertScalingPolicyCommand>
|
|
93
|
+
closeModal={closeModal}
|
|
94
|
+
dismissModal={dismissModal}
|
|
95
|
+
title={`${mode} scaling policy`}
|
|
96
|
+
application={app}
|
|
97
|
+
description={`${mode} scaling policy for ${serverGroup.name}`}
|
|
98
|
+
initialValues={command}
|
|
99
|
+
mapValuesToTask={() => {
|
|
100
|
+
const preppedValues = TitusScalingPolicyCommandBuilder.prepareCommandForUpsert(command, action === 'Remove');
|
|
101
|
+
return {
|
|
102
|
+
application: app,
|
|
103
|
+
job: [
|
|
104
|
+
{
|
|
105
|
+
type: preppedValues.type || 'upsertScalingPolicy',
|
|
106
|
+
...preppedValues,
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
};
|
|
110
|
+
}}
|
|
111
|
+
render={() => (
|
|
112
|
+
<div>
|
|
113
|
+
<h4 className="section-heading">Conditions</h4>
|
|
114
|
+
<div className="section-body">
|
|
115
|
+
<p>
|
|
116
|
+
<b>Note:</b> metrics must be sent to Amazon CloudWatch before they can be used in auto scaling. If you do
|
|
117
|
+
not see a metric below, click "Configure available metrics" in the server group details to set up
|
|
118
|
+
forwarding from Atlas to CloudWatch.
|
|
119
|
+
</p>
|
|
120
|
+
<AlarmConfigurer
|
|
121
|
+
alarm={command.alarm}
|
|
122
|
+
multipleAlarms={Boolean(policy?.alarms?.length > 1)}
|
|
123
|
+
serverGroup={(serverGroup as unknown) as IAmazonServerGroup}
|
|
124
|
+
stepAdjustments={command.step.stepAdjustments}
|
|
125
|
+
stepsChanged={stepsChanged}
|
|
126
|
+
updateAlarm={(alarm: IScalingPolicyAlarm) =>
|
|
127
|
+
setCommand({ ...command, alarm } as IUpsertScalingPolicyCommand)
|
|
128
|
+
}
|
|
129
|
+
/>
|
|
130
|
+
</div>
|
|
131
|
+
<h4 className="section-heading">Actions</h4>
|
|
132
|
+
<div className="section-body">
|
|
133
|
+
{!command.alarm?.metricName && <h4 className="text-center">Select a metric</h4>}
|
|
134
|
+
{command.alarm?.metricName && (
|
|
135
|
+
<StepPolicyAction
|
|
136
|
+
adjustmentType={adjustmentTypeView}
|
|
137
|
+
adjustmentTypeChanged={adjustmentTypeChanged}
|
|
138
|
+
alarm={command.alarm}
|
|
139
|
+
isMin={comparatorBound === 'min'}
|
|
140
|
+
operator={action}
|
|
141
|
+
step={command.step}
|
|
142
|
+
stepsChanged={stepsChanged}
|
|
143
|
+
/>
|
|
144
|
+
)}
|
|
145
|
+
</div>
|
|
146
|
+
<ScalingPolicyAdditionalSettings
|
|
147
|
+
command={command}
|
|
148
|
+
isInstanceType={adjustmentTypeView === 'instances'}
|
|
149
|
+
isNew={Boolean(!policy.policyARN)}
|
|
150
|
+
operator={action}
|
|
151
|
+
updateCommand={setCommand}
|
|
152
|
+
/>
|
|
153
|
+
</div>
|
|
154
|
+
)}
|
|
155
|
+
/>
|
|
156
|
+
);
|
|
157
|
+
};
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
<div class="details-panel" ng-class="{ disabled: serverGroup.isDisabled }">
|
|
2
|
+
<div class="header" ng-if="state.loading">
|
|
3
|
+
<div class="close-button">
|
|
4
|
+
<a class="btn btn-link" ui-sref="^">
|
|
5
|
+
<span class="glyphicon glyphicon-remove"></span>
|
|
6
|
+
</a>
|
|
7
|
+
</div>
|
|
8
|
+
<h4 class="text-center">
|
|
9
|
+
<span us-spinner="{radius:20, width:6, length: 12}"></span>
|
|
10
|
+
</h4>
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
<div class="header" ng-if="!state.loading">
|
|
14
|
+
<div class="close-button">
|
|
15
|
+
<a class="btn btn-link" ui-sref="^">
|
|
16
|
+
<span class="glyphicon glyphicon-remove"></span>
|
|
17
|
+
</a>
|
|
18
|
+
</div>
|
|
19
|
+
<div class="header-text horizontal middle">
|
|
20
|
+
<cloud-provider-logo provider="serverGroup.type" height="'36px'" width="'36px'"></cloud-provider-logo>
|
|
21
|
+
<h3 class="horizontal middle space-between flex-1" select-on-dbl-click>
|
|
22
|
+
{{serverGroup.name}}
|
|
23
|
+
<render-if-feature feature="entityTags">
|
|
24
|
+
<entity-notifications
|
|
25
|
+
entity="serverGroup"
|
|
26
|
+
application="ctrl.application"
|
|
27
|
+
placement="bottom"
|
|
28
|
+
h-offset-percent="90%"
|
|
29
|
+
entity-type="serverGroup"
|
|
30
|
+
page-location="details"
|
|
31
|
+
on-update="ctrl.application.serverGroups.refresh()"
|
|
32
|
+
></entity-notifications>
|
|
33
|
+
</render-if-feature>
|
|
34
|
+
</h3>
|
|
35
|
+
</div>
|
|
36
|
+
<div>
|
|
37
|
+
<div class="actions" ng-class="{ insights: serverGroup.insightActions.length > 0 }">
|
|
38
|
+
<div class="dropdown" uib-dropdown dropdown-append-to-body>
|
|
39
|
+
<button type="button" class="btn btn-sm btn-primary dropdown-toggle" uib-dropdown-toggle>
|
|
40
|
+
Server Group Actions <span class="caret"></span>
|
|
41
|
+
</button>
|
|
42
|
+
<ul class="dropdown-menu" uib-dropdown-menu role="menu">
|
|
43
|
+
<li><a href ng-if="ctrl.isRollbackEnabled()" ng-click="ctrl.rollbackServerGroup()">Rollback</a></li>
|
|
44
|
+
<li role="presentation" class="divider" ng-if="ctrl.isRollbackEnabled()"></li>
|
|
45
|
+
<li><a href ng-click="ctrl.resizeServerGroup()">Resize</a></li>
|
|
46
|
+
<li><a href ng-if="!serverGroup.isDisabled" ng-click="ctrl.disableServerGroup()">Disable</a></li>
|
|
47
|
+
<li><a href ng-if="serverGroup.isDisabled" ng-click="ctrl.enableServerGroup()">Enable</a></li>
|
|
48
|
+
<li><a href ng-click="ctrl.destroyServerGroup()">Destroy</a></li>
|
|
49
|
+
<li><a href ng-click="ctrl.cloneServerGroup()">Clone</a></li>
|
|
50
|
+
<add-entity-tag-links
|
|
51
|
+
component="serverGroup"
|
|
52
|
+
application="ctrl.application"
|
|
53
|
+
entity-type="serverGroup"
|
|
54
|
+
owner-options="ctrl.entityTagTargets"
|
|
55
|
+
on-update="ctrl.application.serverGroups.refresh"
|
|
56
|
+
></add-entity-tag-links>
|
|
57
|
+
</ul>
|
|
58
|
+
</div>
|
|
59
|
+
<div class="dropdown" ng-if="serverGroup.insightActions.length > 0" uib-dropdown dropdown-append-to-body>
|
|
60
|
+
<button type="button" class="btn btn-sm btn-default dropdown-toggle" uib-dropdown-toggle>
|
|
61
|
+
Insight <span class="caret"></span>
|
|
62
|
+
</button>
|
|
63
|
+
<ul class="dropdown-menu" uib-dropdown-menu role="menu">
|
|
64
|
+
<li
|
|
65
|
+
ng-repeat="action in serverGroup.insightActions"
|
|
66
|
+
analytics-on="click"
|
|
67
|
+
analytics-category="Insight Menu (Server Group)"
|
|
68
|
+
analytics-event="{{action.label}} clicked"
|
|
69
|
+
analytics-label="{{serverGroup.account}}/{{serverGroup.region}}/{{serverGroup.name}}"
|
|
70
|
+
>
|
|
71
|
+
<a target="_blank" href="{{action.url}}">{{action.label}}</a>
|
|
72
|
+
</li>
|
|
73
|
+
</ul>
|
|
74
|
+
</div>
|
|
75
|
+
<div class="clearfix"></div>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
<div class="content" ng-if="!state.loading">
|
|
80
|
+
<div class="band band-info" ng-if="serverGroup.isDisabled">Job is Disabled</div>
|
|
81
|
+
<managed-resource-details-indicator
|
|
82
|
+
ng-if="!state.loading && serverGroup.isManaged"
|
|
83
|
+
resource-summary="serverGroup.managedResourceSummary"
|
|
84
|
+
application="ctrl.application"
|
|
85
|
+
></managed-resource-details-indicator>
|
|
86
|
+
<server-group-running-tasks-details
|
|
87
|
+
server-group="serverGroup"
|
|
88
|
+
application="ctrl.application"
|
|
89
|
+
></server-group-running-tasks-details>
|
|
90
|
+
<collapsible-section heading="Server Group Information" expanded="true">
|
|
91
|
+
<dl class="dl-horizontal dl-narrow">
|
|
92
|
+
<dt>Created</dt>
|
|
93
|
+
<dd>{{serverGroup.createdTime | timestamp}}</dd>
|
|
94
|
+
<dt>In</dt>
|
|
95
|
+
<dd>
|
|
96
|
+
<account-tag account="serverGroup.account" pad="right"></account-tag>
|
|
97
|
+
{{serverGroup.region}}
|
|
98
|
+
</dd>
|
|
99
|
+
<dt>Job Id</dt>
|
|
100
|
+
<dd><a href="{{titusUiEndpoint}}jobs/{{serverGroup.id}}" target="_blank">{{serverGroup.id}}</a></dd>
|
|
101
|
+
<entity-source metadata="serverGroup.entityTags.creationMetadata"></entity-source>
|
|
102
|
+
</dl>
|
|
103
|
+
</collapsible-section>
|
|
104
|
+
<collapsible-section heading="Capacity" expanded="true">
|
|
105
|
+
<titus-capacity-details-section
|
|
106
|
+
app="ctrl.application"
|
|
107
|
+
server-group="serverGroup"
|
|
108
|
+
></titus-capacity-details-section>
|
|
109
|
+
</collapsible-section>
|
|
110
|
+
<collapsible-section heading="Health" expanded="true" ng-if="serverGroup.instanceCounts.total > 0">
|
|
111
|
+
<dl class="dl-horizontal dl-narrow" ng-if="serverGroup">
|
|
112
|
+
<dt>Tasks</dt>
|
|
113
|
+
<dd>
|
|
114
|
+
<health-counts container="serverGroup.instanceCounts" class="pull-left"></health-counts>
|
|
115
|
+
</dd>
|
|
116
|
+
</dl>
|
|
117
|
+
</collapsible-section>
|
|
118
|
+
<collapsible-section heading="Launch Configuration">
|
|
119
|
+
<titus-launch-config-section server-group="serverGroup"></titus-launch-config-section>
|
|
120
|
+
</collapsible-section>
|
|
121
|
+
|
|
122
|
+
<titus-security-groups
|
|
123
|
+
app="ctrl.application"
|
|
124
|
+
server-group="serverGroup"
|
|
125
|
+
class="collapsible-section"
|
|
126
|
+
style="display: block"
|
|
127
|
+
></titus-security-groups>
|
|
128
|
+
|
|
129
|
+
<collapsible-section heading="Service Job Processes">
|
|
130
|
+
<titus-service-job-processes-section
|
|
131
|
+
app="ctrl.application"
|
|
132
|
+
server-group="serverGroup"
|
|
133
|
+
></titus-service-job-processes-section>
|
|
134
|
+
</collapsible-section>
|
|
135
|
+
|
|
136
|
+
<collapsible-section heading="Scaling Policies">
|
|
137
|
+
<scaling-policy-summary
|
|
138
|
+
ng-repeat="policy in serverGroup.scalingPolicies"
|
|
139
|
+
policy="policy"
|
|
140
|
+
server-group="serverGroup"
|
|
141
|
+
application="ctrl.application"
|
|
142
|
+
></scaling-policy-summary>
|
|
143
|
+
<titus-create-scaling-policy-button
|
|
144
|
+
server-group="serverGroup"
|
|
145
|
+
application="ctrl.application"
|
|
146
|
+
></titus-create-scaling-policy-button>
|
|
147
|
+
<div ng-if="ctrl.awsAccountId">
|
|
148
|
+
<config-bin-link
|
|
149
|
+
application="ctrl.application"
|
|
150
|
+
aws-account-id="ctrl.awsAccountId"
|
|
151
|
+
cluster-name="serverGroup.cluster"
|
|
152
|
+
region="serverGroup.region"
|
|
153
|
+
env="ctrl.env"
|
|
154
|
+
cloud-provider="'titus'"
|
|
155
|
+
></config-bin-link>
|
|
156
|
+
</div>
|
|
157
|
+
<titus-custom-scaling-policy
|
|
158
|
+
application="ctrl.application"
|
|
159
|
+
server-group="serverGroup"
|
|
160
|
+
></titus-custom-scaling-policy>
|
|
161
|
+
</collapsible-section>
|
|
162
|
+
<titus-package-details-section build-info="buildInfo"></titus-package-details-section>
|
|
163
|
+
<collapsible-section heading="Job Disruption Budget">
|
|
164
|
+
<titus-disruption-budget-section
|
|
165
|
+
app="ctrl.application"
|
|
166
|
+
server-group="serverGroup"
|
|
167
|
+
></titus-disruption-budget-section>
|
|
168
|
+
</collapsible-section>
|
|
169
|
+
<collapsible-section heading="Job Attributes">
|
|
170
|
+
<div ng-if="!serverGroup.labels">No job attributes associated with this server group</div>
|
|
171
|
+
<dl ng-if="labels">
|
|
172
|
+
<dt ng-repeat-start="(key, val) in labels">{{key}}</dt>
|
|
173
|
+
<dd ng-repeat-end>{{val}}</dd>
|
|
174
|
+
</dl>
|
|
175
|
+
</collapsible-section>
|
|
176
|
+
<collapsible-section heading="Container Attributes">
|
|
177
|
+
<div ng-if="!serverGroup.containerAttributes">No container attributes associated with this server group</div>
|
|
178
|
+
<dl ng-if="serverGroup.containerAttributes">
|
|
179
|
+
<dt ng-repeat-start="(key, val) in serverGroup.containerAttributes">{{key}}</dt>
|
|
180
|
+
<dd ng-repeat-end>{{val}}</dd>
|
|
181
|
+
</dl>
|
|
182
|
+
</collapsible-section>
|
|
183
|
+
<collapsible-section heading="Environment Variables">
|
|
184
|
+
<div ng-if="!serverGroup.env">No environment variables associated with this server group</div>
|
|
185
|
+
<dl ng-if="serverGroup.env">
|
|
186
|
+
<dt ng-repeat-start="(key, val) in serverGroup.env">{{key}}</dt>
|
|
187
|
+
<dd ng-repeat-end>{{val}}</dd>
|
|
188
|
+
</dl>
|
|
189
|
+
</collapsible-section>
|
|
190
|
+
</div>
|
|
191
|
+
</div>
|