@spinnaker/titus 0.0.0-2025.1-0

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.
Files changed (185) hide show
  1. package/CHANGELOG.md +2661 -0
  2. package/LICENSE.txt +203 -0
  3. package/dist/domain/IJobDisruptionBudget.d.ts +35 -0
  4. package/dist/domain/ITitusCredentials.d.ts +5 -0
  5. package/dist/domain/ITitusInstance.d.ts +28 -0
  6. package/dist/domain/ITitusScalingPolicy.d.ts +4 -0
  7. package/dist/domain/ITitusServerGroup.d.ts +52 -0
  8. package/dist/domain/ITitusServiceJobProcesses.d.ts +3 -0
  9. package/dist/domain/index.d.ts +5 -0
  10. package/dist/help/titus.help.d.ts +1 -0
  11. package/dist/index.d.ts +6 -0
  12. package/dist/index.js +12828 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/instance/details/TitusInstanceDetails.d.ts +25 -0
  15. package/dist/instance/details/TitusInstanceDns.d.ts +8 -0
  16. package/dist/instance/details/TitusInstanceInformation.d.ts +7 -0
  17. package/dist/instance/details/index.d.ts +4 -0
  18. package/dist/instance/details/titusInstanceDetailsUtils.d.ts +14 -0
  19. package/dist/pipeline/stages/cloneServerGroup/cloneServerGroupExecutionDetails.controller.d.ts +2 -0
  20. package/dist/pipeline/stages/cloneServerGroup/titusCloneServerGroupStage.d.ts +2 -0
  21. package/dist/pipeline/stages/destroyAsg/titusDestroyAsgStage.d.ts +2 -0
  22. package/dist/pipeline/stages/disableAsg/titusDisableAsgStage.d.ts +2 -0
  23. package/dist/pipeline/stages/disableCluster/titusDisableClusterStage.d.ts +2 -0
  24. package/dist/pipeline/stages/enableAsg/titusEnableAsgStage.d.ts +2 -0
  25. package/dist/pipeline/stages/findAmi/titusFindAmiStage.d.ts +2 -0
  26. package/dist/pipeline/stages/resizeAsg/titusResizeAsgStage.d.ts +2 -0
  27. package/dist/pipeline/stages/runJob/RunJobExecutionDetails.d.ts +16 -0
  28. package/dist/pipeline/stages/runJob/TitusRunJobStageConfig.d.ts +25 -0
  29. package/dist/pipeline/stages/runJob/TitusSecurityGroupPicker.d.ts +34 -0
  30. package/dist/pipeline/stages/runJob/titusRunJobStage.d.ts +1 -0
  31. package/dist/pipeline/stages/scaleDownCluster/titusScaleDownClusterStage.d.ts +2 -0
  32. package/dist/pipeline/stages/shrinkCluster/titusShrinkClusterStage.d.ts +2 -0
  33. package/dist/reactShims/index.d.ts +1 -0
  34. package/dist/reactShims/titus.react.injector.d.ts +11 -0
  35. package/dist/reactShims/titus.react.module.d.ts +1 -0
  36. package/dist/securityGroup/securityGroup.read.service.d.ts +2 -0
  37. package/dist/serverGroup/configure/ServerGroupCommandBuilder.d.ts +2 -0
  38. package/dist/serverGroup/configure/serverGroup.configure.titus.module.d.ts +2 -0
  39. package/dist/serverGroup/configure/serverGroupConfiguration.service.d.ts +89 -0
  40. package/dist/serverGroup/configure/wizard/TitusCloneServerGroupModal.d.ts +31 -0
  41. package/dist/serverGroup/configure/wizard/pages/ServerGroupBasicSettings.d.ts +28 -0
  42. package/dist/serverGroup/configure/wizard/pages/ServerGroupParameters.d.ts +15 -0
  43. package/dist/serverGroup/configure/wizard/pages/ServerGroupResources.d.ts +11 -0
  44. package/dist/serverGroup/configure/wizard/pages/TitusMapLayout.d.ts +4 -0
  45. package/dist/serverGroup/configure/wizard/pages/disruptionBudget/JobDisruptionBudget.d.ts +40 -0
  46. package/dist/serverGroup/configure/wizard/pages/disruptionBudget/PolicyOptions.d.ts +2 -0
  47. package/dist/serverGroup/configure/wizard/pages/disruptionBudget/RateOptions.d.ts +2 -0
  48. package/dist/serverGroup/configure/wizard/pages/disruptionBudget/WindowPicker.d.ts +23 -0
  49. package/dist/serverGroup/configure/wizard/pages/index.d.ts +4 -0
  50. package/dist/serverGroup/details/TitusCapacityDetailsSection.d.ts +11 -0
  51. package/dist/serverGroup/details/TitusLaunchConfigSection.d.ts +9 -0
  52. package/dist/serverGroup/details/TitusPackageDetailsSection.d.ts +6 -0
  53. package/dist/serverGroup/details/TitusSecurityGroups.d.ts +17 -0
  54. package/dist/serverGroup/details/capacityDetailsSection.component.d.ts +1 -0
  55. package/dist/serverGroup/details/disruptionBudget/DisruptionBudgetSection.d.ts +19 -0
  56. package/dist/serverGroup/details/disruptionBudget/EditDisruptionBudgetModal.d.ts +14 -0
  57. package/dist/serverGroup/details/index.d.ts +5 -0
  58. package/dist/serverGroup/details/launchConfigSection.component.d.ts +1 -0
  59. package/dist/serverGroup/details/resize/TitusResizeServerGroupModal.d.ts +8 -0
  60. package/dist/serverGroup/details/resize/useTaskMonitor.d.ts +25 -0
  61. package/dist/serverGroup/details/rollback/rollbackServerGroup.controller.d.ts +2 -0
  62. package/dist/serverGroup/details/scalingActivity/TitusScalingActivitiesModal.d.ts +7 -0
  63. package/dist/serverGroup/details/scalingPolicy/CreateScalingPolicyButton.d.ts +21 -0
  64. package/dist/serverGroup/details/scalingPolicy/TitusCustomScalingPolicy.d.ts +7 -0
  65. package/dist/serverGroup/details/scalingPolicy/createScalingPolicyButton.component.d.ts +1 -0
  66. package/dist/serverGroup/details/scalingPolicy/index.d.ts +3 -0
  67. package/dist/serverGroup/details/scalingPolicy/scalingPolicy.module.d.ts +1 -0
  68. package/dist/serverGroup/details/scalingPolicy/targetTracking/TitusTargetTrackingChart.d.ts +9 -0
  69. package/dist/serverGroup/details/scalingPolicy/targetTracking/UpsertTargetTrackingModal.d.ts +10 -0
  70. package/dist/serverGroup/details/scalingPolicy/titusCustomScalingPolicy.component.d.ts +1 -0
  71. package/dist/serverGroup/details/scalingPolicy/upsert/TitusScalingPolicyCommandBuilderService.d.ts +10 -0
  72. package/dist/serverGroup/details/scalingPolicy/upsert/UpsertScalingPolicyModal.d.ts +10 -0
  73. package/dist/serverGroup/details/sections/ITitusServerGroupDetailsSectionProps.d.ts +5 -0
  74. package/dist/serverGroup/details/serverGroupDetails.titus.controller.d.ts +2 -0
  75. package/dist/serverGroup/details/serviceJobProcesses/ServiceJobProcesses.d.ts +3 -0
  76. package/dist/serverGroup/details/serviceJobProcesses/ServiceJobProcessesSection.d.ts +7 -0
  77. package/dist/serverGroup/details/titusPackageDetailsSection.component.d.ts +1 -0
  78. package/dist/serverGroup/details/titusSecurityGroups.component.d.ts +1 -0
  79. package/dist/serverGroup/serverGroup.transformer.d.ts +2 -0
  80. package/dist/titus.module.d.ts +5 -0
  81. package/dist/titus.settings.d.ts +14 -0
  82. package/dist/validation/ApplicationNameValidator.d.ts +1 -0
  83. package/package.json +52 -0
  84. package/src/domain/IJobDisruptionBudget.ts +19 -0
  85. package/src/domain/ITitusCredentials.ts +6 -0
  86. package/src/domain/ITitusInstance.ts +30 -0
  87. package/src/domain/ITitusScalingPolicy.ts +5 -0
  88. package/src/domain/ITitusServerGroup.ts +56 -0
  89. package/src/domain/ITitusServiceJobProcesses.ts +3 -0
  90. package/src/domain/index.ts +5 -0
  91. package/src/help/titus.help.ts +99 -0
  92. package/src/index.ts +6 -0
  93. package/src/instance/details/TitusInstanceDetails.tsx +234 -0
  94. package/src/instance/details/TitusInstanceDns.tsx +40 -0
  95. package/src/instance/details/TitusInstanceInformation.tsx +42 -0
  96. package/src/instance/details/index.ts +4 -0
  97. package/src/instance/details/titusInstanceDetailsUtils.spec.ts +124 -0
  98. package/src/instance/details/titusInstanceDetailsUtils.ts +181 -0
  99. package/src/logo/titus.logo.less +5 -0
  100. package/src/logo/titus.logo.png +0 -0
  101. package/src/logo/titus.logo.svg +7 -0
  102. package/src/pipeline/stages/cloneServerGroup/cloneServerGroupExecutionDetails.controller.js +66 -0
  103. package/src/pipeline/stages/cloneServerGroup/cloneServerGroupExecutionDetails.html +46 -0
  104. package/src/pipeline/stages/cloneServerGroup/cloneServerGroupStage.html +106 -0
  105. package/src/pipeline/stages/cloneServerGroup/cloneServerGroupStepLabel.html +1 -0
  106. package/src/pipeline/stages/cloneServerGroup/titusCloneServerGroupStage.js +104 -0
  107. package/src/pipeline/stages/destroyAsg/destroyAsgStage.html +9 -0
  108. package/src/pipeline/stages/destroyAsg/destroyAsgStepLabel.html +1 -0
  109. package/src/pipeline/stages/destroyAsg/titusDestroyAsgStage.js +65 -0
  110. package/src/pipeline/stages/disableAsg/disableAsgStage.html +11 -0
  111. package/src/pipeline/stages/disableAsg/disableAsgStepLabel.html +1 -0
  112. package/src/pipeline/stages/disableAsg/titusDisableAsgStage.js +69 -0
  113. package/src/pipeline/stages/disableCluster/disableClusterStage.html +26 -0
  114. package/src/pipeline/stages/disableCluster/titusDisableClusterStage.js +85 -0
  115. package/src/pipeline/stages/enableAsg/enableAsgStage.html +11 -0
  116. package/src/pipeline/stages/enableAsg/enableAsgStepLabel.html +1 -0
  117. package/src/pipeline/stages/enableAsg/titusEnableAsgStage.js +73 -0
  118. package/src/pipeline/stages/findAmi/findAmiStage.html +24 -0
  119. package/src/pipeline/stages/findAmi/titusFindAmiStage.js +79 -0
  120. package/src/pipeline/stages/resizeAsg/resizeAsgStage.html +99 -0
  121. package/src/pipeline/stages/resizeAsg/resizeAsgStepLabel.html +1 -0
  122. package/src/pipeline/stages/resizeAsg/titusResizeAsgStage.js +125 -0
  123. package/src/pipeline/stages/runJob/RunJobExecutionDetails.tsx +165 -0
  124. package/src/pipeline/stages/runJob/TitusRunJobStageConfig.tsx +466 -0
  125. package/src/pipeline/stages/runJob/TitusSecurityGroupPicker.tsx +170 -0
  126. package/src/pipeline/stages/runJob/titusRunJobStage.ts +30 -0
  127. package/src/pipeline/stages/scaleDownCluster/scaleDownClusterStage.html +35 -0
  128. package/src/pipeline/stages/scaleDownCluster/titusScaleDownClusterStage.js +79 -0
  129. package/src/pipeline/stages/shrinkCluster/shrinkClusterStage.html +34 -0
  130. package/src/pipeline/stages/shrinkCluster/titusShrinkClusterStage.js +73 -0
  131. package/src/reactShims/index.ts +1 -0
  132. package/src/reactShims/titus.react.injector.ts +17 -0
  133. package/src/reactShims/titus.react.module.ts +10 -0
  134. package/src/securityGroup/securityGroup.read.service.js +15 -0
  135. package/src/serverGroup/configure/ServerGroupCommandBuilder.js +247 -0
  136. package/src/serverGroup/configure/serverGroup.configure.titus.module.js +9 -0
  137. package/src/serverGroup/configure/serverGroupCommandBuilder.spec.js +63 -0
  138. package/src/serverGroup/configure/serverGroupConfiguration.service.ts +410 -0
  139. package/src/serverGroup/configure/wizard/TitusCloneServerGroupModal.tsx +293 -0
  140. package/src/serverGroup/configure/wizard/pages/ServerGroupBasicSettings.tsx +339 -0
  141. package/src/serverGroup/configure/wizard/pages/ServerGroupParameters.less +5 -0
  142. package/src/serverGroup/configure/wizard/pages/ServerGroupParameters.tsx +217 -0
  143. package/src/serverGroup/configure/wizard/pages/ServerGroupResources.tsx +200 -0
  144. package/src/serverGroup/configure/wizard/pages/TitusMapLayout.less +3 -0
  145. package/src/serverGroup/configure/wizard/pages/TitusMapLayout.tsx +29 -0
  146. package/src/serverGroup/configure/wizard/pages/disruptionBudget/JobDisruptionBudget.tsx +285 -0
  147. package/src/serverGroup/configure/wizard/pages/disruptionBudget/PolicyOptions.tsx +112 -0
  148. package/src/serverGroup/configure/wizard/pages/disruptionBudget/RateOptions.tsx +89 -0
  149. package/src/serverGroup/configure/wizard/pages/disruptionBudget/WindowPicker.tsx +202 -0
  150. package/src/serverGroup/configure/wizard/pages/index.ts +4 -0
  151. package/src/serverGroup/details/TitusCapacityDetailsSection.tsx +66 -0
  152. package/src/serverGroup/details/TitusLaunchConfigSection.tsx +35 -0
  153. package/src/serverGroup/details/TitusPackageDetailsSection.tsx +40 -0
  154. package/src/serverGroup/details/TitusSecurityGroups.tsx +107 -0
  155. package/src/serverGroup/details/capacityDetailsSection.component.ts +12 -0
  156. package/src/serverGroup/details/disruptionBudget/DisruptionBudgetSection.tsx +226 -0
  157. package/src/serverGroup/details/disruptionBudget/EditDisruptionBudgetModal.tsx +92 -0
  158. package/src/serverGroup/details/index.ts +5 -0
  159. package/src/serverGroup/details/launchConfigSection.component.ts +12 -0
  160. package/src/serverGroup/details/resize/TitusResizeServerGroupModal.tsx +302 -0
  161. package/src/serverGroup/details/resize/useTaskMonitor.ts +30 -0
  162. package/src/serverGroup/details/rollback/rollbackServerGroup.controller.js +149 -0
  163. package/src/serverGroup/details/rollback/rollbackServerGroup.html +133 -0
  164. package/src/serverGroup/details/scalingActivity/TitusScalingActivitiesModal.tsx +81 -0
  165. package/src/serverGroup/details/scalingPolicy/CreateScalingPolicyButton.tsx +102 -0
  166. package/src/serverGroup/details/scalingPolicy/TitusCustomScalingPolicy.tsx +13 -0
  167. package/src/serverGroup/details/scalingPolicy/createScalingPolicyButton.component.ts +15 -0
  168. package/src/serverGroup/details/scalingPolicy/index.js +3 -0
  169. package/src/serverGroup/details/scalingPolicy/scalingPolicy.module.ts +7 -0
  170. package/src/serverGroup/details/scalingPolicy/targetTracking/TitusTargetTrackingChart.tsx +57 -0
  171. package/src/serverGroup/details/scalingPolicy/targetTracking/UpsertTargetTrackingModal.tsx +82 -0
  172. package/src/serverGroup/details/scalingPolicy/titusCustomScalingPolicy.component.ts +17 -0
  173. package/src/serverGroup/details/scalingPolicy/upsert/TitusScalingPolicyCommandBuilderService.ts +115 -0
  174. package/src/serverGroup/details/scalingPolicy/upsert/UpsertScalingPolicyModal.tsx +157 -0
  175. package/src/serverGroup/details/sections/ITitusServerGroupDetailsSectionProps.ts +6 -0
  176. package/src/serverGroup/details/serverGroupDetails.html +191 -0
  177. package/src/serverGroup/details/serverGroupDetails.titus.controller.js +457 -0
  178. package/src/serverGroup/details/serviceJobProcesses/ServiceJobProcesses.ts +12 -0
  179. package/src/serverGroup/details/serviceJobProcesses/ServiceJobProcessesSection.tsx +136 -0
  180. package/src/serverGroup/details/titusPackageDetailsSection.component.ts +12 -0
  181. package/src/serverGroup/details/titusSecurityGroups.component.ts +12 -0
  182. package/src/serverGroup/serverGroup.transformer.js +90 -0
  183. package/src/titus.module.ts +95 -0
  184. package/src/titus.settings.ts +22 -0
  185. package/src/validation/ApplicationNameValidator.ts +43 -0
@@ -0,0 +1,457 @@
1
+ 'use strict';
2
+
3
+ import UIROUTER_ANGULARJS from '@uirouter/angularjs';
4
+ import * as angular from 'angular';
5
+ import _ from 'lodash';
6
+
7
+ import {
8
+ AccountService,
9
+ ClusterTargetBuilder,
10
+ ConfirmationModalService,
11
+ confirmNotManaged,
12
+ ReactModal,
13
+ SERVER_GROUP_WRITER,
14
+ ServerGroupReader,
15
+ ServerGroupWarningMessageService,
16
+ SETTINGS,
17
+ } from '@spinnaker/core';
18
+
19
+ import { TITUS_SERVERGROUP_CONFIGURE_SERVERGROUPCOMMANDBUILDER } from '../configure/ServerGroupCommandBuilder';
20
+ import { TitusCloneServerGroupModal } from '../configure/wizard/TitusCloneServerGroupModal';
21
+ import { DISRUPTION_BUDGET_DETAILS_SECTION } from './disruptionBudget/DisruptionBudgetSection';
22
+ import { TitusReactInjector } from '../../reactShims';
23
+ import { TitusResizeServerGroupModal } from './resize/TitusResizeServerGroupModal';
24
+ import { TITUS_SERVERGROUP_DETAILS_ROLLBACK_ROLLBACKSERVERGROUP_CONTROLLER } from './rollback/rollbackServerGroup.controller';
25
+ import { SCALING_POLICY_MODULE } from './scalingPolicy/scalingPolicy.module';
26
+ import { SERVICE_JOB_PROCESSES_DETAILS_SECTION } from './serviceJobProcesses/ServiceJobProcessesSection';
27
+ import { TITUS_PACKAGE_DETAILS_SECTION } from './titusPackageDetailsSection.component';
28
+ import { TITUS_SECURITY_GROUPS_DETAILS } from './titusSecurityGroups.component';
29
+
30
+ export const TITUS_SERVERGROUP_DETAILS_SERVERGROUPDETAILS_TITUS_CONTROLLER =
31
+ 'spinnaker.serverGroup.details.titus.controller';
32
+ export const name = TITUS_SERVERGROUP_DETAILS_SERVERGROUPDETAILS_TITUS_CONTROLLER; // for backwards compatibility
33
+ angular
34
+ .module(TITUS_SERVERGROUP_DETAILS_SERVERGROUPDETAILS_TITUS_CONTROLLER, [
35
+ UIROUTER_ANGULARJS,
36
+ TITUS_SERVERGROUP_CONFIGURE_SERVERGROUPCOMMANDBUILDER,
37
+ DISRUPTION_BUDGET_DETAILS_SECTION,
38
+ SERVER_GROUP_WRITER,
39
+ TITUS_SERVERGROUP_DETAILS_ROLLBACK_ROLLBACKSERVERGROUP_CONTROLLER,
40
+ SERVICE_JOB_PROCESSES_DETAILS_SECTION,
41
+ SCALING_POLICY_MODULE,
42
+ TITUS_SECURITY_GROUPS_DETAILS,
43
+ TITUS_PACKAGE_DETAILS_SECTION,
44
+ ])
45
+ .controller('titusServerGroupDetailsCtrl', [
46
+ '$scope',
47
+ '$state',
48
+ '$templateCache',
49
+ '$interpolate',
50
+ 'app',
51
+ 'serverGroup',
52
+ 'titusServerGroupCommandBuilder',
53
+ '$uibModal',
54
+ 'serverGroupWriter',
55
+ 'awsServerGroupTransformer',
56
+ function (
57
+ $scope,
58
+ $state,
59
+ $templateCache,
60
+ $interpolate,
61
+ app,
62
+ serverGroup,
63
+ titusServerGroupCommandBuilder,
64
+ $uibModal,
65
+ serverGroupWriter,
66
+ awsServerGroupTransformer,
67
+ ) {
68
+ const application = app;
69
+ this.application = app;
70
+
71
+ $scope.gateUrl = SETTINGS.gateUrl;
72
+
73
+ $scope.state = {
74
+ loading: true,
75
+ };
76
+
77
+ function extractServerGroupSummary() {
78
+ const summary = _.find(application.serverGroups.data, function (toCheck) {
79
+ return (
80
+ toCheck.name === serverGroup.name &&
81
+ toCheck.account === serverGroup.accountId &&
82
+ toCheck.region === serverGroup.region
83
+ );
84
+ });
85
+ return summary;
86
+ }
87
+
88
+ function retrieveServerGroup() {
89
+ const summary = extractServerGroupSummary();
90
+ return ServerGroupReader.getServerGroup(
91
+ application.name,
92
+ serverGroup.accountId,
93
+ serverGroup.region,
94
+ serverGroup.name,
95
+ ).then(function (details) {
96
+ cancelLoader();
97
+
98
+ // it's possible the summary was not found because the clusters are still loading
99
+ details.account = serverGroup.accountId;
100
+
101
+ AccountService.getAccountDetails(details.account).then((accountDetails) => {
102
+ details.apiEndpoint = _.filter(accountDetails.regions, { name: details.region })[0].endpoint;
103
+ });
104
+
105
+ $scope.buildInfo = details.buildInfo;
106
+
107
+ angular.extend(details, summary);
108
+
109
+ $scope.serverGroup = details;
110
+ const labels = $scope.serverGroup.labels;
111
+ delete labels['name'];
112
+ delete labels['source'];
113
+ delete labels['spinnakerAccount'];
114
+
115
+ delete labels[''];
116
+
117
+ Object.keys(labels).forEach((key) => {
118
+ if (key.startsWith('titus.')) {
119
+ delete labels[key];
120
+ }
121
+ });
122
+
123
+ $scope.labels = labels;
124
+
125
+ transformScalingPolicies(details);
126
+
127
+ if (!_.isEmpty($scope.serverGroup)) {
128
+ configureEntityTagTargets();
129
+ } else {
130
+ autoClose();
131
+ }
132
+ }, autoClose);
133
+ }
134
+
135
+ function transformScalingPolicies(serverGroup) {
136
+ serverGroup.scalingPolicies = (serverGroup.scalingPolicies || [])
137
+ .map((p) => {
138
+ const { policy } = p;
139
+ const { stepPolicyDescriptor, targetPolicyDescriptor } = policy;
140
+ const policyType = stepPolicyDescriptor ? 'StepScaling' : 'TargetTrackingScaling';
141
+ if (stepPolicyDescriptor) {
142
+ const alarm = stepPolicyDescriptor.alarmConfig;
143
+ alarm.period = alarm.periodSec;
144
+ alarm.namespace = alarm.metricNamespace;
145
+ alarm.disableEditingDimensions = true;
146
+ if (alarm.metricNamespace === 'NFLX/EPIC' && !alarm.dimensions) {
147
+ // NOTE: Titus creates the step scaling policy with these dimensions
148
+ // TODO: Remove this once Titus supports configuring dimensions
149
+ alarm.dimensions = [{ name: 'AutoScalingGroupName', value: serverGroup.name }];
150
+ }
151
+ if (!alarm.dimensions) {
152
+ alarm.dimensions = [];
153
+ }
154
+ const policy = _.cloneDeep(stepPolicyDescriptor.scalingPolicy);
155
+ policy.cooldown = policy.cooldownSec;
156
+ policy.policyType = policyType;
157
+ policy.alarms = [alarm];
158
+ policy.id = p.id;
159
+ if (policy.stepAdjustments) {
160
+ policy.stepAdjustments.forEach((step) => {
161
+ // gRPC currently returns these values in upper camel case
162
+ step.metricIntervalUpperBound = _.get(
163
+ step,
164
+ 'metricIntervalUpperBound',
165
+ step.MetricIntervalUpperBound,
166
+ );
167
+ step.metricIntervalLowerBound = _.get(
168
+ step,
169
+ 'metricIntervalLowerBound',
170
+ step.MetricIntervalLowerBound,
171
+ );
172
+ });
173
+ }
174
+ return policy;
175
+ } else {
176
+ const { customizedMetricSpecification } = targetPolicyDescriptor;
177
+ if (customizedMetricSpecification.dimensions === undefined) {
178
+ customizedMetricSpecification.dimensions = [];
179
+ }
180
+ policy.id = p.id;
181
+ policy.targetTrackingConfiguration = policy.targetPolicyDescriptor;
182
+ policy.targetTrackingConfiguration.scaleOutCooldown =
183
+ policy.targetTrackingConfiguration.scaleOutCooldownSec;
184
+ policy.targetTrackingConfiguration.scaleInCooldown =
185
+ policy.targetTrackingConfiguration.scaleInCooldownSec;
186
+ return policy;
187
+ }
188
+ })
189
+ .map((p) => awsServerGroupTransformer.transformScalingPolicy(p));
190
+ }
191
+
192
+ function autoClose() {
193
+ if ($scope.$$destroyed) {
194
+ return;
195
+ }
196
+ $state.go('^', { allowModalToStayOpen: true }, { location: 'replace' });
197
+ }
198
+
199
+ function cancelLoader() {
200
+ $scope.state.loading = false;
201
+ }
202
+
203
+ retrieveServerGroup()
204
+ .then(() => {
205
+ // If the user navigates away from the view before the initial retrieveServerGroup call completes,
206
+ // do not bother subscribing to the refresh
207
+ if (!$scope.$$destroyed) {
208
+ app.serverGroups.onRefresh($scope, retrieveServerGroup);
209
+ }
210
+ })
211
+ .catch(() => {});
212
+
213
+ AccountService.getAccountDetails(serverGroup.accountId).then((details) => {
214
+ const awsAccount = details.awsAccount;
215
+ $scope.titusUiEndpoint = _.filter(details.regions, { name: serverGroup.region })[0].endpoint;
216
+ AccountService.getAccountDetails(awsAccount).then((awsDetails) => {
217
+ this.awsAccountId = awsDetails.accountId;
218
+ this.env = awsDetails.environment;
219
+ });
220
+ });
221
+
222
+ const configureEntityTagTargets = () => {
223
+ this.entityTagTargets = ClusterTargetBuilder.buildClusterTargets($scope.serverGroup);
224
+ };
225
+
226
+ this.destroyServerGroup = function destroyServerGroup() {
227
+ const serverGroup = $scope.serverGroup;
228
+
229
+ const taskMonitor = {
230
+ application: application,
231
+ title: 'Destroying ' + serverGroup.name,
232
+ onTaskComplete: function () {
233
+ if ($state.includes('**.serverGroup', stateParams)) {
234
+ $state.go('^');
235
+ }
236
+ },
237
+ };
238
+
239
+ const submitMethod = function () {
240
+ return serverGroupWriter.destroyServerGroup(serverGroup, application, {
241
+ cloudProvider: 'titus',
242
+ serverGroupName: serverGroup.name,
243
+ region: serverGroup.region,
244
+ });
245
+ };
246
+
247
+ const stateParams = {
248
+ name: serverGroup.name,
249
+ accountId: serverGroup.account,
250
+ region: serverGroup.region,
251
+ };
252
+
253
+ const confirmationModalParams = {
254
+ header: 'Really destroy ' + serverGroup.name + '?',
255
+ buttonText: 'Destroy ' + serverGroup.name,
256
+ account: serverGroup.account,
257
+ taskMonitorConfig: taskMonitor,
258
+ platformHealthOnlyShowOverride: app.attributes.platformHealthOnlyShowOverride,
259
+ platformHealthType: 'Titus',
260
+ submitMethod: submitMethod,
261
+ };
262
+
263
+ ServerGroupWarningMessageService.addDestroyWarningMessage(app, serverGroup, confirmationModalParams);
264
+
265
+ confirmNotManaged(serverGroup, app).then(
266
+ (notManaged) => notManaged && ConfirmationModalService.confirm(confirmationModalParams),
267
+ );
268
+ };
269
+
270
+ this.disableServerGroup = function disableServerGroup() {
271
+ const serverGroup = $scope.serverGroup;
272
+
273
+ const taskMonitor = {
274
+ application: application,
275
+ title: 'Disabling ' + serverGroup.name,
276
+ };
277
+
278
+ const submitMethod = function () {
279
+ return serverGroupWriter.disableServerGroup(serverGroup, application, {
280
+ cloudProvider: 'titus',
281
+ serverGroupName: serverGroup.name,
282
+ region: serverGroup.region,
283
+ zone: serverGroup.zones[0],
284
+ });
285
+ };
286
+
287
+ const confirmationModalParams = {
288
+ header: 'Really disable ' + serverGroup.name + '?',
289
+ buttonText: 'Disable ' + serverGroup.name,
290
+ account: serverGroup.account,
291
+ taskMonitorConfig: taskMonitor,
292
+ platformHealthOnlyShowOverride: app.attributes.platformHealthOnlyShowOverride,
293
+ platformHealthType: 'Titus',
294
+ submitMethod: submitMethod,
295
+ };
296
+
297
+ ServerGroupWarningMessageService.addDisableWarningMessage(app, serverGroup, confirmationModalParams);
298
+
299
+ confirmNotManaged(serverGroup, app).then(
300
+ (notManaged) => notManaged && ConfirmationModalService.confirm(confirmationModalParams),
301
+ );
302
+ };
303
+
304
+ this.enableServerGroup = () => {
305
+ confirmNotManaged(serverGroup, app).then((notManaged) => {
306
+ if (!notManaged) {
307
+ return;
308
+ }
309
+ if (!this.isRollbackEnabled()) {
310
+ this.showEnableServerGroupModal();
311
+ return;
312
+ }
313
+
314
+ const confirmationModalParams = {
315
+ header: 'Rolling back?',
316
+ body: `Spinnaker provides an orchestrated rollback feature to carefully restore a different version of this
317
+ server group. Do you want to use the orchestrated rollback?`,
318
+ buttonText: `Yes, take me to the rollback settings modal`,
319
+ cancelButtonText: 'No, I just want to enable the server group',
320
+ };
321
+
322
+ ConfirmationModalService.confirm(confirmationModalParams)
323
+ // Wait for the confirmation modal to go away first to avoid react/angular bootstrap fighting
324
+ // over the body.modal-open class
325
+ .then(() => new Promise((resolve) => setTimeout(resolve, 500)))
326
+ .then(() => this.rollbackServerGroup())
327
+ .catch(({ source }) => {
328
+ // don't show the enable modal if the user cancels with the header button
329
+ if (source === 'footer') {
330
+ this.showEnableServerGroupModal();
331
+ }
332
+ });
333
+ });
334
+ };
335
+
336
+ this.resizeServerGroup = () => {
337
+ confirmNotManaged(serverGroup, app).then((notManaged) => {
338
+ notManaged && ReactModal.show(TitusResizeServerGroupModal, { serverGroup: $scope.serverGroup, application });
339
+ });
340
+ };
341
+
342
+ this.showEnableServerGroupModal = () => {
343
+ const serverGroup = $scope.serverGroup;
344
+
345
+ const taskMonitor = {
346
+ application: application,
347
+ title: 'Enabling ' + serverGroup.name,
348
+ };
349
+
350
+ const submitMethod = function () {
351
+ return serverGroupWriter.enableServerGroup(serverGroup, application, {
352
+ cloudProvider: 'titus',
353
+ serverGroupName: serverGroup.name,
354
+ region: serverGroup.region,
355
+ zone: serverGroup.zones[0],
356
+ });
357
+ };
358
+
359
+ const confirmationModalParams = {
360
+ header: 'Really enable ' + serverGroup.name + '?',
361
+ buttonText: 'Enable ' + serverGroup.name,
362
+ account: serverGroup.account,
363
+ taskMonitorConfig: taskMonitor,
364
+ platformHealthOnlyShowOverride: app.attributes.platformHealthOnlyShowOverride,
365
+ platformHealthType: 'Titus',
366
+ submitMethod: submitMethod,
367
+ };
368
+
369
+ ConfirmationModalService.confirm(confirmationModalParams);
370
+ };
371
+
372
+ this.cloneServerGroup = function cloneServerGroup() {
373
+ TitusReactInjector.titusServerGroupCommandBuilder
374
+ .buildServerGroupCommandFromExisting(application, $scope.serverGroup)
375
+ .then((command) => {
376
+ const title = `Clone ${serverGroup.name}`;
377
+ TitusCloneServerGroupModal.show({ title, application, command });
378
+ });
379
+ };
380
+
381
+ this.isRollbackEnabled = function rollbackServerGroup() {
382
+ const serverGroup = $scope.serverGroup;
383
+ if (!serverGroup.isDisabled) {
384
+ // enabled server groups are always a candidate for rollback
385
+ return true;
386
+ }
387
+
388
+ // if the server group selected for rollback is disabled, ensure that at least one enabled server group exists
389
+ return application
390
+ .getDataSource('serverGroups')
391
+ .data.some(
392
+ (g) =>
393
+ g.cluster === serverGroup.cluster &&
394
+ g.region === serverGroup.region &&
395
+ g.account === serverGroup.account &&
396
+ g.isDisabled === false,
397
+ );
398
+ };
399
+
400
+ this.rollbackServerGroup = function rollbackServerGroup() {
401
+ let serverGroup = $scope.serverGroup;
402
+
403
+ let previousServerGroup;
404
+ let allServerGroups = app
405
+ .getDataSource('serverGroups')
406
+ .data.filter(
407
+ (g) =>
408
+ g.cluster === serverGroup.cluster && g.region === serverGroup.region && g.account === serverGroup.account,
409
+ );
410
+
411
+ if (serverGroup.isDisabled) {
412
+ // if the selected server group is disabled, it represents the server group that should be _rolled back to_
413
+ previousServerGroup = serverGroup;
414
+
415
+ /*
416
+ * Find an existing server group to rollback, prefer the largest enabled server group.
417
+ *
418
+ * isRollbackEnabled() ensures that at least one enabled server group exists.
419
+ */
420
+ serverGroup = _.orderBy(
421
+ allServerGroups.filter((g) => g.name !== previousServerGroup.name && !g.isDisabled),
422
+ ['instanceCounts.total', 'createdTime'],
423
+ ['desc', 'desc'],
424
+ )[0];
425
+ }
426
+
427
+ // the set of all server groups should not include the server group selected for rollback
428
+ allServerGroups = allServerGroups.filter((g) => g.name !== serverGroup.name);
429
+
430
+ if (allServerGroups.length === 1 && !previousServerGroup) {
431
+ // if there is only one other server group, default to it being the rollback target
432
+ previousServerGroup = allServerGroups[0];
433
+ }
434
+
435
+ confirmNotManaged(serverGroup, app).then((notManaged) => {
436
+ notManaged &&
437
+ $uibModal.open({
438
+ templateUrl: require('./rollback/rollbackServerGroup.html'),
439
+ controller: 'titusRollbackServerGroupCtrl as ctrl',
440
+ resolve: {
441
+ serverGroup: () => serverGroup,
442
+ previousServerGroup: () => previousServerGroup,
443
+ disabledServerGroups: () => {
444
+ const cluster = _.find(application.clusters, {
445
+ name: serverGroup.cluster,
446
+ account: serverGroup.account,
447
+ });
448
+ return _.filter(cluster.serverGroups, { isDisabled: true, region: serverGroup.region });
449
+ },
450
+ allServerGroups: () => allServerGroups,
451
+ application: () => application,
452
+ },
453
+ });
454
+ });
455
+ };
456
+ },
457
+ ]);
@@ -0,0 +1,12 @@
1
+ import type { ITitusServiceJobProcesses } from '../../../domain/ITitusServiceJobProcesses';
2
+
3
+ export const processesList = ['disableIncreaseDesired', 'disableDecreaseDesired'];
4
+
5
+ export const enabledProcesses = (processesMap: ITitusServiceJobProcesses): string[] => {
6
+ return Object.keys(processesMap).reduce((enabled, process) => {
7
+ if (processesMap[process]) {
8
+ enabled.push(process);
9
+ }
10
+ return enabled;
11
+ }, []);
12
+ };
@@ -0,0 +1,136 @@
1
+ import { module } from 'angular';
2
+ import React from 'react';
3
+ import { react2angular } from 'react2angular';
4
+
5
+ import type { Application, IModalComponentProps } from '@spinnaker/core';
6
+ import {
7
+ ChecklistInput,
8
+ FormikFormField,
9
+ ReactModal,
10
+ robotToHuman,
11
+ TaskMonitorModal,
12
+ TextAreaInput,
13
+ withErrorBoundary,
14
+ } from '@spinnaker/core';
15
+
16
+ import { enabledProcesses } from './ServiceJobProcesses';
17
+ import type { ITitusServerGroup } from '../../../domain';
18
+ import type { ITitusServiceJobProcesses } from '../../../domain/ITitusServiceJobProcesses';
19
+ import type { ITitusServerGroupDetailsSectionProps } from '../sections/ITitusServerGroupDetailsSectionProps';
20
+
21
+ interface IEditTitusServiceJobProcessesValues {
22
+ serviceJobProcesses: string[];
23
+ reason?: string;
24
+ }
25
+
26
+ interface IEditTitusServiceJobProcessesModalProps extends IModalComponentProps {
27
+ application: Application;
28
+ serverGroup: ITitusServerGroup;
29
+ }
30
+
31
+ const EditTitusServiceJobProcessesModal: React.SFC<IEditTitusServiceJobProcessesModalProps> = (modalProps) => {
32
+ const { application, serverGroup } = modalProps;
33
+ const { region, id: jobId, account: credentials, cloudProvider } = serverGroup;
34
+ const enabledServiceJobProcesses = enabledProcesses(serverGroup.serviceJobProcesses);
35
+
36
+ return (
37
+ <TaskMonitorModal<IEditTitusServiceJobProcessesValues>
38
+ {...modalProps}
39
+ title={`Modify Service Job Processes for ${serverGroup.name}`}
40
+ description={`Update Service Job Processes for ${serverGroup.name}`}
41
+ initialValues={{ serviceJobProcesses: enabledServiceJobProcesses }}
42
+ render={() => (
43
+ <>
44
+ <FormikFormField
45
+ label="Service Job Processes"
46
+ name="serviceJobProcesses"
47
+ input={(props) => (
48
+ <ChecklistInput
49
+ {...props}
50
+ options={Object.keys(serverGroup.serviceJobProcesses).map((value: string) => ({
51
+ value,
52
+ label: robotToHuman(value),
53
+ }))}
54
+ />
55
+ )}
56
+ />
57
+
58
+ <FormikFormField
59
+ label="Reason"
60
+ name="reason"
61
+ input={(props) => (
62
+ <TextAreaInput
63
+ {...props}
64
+ rows={3}
65
+ placeholder="(Optional) anything that might be helpful to explain the reason for this change; HTML is okay"
66
+ />
67
+ )}
68
+ />
69
+ </>
70
+ )}
71
+ mapValuesToTask={({
72
+ serviceJobProcesses: checkedServiceJobProcesses,
73
+ reason,
74
+ }: IEditTitusServiceJobProcessesValues) => ({
75
+ job: [
76
+ {
77
+ type: 'updateJobProcesses',
78
+ serviceJobProcesses: Object.keys(serverGroup.serviceJobProcesses).reduce((result, process) => {
79
+ result[process] = checkedServiceJobProcesses.includes(process) ? true : false;
80
+ return result;
81
+ }, {} as ITitusServiceJobProcesses),
82
+ reason,
83
+ region,
84
+ jobId,
85
+ credentials,
86
+ cloudProvider,
87
+ },
88
+ ],
89
+ application: application.name,
90
+ })}
91
+ />
92
+ );
93
+ };
94
+
95
+ export class ServiceJobProcessesSection extends React.Component<ITitusServerGroupDetailsSectionProps> {
96
+ private toggleServiceJobProcesses = (): void => {
97
+ const { app: application, serverGroup } = this.props;
98
+
99
+ ReactModal.show(EditTitusServiceJobProcessesModal, {
100
+ application,
101
+ serverGroup,
102
+ } as IEditTitusServiceJobProcessesModalProps);
103
+ };
104
+
105
+ public render() {
106
+ const { serviceJobProcesses } = this.props.serverGroup;
107
+ return (
108
+ <>
109
+ <ul className="scaling-processes">
110
+ {Object.keys(serviceJobProcesses).map((process) => (
111
+ <li key={process}>
112
+ <span
113
+ style={{ visibility: serviceJobProcesses[process] ? 'visible' : 'hidden' }}
114
+ className="fa fa-check small"
115
+ />
116
+ <span className={!serviceJobProcesses[process] ? 'text-disabled' : ''}>{robotToHuman(process)} </span>
117
+ </li>
118
+ ))}
119
+ </ul>
120
+ <a className="clickable" onClick={this.toggleServiceJobProcesses}>
121
+ Edit Service Job Processes
122
+ </a>
123
+ </>
124
+ );
125
+ }
126
+ }
127
+
128
+ export const SERVICE_JOB_PROCESSES_DETAILS_SECTION = 'spinnaker.titus.servicejobprocesses.section';
129
+
130
+ module(SERVICE_JOB_PROCESSES_DETAILS_SECTION, []).component(
131
+ 'titusServiceJobProcessesSection',
132
+ react2angular(withErrorBoundary(ServiceJobProcessesSection, 'titusServiceJobProcessesSection'), [
133
+ 'serverGroup',
134
+ 'app',
135
+ ]),
136
+ );
@@ -0,0 +1,12 @@
1
+ import { module } from 'angular';
2
+ import { react2angular } from 'react2angular';
3
+
4
+ import { withErrorBoundary } from '@spinnaker/core';
5
+
6
+ import { TitusPackageDetailsSection } from './TitusPackageDetailsSection';
7
+
8
+ export const TITUS_PACKAGE_DETAILS_SECTION = 'spinnaker.titus.serverGroup.details.packageDetails.component';
9
+ module(TITUS_PACKAGE_DETAILS_SECTION, []).component(
10
+ 'titusPackageDetailsSection',
11
+ react2angular(withErrorBoundary(TitusPackageDetailsSection, 'titusPackageDetailsSection'), ['buildInfo']),
12
+ );
@@ -0,0 +1,12 @@
1
+ import { module } from 'angular';
2
+ import { react2angular } from 'react2angular';
3
+
4
+ import { withErrorBoundary } from '@spinnaker/core';
5
+
6
+ import { TitusSecurityGroupsDetailsSection } from './TitusSecurityGroups';
7
+
8
+ export const TITUS_SECURITY_GROUPS_DETAILS = 'spinnaker.titus.serverGroup.details.securityGroups.component';
9
+ module(TITUS_SECURITY_GROUPS_DETAILS, []).component(
10
+ 'titusSecurityGroups',
11
+ react2angular(withErrorBoundary(TitusSecurityGroupsDetailsSection, 'titusSecurityGroups'), ['app', 'serverGroup']),
12
+ );