@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.
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,35 @@
1
+ <div ng-controller="titusScaleDownClusterStageCtrl as scaleDownClusterStageCtrl" class="form-horizontal">
2
+ <div ng-if="!pipeline.strategy">
3
+ <account-region-cluster-selector application="application" component="stage" accounts="accounts">
4
+ </account-region-cluster-selector>
5
+ </div>
6
+ <stage-config-field label="Scale Down Options">
7
+ <div class="form-inline">
8
+ <p>
9
+ Keep the
10
+ <input
11
+ type="number"
12
+ min="0"
13
+ required
14
+ ng-model="stage.remainingFullSizeServerGroups"
15
+ class="form-control input-sm"
16
+ style="width: 50px"
17
+ />
18
+ <select class="form-control input-sm" ng-model="stage.preferLargerOverNewer" style="width: 100px">
19
+ <option value="true">largest</option>
20
+ <option value="false">newest</option>
21
+ </select>
22
+ {{scaleDownClusterStageCtrl.pluralize('server group', stage.remainingFullSizeServerGroups)}} at current size.
23
+ </p>
24
+ <p>The remaining server groups will be scaled down to zero instances.</p>
25
+ </div>
26
+ </stage-config-field>
27
+ <div class="form-group">
28
+ <div class="col-md-offset-3 col-md-6 checkbox">
29
+ <label>
30
+ <input type="checkbox" ng-model="stage.allowScaleDownActive" />
31
+ Allow scale down of active server groups
32
+ </label>
33
+ </div>
34
+ </div>
35
+ </div>
@@ -0,0 +1,79 @@
1
+ 'use strict';
2
+
3
+ import { module } from 'angular';
4
+
5
+ import { AccountService, Registry } from '@spinnaker/core';
6
+
7
+ export const TITUS_PIPELINE_STAGES_SCALEDOWNCLUSTER_TITUSSCALEDOWNCLUSTERSTAGE =
8
+ 'spinnaker.titus.pipeline.stage.scaleDownClusterStage';
9
+ export const name = TITUS_PIPELINE_STAGES_SCALEDOWNCLUSTER_TITUSSCALEDOWNCLUSTERSTAGE; // for backwards compatibility
10
+ module(TITUS_PIPELINE_STAGES_SCALEDOWNCLUSTER_TITUSSCALEDOWNCLUSTERSTAGE, [])
11
+ .config(function () {
12
+ Registry.pipeline.registerStage({
13
+ provides: 'scaleDownCluster',
14
+ cloudProvider: 'titus',
15
+ templateUrl: require('./scaleDownClusterStage.html'),
16
+ executionConfigSections: ['scaleDownClusterConfig', 'taskStatus'],
17
+ accountExtractor: (stage) => [stage.context.credentials],
18
+ configAccountExtractor: (stage) => [stage.credentials],
19
+ validators: [
20
+ { type: 'requiredField', fieldName: 'cluster' },
21
+ {
22
+ type: 'requiredField',
23
+ fieldName: 'remainingFullSizeServerGroups',
24
+ fieldLabel: 'Keep [X] full size Server Groups',
25
+ },
26
+ { type: 'requiredField', fieldName: 'regions' },
27
+ { type: 'requiredField', fieldName: 'credentials', fieldLabel: 'account' },
28
+ ],
29
+ strategy: true,
30
+ });
31
+ })
32
+ .controller('titusScaleDownClusterStageCtrl', [
33
+ '$scope',
34
+ function ($scope) {
35
+ const ctrl = this;
36
+
37
+ const stage = $scope.stage;
38
+
39
+ $scope.state = {
40
+ accounts: false,
41
+ regionsLoaded: false,
42
+ };
43
+
44
+ AccountService.listAccounts('titus').then(function (accounts) {
45
+ $scope.accounts = accounts;
46
+ $scope.state.accounts = true;
47
+ });
48
+
49
+ stage.regions = stage.regions || [];
50
+ stage.cloudProvider = 'titus';
51
+
52
+ if (!stage.credentials && $scope.application.defaultCredentials.titus) {
53
+ stage.credentials = $scope.application.defaultCredentials.titus;
54
+ }
55
+ if (!stage.regions.length && $scope.application.defaultRegions.titus) {
56
+ stage.regions.push($scope.application.defaultRegions.titus);
57
+ }
58
+
59
+ if (stage.remainingFullSizeServerGroups === undefined) {
60
+ stage.remainingFullSizeServerGroups = 1;
61
+ }
62
+
63
+ if (stage.allowScaleDownActive === undefined) {
64
+ stage.allowScaleDownActive = false;
65
+ }
66
+
67
+ ctrl.pluralize = function (str, val) {
68
+ if (val === 1) {
69
+ return str;
70
+ }
71
+ return str + 's';
72
+ };
73
+
74
+ if (stage.preferLargerOverNewer === undefined) {
75
+ stage.preferLargerOverNewer = 'false';
76
+ }
77
+ stage.preferLargerOverNewer = stage.preferLargerOverNewer.toString();
78
+ },
79
+ ]);
@@ -0,0 +1,34 @@
1
+ <div ng-controller="titusShrinkClusterStageCtrl as shrinkClusterStageCtrl" class="form-horizontal">
2
+ <div ng-if="!pipeline.strategy">
3
+ <account-region-cluster-selector application="application" component="stage" accounts="accounts">
4
+ </account-region-cluster-selector>
5
+ </div>
6
+ <stage-config-field label="Shrink Options">
7
+ <div class="form-inline">
8
+ Shrink to
9
+ <input
10
+ type="number"
11
+ min="0"
12
+ required
13
+ ng-model="stage.shrinkToSize"
14
+ class="form-control input-sm"
15
+ style="width: 50px"
16
+ />
17
+ {{shrinkClusterStageCtrl.pluralize('server group', stage.shrinkToSize)}}, keeping the
18
+ <select class="form-control input-sm" ng-model="stage.retainLargerOverNewer" style="width: 100px">
19
+ <option value="true">largest</option>
20
+ <option value="false">newest</option>
21
+ </select>
22
+ </div>
23
+ </stage-config-field>
24
+ <div class="form-group">
25
+ <div class="col-md-offset-3 col-md-6 checkbox">
26
+ <label>
27
+ <input type="checkbox" ng-model="stage.allowDeleteActive" />
28
+ Allow deletion of active server groups
29
+ </label>
30
+ </div>
31
+ </div>
32
+ <stage-platform-health-override application="application" stage="stage" platform-health-type="'Titus'">
33
+ </stage-platform-health-override>
34
+ </div>
@@ -0,0 +1,73 @@
1
+ 'use strict';
2
+
3
+ import { module } from 'angular';
4
+
5
+ import { AccountService, Registry } from '@spinnaker/core';
6
+
7
+ export const TITUS_PIPELINE_STAGES_SHRINKCLUSTER_TITUSSHRINKCLUSTERSTAGE =
8
+ 'spinnaker.titus.pipeline.stage.shrinkClusterStage';
9
+ export const name = TITUS_PIPELINE_STAGES_SHRINKCLUSTER_TITUSSHRINKCLUSTERSTAGE; // for backwards compatibility
10
+ module(TITUS_PIPELINE_STAGES_SHRINKCLUSTER_TITUSSHRINKCLUSTERSTAGE, [])
11
+ .config(function () {
12
+ Registry.pipeline.registerStage({
13
+ provides: 'shrinkCluster',
14
+ cloudProvider: 'titus',
15
+ templateUrl: require('./shrinkClusterStage.html'),
16
+ accountExtractor: (stage) => [stage.context.credentials],
17
+ configAccountExtractor: (stage) => [stage.credentials],
18
+ validators: [
19
+ { type: 'requiredField', fieldName: 'cluster' },
20
+ { type: 'requiredField', fieldName: 'shrinkToSize', fieldLabel: 'shrink to [X] Server Groups' },
21
+ { type: 'requiredField', fieldName: 'regions' },
22
+ { type: 'requiredField', fieldName: 'credentials', fieldLabel: 'account' },
23
+ ],
24
+ });
25
+ })
26
+ .controller('titusShrinkClusterStageCtrl', [
27
+ '$scope',
28
+ function ($scope) {
29
+ const ctrl = this;
30
+
31
+ const stage = $scope.stage;
32
+
33
+ $scope.state = {
34
+ accounts: false,
35
+ regionsLoaded: false,
36
+ };
37
+
38
+ AccountService.listAccounts('titus').then(function (accounts) {
39
+ $scope.accounts = accounts;
40
+ $scope.state.accounts = true;
41
+ });
42
+
43
+ stage.regions = stage.regions || [];
44
+ stage.cloudProvider = 'titus';
45
+
46
+ if (!stage.credentials && $scope.application.defaultCredentials.titus) {
47
+ stage.credentials = $scope.application.defaultCredentials.titus;
48
+ }
49
+ if (!stage.regions.length && $scope.application.defaultRegions.titus) {
50
+ stage.regions.push($scope.application.defaultRegions.titus);
51
+ }
52
+
53
+ if (stage.shrinkToSize === undefined) {
54
+ stage.shrinkToSize = 1;
55
+ }
56
+
57
+ if (stage.allowDeleteActive === undefined) {
58
+ stage.allowDeleteActive = false;
59
+ }
60
+
61
+ ctrl.pluralize = function (str, val) {
62
+ if (val === 1) {
63
+ return str;
64
+ }
65
+ return str + 's';
66
+ };
67
+
68
+ if (stage.retainLargerOverNewer === undefined) {
69
+ stage.retainLargerOverNewer = 'false';
70
+ }
71
+ stage.retainLargerOverNewer = stage.retainLargerOverNewer.toString();
72
+ },
73
+ ]);
@@ -0,0 +1 @@
1
+ export * from './titus.react.injector';
@@ -0,0 +1,17 @@
1
+ import IInjectorService = angular.auto.IInjectorService;
2
+
3
+ import { ReactInject } from '@spinnaker/core';
4
+
5
+ // prettier-ignore
6
+ export class TitusReactInject extends ReactInject {
7
+ public get titusServerGroupTransformer() { return this.$injector.get('titusServerGroupTransformer') as any; }
8
+ public get titusServerGroupCommandBuilder() { return this.$injector.get('titusServerGroupCommandBuilder') as any; }
9
+ public get titusServerGroupConfigurationService() { return this.$injector.get('titusServerGroupConfigurationService') as any; }
10
+ public get titusSecurityGroupReader() { return this.$injector.get('titusSecurityGroupReader') as any; }
11
+
12
+ public initialize($injector: IInjectorService) {
13
+ this.$injector = $injector;
14
+ }
15
+ }
16
+
17
+ export const TitusReactInjector: TitusReactInject = new TitusReactInject();
@@ -0,0 +1,10 @@
1
+ import { module } from 'angular';
2
+ import { TitusReactInjector } from './titus.react.injector';
3
+
4
+ export const TITUS_REACT_MODULE = 'spinnaker.titus.react';
5
+ module(TITUS_REACT_MODULE, []).run([
6
+ '$injector',
7
+ function ($injector: any) {
8
+ TitusReactInjector.initialize($injector);
9
+ },
10
+ ]);
@@ -0,0 +1,15 @@
1
+ 'use strict';
2
+
3
+ import { module } from 'angular';
4
+
5
+ export const TITUS_SECURITYGROUP_SECURITYGROUP_READ_SERVICE = 'spinnaker.titus.securityGroup.reader';
6
+ export const name = TITUS_SECURITYGROUP_SECURITYGROUP_READ_SERVICE; // for backwards compatibility
7
+ module(TITUS_SECURITYGROUP_SECURITYGROUP_READ_SERVICE, []).factory('titusSecurityGroupReader', function () {
8
+ function resolveIndexedSecurityGroup(indexedSecurityGroups, container, securityGroupId) {
9
+ return indexedSecurityGroups[container.awsAccount][container.region][securityGroupId];
10
+ }
11
+
12
+ return {
13
+ resolveIndexedSecurityGroup: resolveIndexedSecurityGroup,
14
+ };
15
+ });
@@ -0,0 +1,247 @@
1
+ 'use strict';
2
+
3
+ import * as angular from 'angular';
4
+
5
+ import { cloneDeep, set } from 'lodash';
6
+ import { NameUtils } from '@spinnaker/core';
7
+ import { TitusProviderSettings } from '../../titus.settings';
8
+
9
+ export const TITUS_SERVERGROUP_CONFIGURE_SERVERGROUPCOMMANDBUILDER =
10
+ 'spinnaker.titus.serverGroupCommandBuilder.service';
11
+ export const name = TITUS_SERVERGROUP_CONFIGURE_SERVERGROUPCOMMANDBUILDER; // for backwards compatibility
12
+ angular.module(TITUS_SERVERGROUP_CONFIGURE_SERVERGROUPCOMMANDBUILDER, []).factory('titusServerGroupCommandBuilder', [
13
+ '$q',
14
+ function ($q) {
15
+ function getDefaultIamProfile(application) {
16
+ const defaultIamProfile = TitusProviderSettings.defaults.iamProfile || '{{application}}InstanceProfile';
17
+ return defaultIamProfile.replace('{{application}}', application.name);
18
+ }
19
+
20
+ function buildNewServerGroupCommand(application, defaults) {
21
+ defaults = defaults || {};
22
+
23
+ const defaultCredentials = defaults.account || TitusProviderSettings.defaults.account;
24
+ const defaultRegion = defaults.region || TitusProviderSettings.defaults.region;
25
+ const defaultZone = defaults.zone || TitusProviderSettings.defaults.zone;
26
+ const defaultIamProfile = getDefaultIamProfile(application);
27
+
28
+ const command = {
29
+ application: application.name,
30
+ credentials: defaultCredentials,
31
+ region: defaultRegion,
32
+ zone: defaultZone,
33
+ network: 'default',
34
+ inService: true,
35
+ resources: {
36
+ cpu: 1,
37
+ networkMbps: 128,
38
+ disk: 10000,
39
+ memory: 512,
40
+ gpu: 0,
41
+ },
42
+ efs: {
43
+ mountPerm: 'RW',
44
+ },
45
+ strategy: '',
46
+ capacity: {
47
+ min: 1,
48
+ max: 1,
49
+ desired: 1,
50
+ },
51
+ targetHealthyDeployPercentage: 100,
52
+ env: {},
53
+ labels: {},
54
+ containerAttributes: {
55
+ 'titusParameter.agent.assignIPv6Address': 'true',
56
+ },
57
+ cloudProvider: 'titus',
58
+ selectedProvider: 'titus',
59
+ iamProfile: defaultIamProfile,
60
+ constraints: {
61
+ hard: {},
62
+ soft: {},
63
+ },
64
+ serviceJobProcesses: {},
65
+ viewState: {
66
+ defaultIamProfile,
67
+ useSimpleCapacity: true,
68
+ usePreferredZones: true,
69
+ mode: defaults.mode || 'create',
70
+ },
71
+ securityGroups: [],
72
+ imageId: defaults.imageId,
73
+ migrationPolicy: { type: 'systemDefault' },
74
+ digest: '',
75
+ organization: '',
76
+ tag: '',
77
+ registry: '',
78
+ repository: '',
79
+ };
80
+
81
+ return $q.when(command);
82
+ }
83
+
84
+ // Only used to prepare view requiring template selecting
85
+ function buildNewServerGroupCommandForPipeline() {
86
+ return $q.when({
87
+ viewState: {
88
+ requiresTemplateSelection: true,
89
+ },
90
+ });
91
+ }
92
+
93
+ function buildServerGroupCommandFromExisting(application, serverGroup, mode) {
94
+ mode = mode || 'clone';
95
+
96
+ const serverGroupName = NameUtils.parseServerGroupName(serverGroup.name);
97
+
98
+ const isTestEnv = serverGroup.awsAccount === 'test';
99
+ const isIPv6Set =
100
+ serverGroup.containerAttributes &&
101
+ serverGroup.containerAttributes['titusParameter.agent.assignIPv6Address'] !== undefined;
102
+
103
+ // If IPv6 hasn't been explicitly set by the user, auto-assign based on the environment.
104
+ const assignIPv6Address = isIPv6Set
105
+ ? serverGroup.containerAttributes['titusParameter.agent.assignIPv6Address']
106
+ : isTestEnv
107
+ ? 'true'
108
+ : 'false';
109
+
110
+ const containerAttributes = {
111
+ ...serverGroup.containerAttributes,
112
+ 'titusParameter.agent.assignIPv6Address': assignIPv6Address,
113
+ };
114
+
115
+ const command = {
116
+ application: application.name,
117
+ disruptionBudget: serverGroup.disruptionBudget,
118
+ strategy: '',
119
+ stack: serverGroupName.stack,
120
+ freeFormDetails: serverGroupName.freeFormDetails,
121
+ account: serverGroup.account,
122
+ credentials: serverGroup.account,
123
+ region: serverGroup.region,
124
+ env: serverGroup.env,
125
+ labels: serverGroup.labels,
126
+ containerAttributes,
127
+ entryPoint: serverGroup.entryPoint,
128
+ iamProfile: serverGroup.iamProfile,
129
+ capacityGroup: serverGroup.capacityGroup,
130
+ migrationPolicy: serverGroup.migrationPolicy ? serverGroup.migrationPolicy : { type: 'systemDefault' },
131
+ securityGroups: serverGroup.securityGroups || [],
132
+ constraints: {
133
+ hard: (serverGroup.constraints && serverGroup.constraints.hard) || {},
134
+ soft: (serverGroup.constraints && serverGroup.constraints.soft) || {},
135
+ },
136
+ serviceJobProcesses: Object.assign({}, serverGroup.serviceJobProcesses),
137
+ inService: serverGroup.disabled ? false : true,
138
+ source: {
139
+ account: serverGroup.account,
140
+ region: serverGroup.region,
141
+ asgName: serverGroup.name,
142
+ },
143
+ resources: {
144
+ cpu: serverGroup.resources.cpu,
145
+ gpu: serverGroup.resources.gpu,
146
+ memory: serverGroup.resources.memory,
147
+ disk: serverGroup.resources.disk,
148
+ networkMbps: serverGroup.resources.networkMbps,
149
+ },
150
+ targetGroups: serverGroup.targetGroups,
151
+ capacity: {
152
+ min: serverGroup.capacity.min,
153
+ max: serverGroup.capacity.max,
154
+ desired: serverGroup.capacity.desired,
155
+ },
156
+ targetHealthyDeployPercentage: 100,
157
+ cloudProvider: 'titus',
158
+ selectedProvider: 'titus',
159
+ viewState: {
160
+ defaultIamProfile: getDefaultIamProfile(application),
161
+ useSimpleCapacity: serverGroup.capacity.min === serverGroup.capacity.max,
162
+ mode: mode,
163
+ },
164
+ organization: '',
165
+ tag: '',
166
+ digest: '',
167
+ registry: '',
168
+ repository: '',
169
+ };
170
+
171
+ if (serverGroup.efs) {
172
+ command.efs = {
173
+ mountPoint: serverGroup.efs.mountPoint,
174
+ mountPerm: serverGroup.efs.mountPerm,
175
+ efsId: serverGroup.efs.efsId,
176
+ };
177
+ } else {
178
+ command.efs = {
179
+ mountPerm: 'RW',
180
+ };
181
+ }
182
+
183
+ if (mode !== 'editPipeline') {
184
+ command.imageId =
185
+ serverGroup.image.dockerImageName +
186
+ ':' +
187
+ (serverGroup.image.dockerImageVersion
188
+ ? serverGroup.image.dockerImageVersion
189
+ : serverGroup.image.dockerImageDigest);
190
+ }
191
+
192
+ return $q.when(command);
193
+ }
194
+
195
+ function buildServerGroupCommandFromPipeline(application, originalCluster) {
196
+ const pipelineCluster = cloneDeep(originalCluster);
197
+ const commandOptions = {
198
+ account: pipelineCluster.account,
199
+ imageId: pipelineCluster.imageId,
200
+ region: pipelineCluster.region,
201
+ };
202
+
203
+ return buildNewServerGroupCommand(application, commandOptions).then(function (command) {
204
+ command.constraints = {
205
+ hard:
206
+ (originalCluster.constraints && originalCluster.constraints.hard) ||
207
+ (originalCluster.hardConstraints &&
208
+ originalCluster.hardConstraints.reduce((a, c) => set(a, c, 'true'), {})) ||
209
+ {},
210
+ soft:
211
+ (originalCluster.constraints && originalCluster.constraints.soft) ||
212
+ (originalCluster.softConstraints &&
213
+ originalCluster.softConstraints.reduce((a, c) => set(a, c, 'true'), {})) ||
214
+ {},
215
+ };
216
+ delete pipelineCluster.hardConstraints;
217
+ delete pipelineCluster.softConstraints;
218
+
219
+ const viewState = {
220
+ disableImageSelection: true,
221
+ useSimpleCapacity: originalCluster.capacity.min === originalCluster.capacity.max,
222
+ mode: 'editPipeline',
223
+ submitButtonLabel: 'Done',
224
+ defaultIamProfile: getDefaultIamProfile(application),
225
+ };
226
+
227
+ const viewOverrides = {
228
+ region: pipelineCluster.region,
229
+ credentials: pipelineCluster.account,
230
+ iamProfile: pipelineCluster.iamProfile,
231
+ viewState: viewState,
232
+ };
233
+
234
+ pipelineCluster.strategy = pipelineCluster.strategy || '';
235
+ const extendedCommand = angular.extend({}, command, pipelineCluster, viewOverrides);
236
+ return extendedCommand;
237
+ });
238
+ }
239
+
240
+ return {
241
+ buildNewServerGroupCommand,
242
+ buildNewServerGroupCommandForPipeline,
243
+ buildServerGroupCommandFromExisting,
244
+ buildServerGroupCommandFromPipeline,
245
+ };
246
+ },
247
+ ]);
@@ -0,0 +1,9 @@
1
+ 'use strict';
2
+
3
+ import { module } from 'angular';
4
+
5
+ import { TITUS_SERVER_GROUP_CONFIGURATION_SERVICE } from './serverGroupConfiguration.service';
6
+
7
+ export const TITUS_SERVERGROUP_CONFIGURE_SERVERGROUP_CONFIGURE_TITUS_MODULE = 'spinnaker.serverGroup.configure.titus';
8
+ export const name = TITUS_SERVERGROUP_CONFIGURE_SERVERGROUP_CONFIGURE_TITUS_MODULE; // for backwards compatibility
9
+ module(TITUS_SERVERGROUP_CONFIGURE_SERVERGROUP_CONFIGURE_TITUS_MODULE, [TITUS_SERVER_GROUP_CONFIGURATION_SERVICE]);
@@ -0,0 +1,63 @@
1
+ 'use strict';
2
+
3
+ import { NameUtils } from 'core/naming';
4
+
5
+ import { TitusProviderSettings } from '../../titus.settings';
6
+
7
+ describe('titusServerGroupCommandBuilder', function () {
8
+ beforeEach(window.module(require('./ServerGroupCommandBuilder').name));
9
+
10
+ beforeEach(
11
+ window.inject(function (titusServerGroupCommandBuilder, $q, $rootScope) {
12
+ this.titusServerGroupCommandBuilder = titusServerGroupCommandBuilder;
13
+ this.$scope = $rootScope;
14
+ this.$q = $q;
15
+ }),
16
+ );
17
+
18
+ afterEach(TitusProviderSettings.resetToOriginal);
19
+
20
+ describe('buildNewServerGroupCommand', function () {
21
+ it('should initializes to default values', function () {
22
+ var command = null;
23
+ TitusProviderSettings.defaults.iamProfile = '{{application}}InstanceProfile';
24
+ this.titusServerGroupCommandBuilder.buildNewServerGroupCommand({ name: 'titusApp' }).then(function (result) {
25
+ command = result;
26
+ });
27
+
28
+ this.$scope.$digest();
29
+ expect(command.iamProfile).toBe('titusAppInstanceProfile');
30
+ expect(command.viewState.mode).toBe('create');
31
+ });
32
+ });
33
+
34
+ describe('buildServerGroupCommandFromExisting', function () {
35
+ it('should set iam profile if available otherwise use the default', function () {
36
+ spyOn(NameUtils, 'parseServerGroupName').and.returnValue(this.$q.when('titusApp-test-test'));
37
+
38
+ var baseServerGroup = {
39
+ account: 'prod',
40
+ region: 'us-west-1',
41
+ cluster: 'titus-test-test',
42
+ type: 'titus',
43
+ loudProvider: 'titus',
44
+ iamProfile: 'titusAppInstanceProfile',
45
+ resources: {},
46
+ capacity: {},
47
+ image: {},
48
+ };
49
+
50
+ var command = null;
51
+ this.titusServerGroupCommandBuilder
52
+ .buildServerGroupCommandFromExisting({ name: 'titusApp' }, baseServerGroup)
53
+ .then(function (result) {
54
+ command = result;
55
+ });
56
+
57
+ this.$scope.$digest();
58
+
59
+ expect(command.iamProfile).toBe('titusAppInstanceProfile');
60
+ expect(command.viewState.mode).toBe('clone');
61
+ });
62
+ });
63
+ });