@spinnaker/ecs 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 +1186 -0
- package/LICENSE.txt +203 -0
- package/dist/common/common.module.d.ts +1 -0
- package/dist/common/footer.component.d.ts +1 -0
- package/dist/domain/IEcsLoadBalancer.d.ts +119 -0
- package/dist/ecs.help.d.ts +1 -0
- package/dist/ecs.module.d.ts +4 -0
- package/dist/ecs.settings.d.ts +9 -0
- package/dist/ecsCluster/IEcsCapacityProviderDetails.d.ts +10 -0
- package/dist/ecsCluster/IEcsCluster.d.ts +5 -0
- package/dist/ecsCluster/ecsCluster.read.service.d.ts +7 -0
- package/dist/iamRoles/IRole.d.ts +6 -0
- package/dist/iamRoles/iamRole.read.service.d.ts +5 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +6010 -0
- package/dist/index.js.map +1 -0
- package/dist/instance/details/instance.details.controller.d.ts +2 -0
- package/dist/loadBalancer/EcsLoadBalancerClusterContainer.d.ts +6 -0
- package/dist/loadBalancer/TargetGroup.d.ts +11 -0
- package/dist/loadBalancer/details/loadBalancerDetails.d.ts +27 -0
- package/dist/loadBalancer/details/targetGroupDetails.d.ts +30 -0
- package/dist/loadBalancer/listener.d.ts +10 -0
- package/dist/loadBalancer/loadBalancer.transformer.d.ts +8 -0
- package/dist/loadBalancer/targetGroup.states.d.ts +1 -0
- package/dist/metricAlarm/MetricAlarm.d.ts +6 -0
- package/dist/metricAlarm/metricAlarm.read.service.d.ts +5 -0
- package/dist/pipeline/stages/destroyAsg/ecsDestroyAsgStage.d.ts +2 -0
- package/dist/pipeline/stages/disableAsg/ecsDisableAsgStage.d.ts +2 -0
- package/dist/pipeline/stages/disableCluster/ecsDisableClusterStage.d.ts +2 -0
- package/dist/pipeline/stages/enableAsg/ecsEnableAsgStage.d.ts +2 -0
- package/dist/pipeline/stages/findImageFromTags/ecsFindImageFromTagStage.d.ts +2 -0
- package/dist/pipeline/stages/resizeAsg/ecsResizeAsgStage.d.ts +2 -0
- package/dist/pipeline/stages/scaleDownCluster/ecsScaleDownClusterStage.d.ts +2 -0
- package/dist/pipeline/stages/shrinkCluster/ecsShrinkClusterStage.d.ts +2 -0
- package/dist/placementStrategy/IPlacementStrategy.d.ts +4 -0
- package/dist/placementStrategy/placementStrategy.service.d.ts +11 -0
- package/dist/secrets/ISecret.d.ts +5 -0
- package/dist/secrets/secret.read.service.d.ts +5 -0
- package/dist/securityGroup/details/securityGroupDetail.controller.d.ts +2 -0
- package/dist/securityGroup/securityGroup.module.d.ts +1 -0
- package/dist/securityGroup/securityGroup.reader.d.ts +5 -0
- package/dist/securityGroup/securityGroup.transformer.d.ts +2 -0
- package/dist/serverGroup/configure/serverGroupCommandBuilder.service.d.ts +2 -0
- package/dist/serverGroup/configure/serverGroupConfiguration.service.d.ts +165 -0
- package/dist/serverGroup/configure/wizard/CloneServerGroup.ecs.controller.d.ts +2 -0
- package/dist/serverGroup/configure/wizard/advancedSettings/advancedSettings.component.d.ts +2 -0
- package/dist/serverGroup/configure/wizard/capacityProvider/CapacityProvider.d.ts +7 -0
- package/dist/serverGroup/configure/wizard/container/Container.d.ts +32 -0
- package/dist/serverGroup/configure/wizard/horizontalScaling/horizontalScaling.component.d.ts +2 -0
- package/dist/serverGroup/configure/wizard/location/ServerGroupBasicSettings.controller.d.ts +2 -0
- package/dist/serverGroup/configure/wizard/logging/logging.component.d.ts +1 -0
- package/dist/serverGroup/configure/wizard/networking/Networking.d.ts +28 -0
- package/dist/serverGroup/configure/wizard/serviceDiscovery/ServiceDiscovery.d.ts +34 -0
- package/dist/serverGroup/configure/wizard/taskDefinition/TaskDefinition.d.ts +39 -0
- package/dist/serverGroup/details/resize/resizeCapacity.component.d.ts +1 -0
- package/dist/serverGroup/details/resize/resizeServerGroup.controller.d.ts +2 -0
- package/dist/serverGroup/details/rollback/rollbackServerGroup.controller.d.ts +2 -0
- package/dist/serverGroup/details/serverGroupDetails.ecs.controller.d.ts +2 -0
- package/dist/serverGroup/details/serverGroupDetails.module.d.ts +1 -0
- package/dist/serverGroup/events/EventsLink.d.ts +4 -0
- package/dist/serverGroup/events/events.component.d.ts +3 -0
- package/dist/serverGroup/events/events.controller.d.ts +19 -0
- package/dist/serverGroup/events/serverGroupEventsReader.service.d.ts +10 -0
- package/dist/serverGroup/serverGroup.module.d.ts +1 -0
- package/dist/serverGroup/serverGroup.transformer.d.ts +11 -0
- package/dist/serviceDiscovery/IServiceDiscovery.d.ts +12 -0
- package/dist/serviceDiscovery/serviceDiscovery.read.service.d.ts +4 -0
- package/package.json +47 -0
- package/src/common/common.module.ts +6 -0
- package/src/common/footer.component.ts +29 -0
- package/src/domain/IEcsLoadBalancer.ts +129 -0
- package/src/ecs.help.ts +91 -0
- package/src/ecs.module.ts +116 -0
- package/src/ecs.settings.ts +17 -0
- package/src/ecsCluster/IEcsCapacityProviderDetails.ts +11 -0
- package/src/ecsCluster/IEcsCluster.ts +5 -0
- package/src/ecsCluster/ecsCluster.read.service.ts +23 -0
- package/src/iamRoles/IRole.ts +6 -0
- package/src/iamRoles/iamRole.read.service.ts +14 -0
- package/src/index.ts +1 -0
- package/src/instance/details/instance.details.controller.js +356 -0
- package/src/instance/details/instanceDetails.html +204 -0
- package/src/loadBalancer/EcsLoadBalancerClusterContainer.tsx +48 -0
- package/src/loadBalancer/TargetGroup.tsx +74 -0
- package/src/loadBalancer/details/loadBalancerDetails.tsx +235 -0
- package/src/loadBalancer/details/targetGroupDetails.tsx +251 -0
- package/src/loadBalancer/listener.tsx +65 -0
- package/src/loadBalancer/loadBalancer.transformer.ts +21 -0
- package/src/loadBalancer/targetGroup.states.ts +59 -0
- package/src/logo/ecs.icon.svg +27 -0
- package/src/logo/ecs.logo.less +5 -0
- package/src/logo/ecs.logo.svg +27 -0
- package/src/metricAlarm/MetricAlarm.ts +6 -0
- package/src/metricAlarm/metricAlarm.read.service.ts +14 -0
- package/src/pipeline/stages/cloneServerGroup/cloneServerGroupStage.html +101 -0
- package/src/pipeline/stages/cloneServerGroup/cloneServerGroupStepLabel.html +1 -0
- package/src/pipeline/stages/cloneServerGroup/ecsCloneServerGroupStage.js +94 -0
- package/src/pipeline/stages/destroyAsg/destroyAsgStage.html +9 -0
- package/src/pipeline/stages/destroyAsg/destroyAsgStepLabel.html +1 -0
- package/src/pipeline/stages/destroyAsg/ecsDestroyAsgStage.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/ecsDisableAsgStage.js +70 -0
- package/src/pipeline/stages/disableCluster/disableClusterStage.html +26 -0
- package/src/pipeline/stages/disableCluster/ecsDisableClusterStage.js +84 -0
- package/src/pipeline/stages/enableAsg/ecsEnableAsgStage.js +73 -0
- package/src/pipeline/stages/enableAsg/enableAsgStage.html +11 -0
- package/src/pipeline/stages/enableAsg/enableAsgStepLabel.html +1 -0
- package/src/pipeline/stages/findImageFromTags/ecsFindImageFromTagStage.js +26 -0
- package/src/pipeline/stages/findImageFromTags/findImageFromTagsExecutionDetails.html +36 -0
- package/src/pipeline/stages/findImageFromTags/findImageFromTagsStage.html +9 -0
- package/src/pipeline/stages/resizeAsg/ecsResizeAsgStage.js +128 -0
- package/src/pipeline/stages/resizeAsg/resizeAsgStage.html +87 -0
- package/src/pipeline/stages/resizeAsg/resizeAsgStepLabel.html +1 -0
- package/src/pipeline/stages/scaleDownCluster/ecsScaleDownClusterStage.js +78 -0
- package/src/pipeline/stages/scaleDownCluster/scaleDownClusterStage.html +35 -0
- package/src/pipeline/stages/shrinkCluster/ecsShrinkClusterStage.js +73 -0
- package/src/pipeline/stages/shrinkCluster/shrinkClusterStage.html +34 -0
- package/src/placementStrategy/IPlacementStrategy.ts +4 -0
- package/src/placementStrategy/placementStrategy.service.ts +63 -0
- package/src/secrets/ISecret.ts +5 -0
- package/src/secrets/secret.read.service.ts +14 -0
- package/src/securityGroup/details/securityGroupDetail.controller.js +147 -0
- package/src/securityGroup/details/securityGroupDetail.html +104 -0
- package/src/securityGroup/securityGroup.module.ts +12 -0
- package/src/securityGroup/securityGroup.reader.ts +16 -0
- package/src/securityGroup/securityGroup.transformer.js +13 -0
- package/src/serverGroup/configure/serverGroupCommandBuilder.service.js +281 -0
- package/src/serverGroup/configure/serverGroupConfiguration.service.ts +747 -0
- package/src/serverGroup/configure/wizard/CloneServerGroup.ecs.controller.js +259 -0
- package/src/serverGroup/configure/wizard/advancedSettings/advancedSettings.component.html +194 -0
- package/src/serverGroup/configure/wizard/advancedSettings/advancedSettings.component.js +17 -0
- package/src/serverGroup/configure/wizard/advancedSettings/advancedSettings.html +10 -0
- package/src/serverGroup/configure/wizard/capacityProvider/CapacityProvider.tsx +381 -0
- package/src/serverGroup/configure/wizard/capacityProvider/capacityProvider.html +11 -0
- package/src/serverGroup/configure/wizard/container/Container.tsx +347 -0
- package/src/serverGroup/configure/wizard/container/container.html +9 -0
- package/src/serverGroup/configure/wizard/horizontalScaling/horizontalScaling.component.html +118 -0
- package/src/serverGroup/configure/wizard/horizontalScaling/horizontalScaling.component.js +20 -0
- package/src/serverGroup/configure/wizard/horizontalScaling/horizontalScaling.html +13 -0
- package/src/serverGroup/configure/wizard/location/ServerGroupBasicSettings.controller.js +41 -0
- package/src/serverGroup/configure/wizard/location/basicSettings.html +137 -0
- package/src/serverGroup/configure/wizard/logging/logging.component.html +29 -0
- package/src/serverGroup/configure/wizard/logging/logging.component.ts +12 -0
- package/src/serverGroup/configure/wizard/logging/logging.html +7 -0
- package/src/serverGroup/configure/wizard/networking/Networking.tsx +261 -0
- package/src/serverGroup/configure/wizard/networking/networking.html +9 -0
- package/src/serverGroup/configure/wizard/serverGroupWizard.html +55 -0
- package/src/serverGroup/configure/wizard/serviceDiscovery/ServiceDiscovery.tsx +250 -0
- package/src/serverGroup/configure/wizard/serviceDiscovery/serviceDiscovery.html +11 -0
- package/src/serverGroup/configure/wizard/taskDefinition/TaskDefinition.tsx +460 -0
- package/src/serverGroup/configure/wizard/taskDefinition/taskDefinition.html +51 -0
- package/src/serverGroup/configure/wizard/templateSelection/templateSelection.html +9 -0
- package/src/serverGroup/configure/wizard/verticalScaling/verticalScaling.html +10 -0
- package/src/serverGroup/details/resize/resizeCapacity.component.html +94 -0
- package/src/serverGroup/details/resize/resizeCapacity.component.ts +14 -0
- package/src/serverGroup/details/resize/resizeServerGroup.controller.js +85 -0
- package/src/serverGroup/details/resize/resizeServerGroup.html +28 -0
- package/src/serverGroup/details/rollback/rollbackServerGroup.controller.js +97 -0
- package/src/serverGroup/details/rollback/rollbackServerGroup.html +67 -0
- package/src/serverGroup/details/serverGroupDetails.ecs.controller.js +366 -0
- package/src/serverGroup/details/serverGroupDetails.html +216 -0
- package/src/serverGroup/details/serverGroupDetails.module.ts +5 -0
- package/src/serverGroup/events/EventsLink.tsx +5 -0
- package/src/serverGroup/events/events.component.ts +35 -0
- package/src/serverGroup/events/events.controller.ts +45 -0
- package/src/serverGroup/events/events.html +36 -0
- package/src/serverGroup/events/serverGroupEventsReader.service.ts +27 -0
- package/src/serverGroup/serverGroup.module.ts +6 -0
- package/src/serverGroup/serverGroup.transformer.spec.ts +184 -0
- package/src/serverGroup/serverGroup.transformer.ts +117 -0
- package/src/serviceDiscovery/IServiceDiscovery.ts +13 -0
- package/src/serviceDiscovery/serviceDiscovery.read.service.ts +8 -0
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
import UIROUTER_ANGULARJS from '@uirouter/angularjs';
|
|
4
|
+
import * as angular from 'angular';
|
|
5
|
+
import _ from 'lodash';
|
|
6
|
+
|
|
7
|
+
import { VpcReader } from '@spinnaker/amazon';
|
|
8
|
+
import {
|
|
9
|
+
CloudProviderRegistry,
|
|
10
|
+
FirewallLabels,
|
|
11
|
+
MANAGED_RESOURCE_DETAILS_INDICATOR,
|
|
12
|
+
RecentHistoryService,
|
|
13
|
+
SECURITY_GROUP_READER,
|
|
14
|
+
} from '@spinnaker/core';
|
|
15
|
+
|
|
16
|
+
export const ECS_SECURITYGROUP_DETAILS_SECURITYGROUPDETAIL_CONTROLLER =
|
|
17
|
+
'spinnaker.ecs.securityGroup.details.controller';
|
|
18
|
+
export const name = ECS_SECURITYGROUP_DETAILS_SECURITYGROUPDETAIL_CONTROLLER; // for backwards compatibility
|
|
19
|
+
angular
|
|
20
|
+
.module(ECS_SECURITYGROUP_DETAILS_SECURITYGROUPDETAIL_CONTROLLER, [
|
|
21
|
+
UIROUTER_ANGULARJS,
|
|
22
|
+
SECURITY_GROUP_READER,
|
|
23
|
+
MANAGED_RESOURCE_DETAILS_INDICATOR,
|
|
24
|
+
])
|
|
25
|
+
.controller('ecsSecurityGroupDetailsCtrl', [
|
|
26
|
+
'$scope',
|
|
27
|
+
'$state',
|
|
28
|
+
'resolvedSecurityGroup',
|
|
29
|
+
'app',
|
|
30
|
+
'securityGroupReader',
|
|
31
|
+
function ($scope, $state, resolvedSecurityGroup, app, securityGroupReader) {
|
|
32
|
+
this.application = app;
|
|
33
|
+
const application = app;
|
|
34
|
+
const securityGroup = resolvedSecurityGroup;
|
|
35
|
+
this.firewallLabel = FirewallLabels.get('Firewall');
|
|
36
|
+
|
|
37
|
+
// needed for standalone instances
|
|
38
|
+
$scope.detailsTemplateUrl = CloudProviderRegistry.getValue('ecs', 'securityGroup.detailsTemplateUrl');
|
|
39
|
+
|
|
40
|
+
$scope.state = {
|
|
41
|
+
loading: true,
|
|
42
|
+
standalone: app.isStandalone,
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
function extractSecurityGroup() {
|
|
46
|
+
return securityGroupReader
|
|
47
|
+
.getSecurityGroupDetails(
|
|
48
|
+
application,
|
|
49
|
+
securityGroup.accountId,
|
|
50
|
+
securityGroup.provider,
|
|
51
|
+
securityGroup.region,
|
|
52
|
+
securityGroup.vpcId,
|
|
53
|
+
securityGroup.name,
|
|
54
|
+
)
|
|
55
|
+
.then(function (details) {
|
|
56
|
+
return VpcReader.getVpcName(details.vpcId).then((name) => {
|
|
57
|
+
details.vpcName = name;
|
|
58
|
+
return details;
|
|
59
|
+
});
|
|
60
|
+
})
|
|
61
|
+
.then(function (details) {
|
|
62
|
+
$scope.state.loading = false;
|
|
63
|
+
|
|
64
|
+
if (!details || _.isEmpty(details)) {
|
|
65
|
+
fourOhFour();
|
|
66
|
+
} else {
|
|
67
|
+
const applicationSecurityGroup = securityGroupReader.getApplicationSecurityGroup(
|
|
68
|
+
application,
|
|
69
|
+
securityGroup.accountId,
|
|
70
|
+
securityGroup.region,
|
|
71
|
+
securityGroup.name,
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
angular.extend(securityGroup, applicationSecurityGroup, details);
|
|
75
|
+
$scope.securityGroup = securityGroup;
|
|
76
|
+
$scope.ipRules = buildIpRulesModel(securityGroup);
|
|
77
|
+
$scope.securityGroupRules = buildSecurityGroupRulesModel(securityGroup);
|
|
78
|
+
}
|
|
79
|
+
}, fourOhFour);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function buildIpRulesModel(details) {
|
|
83
|
+
const groupedRangeRules = _.groupBy(details.ipRangeRules, (rule) => rule.range.ip + rule.range.cidr);
|
|
84
|
+
return Object.keys(groupedRangeRules)
|
|
85
|
+
.map((addr) => {
|
|
86
|
+
return {
|
|
87
|
+
address: addr,
|
|
88
|
+
rules: buildRuleModel(groupedRangeRules, addr),
|
|
89
|
+
};
|
|
90
|
+
})
|
|
91
|
+
.filter((rule) => rule.rules.length);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function buildSecurityGroupRulesModel(details) {
|
|
95
|
+
const groupedRangeRules = _.groupBy(details.securityGroupRules, (rule) => rule.securityGroup.id);
|
|
96
|
+
return Object.keys(groupedRangeRules)
|
|
97
|
+
.map((addr) => {
|
|
98
|
+
return {
|
|
99
|
+
securityGroup: groupedRangeRules[addr][0].securityGroup,
|
|
100
|
+
rules: buildRuleModel(groupedRangeRules, addr),
|
|
101
|
+
};
|
|
102
|
+
})
|
|
103
|
+
.filter((rule) => rule.rules.length);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function buildRuleModel(groupedRangeRules, addr) {
|
|
107
|
+
const rules = [];
|
|
108
|
+
groupedRangeRules[addr].forEach((rule) => {
|
|
109
|
+
(rule.portRanges || []).forEach((range) => {
|
|
110
|
+
if (rule.protocol === '-1' || (range.startPort !== undefined && range.endPort !== undefined)) {
|
|
111
|
+
rules.push({ startPort: range.startPort, endPort: range.endPort, protocol: rule.protocol });
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
return rules;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function fourOhFour() {
|
|
119
|
+
if ($scope.$$destroyed) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (app.isStandalone) {
|
|
123
|
+
$scope.group = securityGroup.name;
|
|
124
|
+
$scope.state.notFound = true;
|
|
125
|
+
$scope.state.loading = false;
|
|
126
|
+
RecentHistoryService.removeLastItem('securityGroups');
|
|
127
|
+
} else {
|
|
128
|
+
$state.go('^', { allowModalToStayOpen: true }, { location: 'replace' });
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
extractSecurityGroup().then(() => {
|
|
133
|
+
// If the user navigates away from the view before the initial extractSecurityGroup call completes,
|
|
134
|
+
// do not bother subscribing to the refresh
|
|
135
|
+
if (!$scope.$$destroyed && !app.isStandalone) {
|
|
136
|
+
app.securityGroups.onRefresh($scope, extractSecurityGroup);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
if (app.isStandalone) {
|
|
141
|
+
// we still want the edit to refresh the firewall details when the modal closes
|
|
142
|
+
app.securityGroups = {
|
|
143
|
+
refresh: extractSecurityGroup,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
]);
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<div class="text-center" ng-if="state.notFound">
|
|
2
|
+
<h3>Could not find <firewall-label label="firewall"></firewall-label> {{group}}.</h3>
|
|
3
|
+
<a ui-sref="home.infrastructure">Back to search results</a>
|
|
4
|
+
</div>
|
|
5
|
+
<div class="details-panel" ng-if="!state.notFound">
|
|
6
|
+
<div class="header">
|
|
7
|
+
<div class="close-button" ng-if="!state.standalone">
|
|
8
|
+
<a class="btn btn-link" ui-sref="^">
|
|
9
|
+
<span class="glyphicon glyphicon-remove"></span>
|
|
10
|
+
</a>
|
|
11
|
+
</div>
|
|
12
|
+
<div ng-if="state.loading" class="horizontal center middle">
|
|
13
|
+
<loading-spinner size="'small'"></loading-spinner>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="header-text horizontal middle" ng-if="!state.loading">
|
|
16
|
+
<span class="glyphicon glyphicon-transfer"></span>
|
|
17
|
+
<h3 class="horizontal middle space-between flex-1" select-on-dbl-click>
|
|
18
|
+
{{securityGroup.name || '(not found)'}}
|
|
19
|
+
<render-if-feature feature="entityTags">
|
|
20
|
+
<entity-notifications
|
|
21
|
+
entity="securityGroup"
|
|
22
|
+
application="ctrl.application"
|
|
23
|
+
placement="bottom"
|
|
24
|
+
h-offset-percent="90%"
|
|
25
|
+
entity-type="securityGroup"
|
|
26
|
+
page-location="details"
|
|
27
|
+
on-update="ctrl.application.securityGroups.refresh()"
|
|
28
|
+
></entity-notifications>
|
|
29
|
+
</render-if-feature>
|
|
30
|
+
</h3>
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
<div class="content" ng-if="!state.loading">
|
|
34
|
+
<collapsible-section heading="{{ctrl.firewallLabel}} Details" expanded="true">
|
|
35
|
+
<dl class="dl-horizontal dl-medium">
|
|
36
|
+
<dt>ID</dt>
|
|
37
|
+
<dd>{{securityGroup.id}}</dd>
|
|
38
|
+
<dt>Account</dt>
|
|
39
|
+
<dd>
|
|
40
|
+
<account-tag account="securityGroup.accountName"></account-tag>
|
|
41
|
+
</dd>
|
|
42
|
+
<dt>Region</dt>
|
|
43
|
+
<dd>{{securityGroup.region}}</dd>
|
|
44
|
+
<dt>VPC</dt>
|
|
45
|
+
<dd>
|
|
46
|
+
<vpc-tag vpc-id="securityGroup.vpcId"></vpc-tag>
|
|
47
|
+
</dd>
|
|
48
|
+
<dt>Description</dt>
|
|
49
|
+
<dd>{{securityGroup.description}}</dd>
|
|
50
|
+
</dl>
|
|
51
|
+
</collapsible-section>
|
|
52
|
+
<collapsible-section heading="IP Range Rules ({{ipRules.length}})" expanded="{{ipRules.length > 0}}">
|
|
53
|
+
<div ng-if="!ipRules.length">None</div>
|
|
54
|
+
|
|
55
|
+
<dl
|
|
56
|
+
ng-class="insightCtrl.vm.filtersExpanded ? '' : 'dl-horizontal dl-medium'"
|
|
57
|
+
ng-repeat="ipRangeRule in ipRules | orderBy: 'range.address'"
|
|
58
|
+
>
|
|
59
|
+
<dt>IP Range</dt>
|
|
60
|
+
<dd>{{ipRangeRule.address}}</dd>
|
|
61
|
+
<dt>Port Ranges</dt>
|
|
62
|
+
<dd ng-repeat="rule in ipRangeRule.rules">
|
|
63
|
+
<span ng-if="rule.protocol === '-1'">
|
|
64
|
+
All ports and protocols
|
|
65
|
+
<div ng-if="ipRangeRule.rules.length > 1">
|
|
66
|
+
<em>Additional port ranges are specified, but redundant:</em>
|
|
67
|
+
</div>
|
|
68
|
+
</span>
|
|
69
|
+
<span ng-if="rule.protocol !== '-1'"> {{rule.protocol}}: {{rule.startPort}} → {{rule.endPort}} </span>
|
|
70
|
+
</dd>
|
|
71
|
+
</dl>
|
|
72
|
+
</collapsible-section>
|
|
73
|
+
<collapsible-section
|
|
74
|
+
heading="{{ctrl.firewallLabel}} Rules ({{securityGroupRules.length || 0}})"
|
|
75
|
+
expanded="{{securityGroupRules.length > 0}}"
|
|
76
|
+
>
|
|
77
|
+
<div ng-if="!securityGroupRules.length">None</div>
|
|
78
|
+
|
|
79
|
+
<dl
|
|
80
|
+
ng-class="insightCtrl.vm.filtersExpanded ? '' : 'dl-horizontal dl-medium'"
|
|
81
|
+
ng-repeat="rule in securityGroupRules | orderBy: 'securityGroup.name' "
|
|
82
|
+
>
|
|
83
|
+
<dt>
|
|
84
|
+
<firewall-label label="Firewall"></firewall-label>
|
|
85
|
+
</dt>
|
|
86
|
+
<dd ng-if="rule.securityGroup.name">
|
|
87
|
+
<a
|
|
88
|
+
ui-sref="^.firewallDetails({name: rule.securityGroup.name, accountId: rule.securityGroup.accountName, region: rule.securityGroup.region, vpcId: rule.securityGroup.vpcId, provider: 'ecs'})"
|
|
89
|
+
>
|
|
90
|
+
<account-tag
|
|
91
|
+
account="rule.securityGroup.accountName || rule.securityGroup.accountId"
|
|
92
|
+
ng-if="rule.securityGroup.accountName !== securityGroup.accountName"
|
|
93
|
+
></account-tag>
|
|
94
|
+
{{rule.securityGroup.name}} ({{rule.securityGroup.id}})
|
|
95
|
+
</a>
|
|
96
|
+
</dd>
|
|
97
|
+
<dt>Port Ranges</dt>
|
|
98
|
+
<dd ng-repeat="portRange in rule.rules">
|
|
99
|
+
{{portRange.protocol}}: {{portRange.startPort}} → {{portRange.endPort}}
|
|
100
|
+
</dd>
|
|
101
|
+
</dl>
|
|
102
|
+
</collapsible-section>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { module } from 'angular';
|
|
2
|
+
|
|
3
|
+
import { ECS_SECURITYGROUP_DETAILS_SECURITYGROUPDETAIL_CONTROLLER } from './details/securityGroupDetail.controller';
|
|
4
|
+
import { ECS_SECURITY_GROUP_READER } from './securityGroup.reader';
|
|
5
|
+
import { ECS_SECURITYGROUP_SECURITYGROUP_TRANSFORMER } from './securityGroup.transformer';
|
|
6
|
+
|
|
7
|
+
export const ECS_SECURITY_GROUP_MODULE = 'spinnaker.ecs.securityGroup';
|
|
8
|
+
module(ECS_SECURITY_GROUP_MODULE, [
|
|
9
|
+
ECS_SECURITY_GROUP_READER,
|
|
10
|
+
ECS_SECURITYGROUP_SECURITYGROUP_TRANSFORMER,
|
|
11
|
+
ECS_SECURITYGROUP_DETAILS_SECURITYGROUPDETAIL_CONTROLLER,
|
|
12
|
+
]);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { module } from 'angular';
|
|
2
|
+
|
|
3
|
+
import type { ISecurityGroup, ISecurityGroupsByAccount } from '@spinnaker/core';
|
|
4
|
+
|
|
5
|
+
export class EcsSecurityGroupReader {
|
|
6
|
+
public resolveIndexedSecurityGroup(
|
|
7
|
+
indexedSecurityGroups: ISecurityGroupsByAccount,
|
|
8
|
+
container: ISecurityGroup,
|
|
9
|
+
securityGroupId: string,
|
|
10
|
+
): ISecurityGroup {
|
|
11
|
+
return indexedSecurityGroups[container.account][container.region][securityGroupId];
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export const ECS_SECURITY_GROUP_READER = 'spinnaker.ecs.securityGroup.reader';
|
|
16
|
+
module(ECS_SECURITY_GROUP_READER, []).service('ecsSecurityGroupReader', EcsSecurityGroupReader);
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
import { module } from 'angular';
|
|
4
|
+
|
|
5
|
+
export const ECS_SECURITYGROUP_SECURITYGROUP_TRANSFORMER = 'spinnaker.ecs.securityGroup.transformer';
|
|
6
|
+
export const name = ECS_SECURITYGROUP_SECURITYGROUP_TRANSFORMER; // for backwards compatibility
|
|
7
|
+
module(ECS_SECURITYGROUP_SECURITYGROUP_TRANSFORMER, []).factory('ecsSecurityGroupTransformer', function () {
|
|
8
|
+
function normalizeSecurityGroup() {}
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
normalizeSecurityGroup: normalizeSecurityGroup,
|
|
12
|
+
};
|
|
13
|
+
});
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
import * as angular from 'angular';
|
|
4
|
+
import _ from 'lodash';
|
|
5
|
+
|
|
6
|
+
import { AccountService, INSTANCE_TYPE_SERVICE } from '@spinnaker/core';
|
|
7
|
+
|
|
8
|
+
import { ECS_SERVER_GROUP_CONFIGURATION_SERVICE } from './serverGroupConfiguration.service';
|
|
9
|
+
|
|
10
|
+
export const ECS_SERVERGROUP_CONFIGURE_SERVERGROUPCOMMANDBUILDER_SERVICE =
|
|
11
|
+
'spinnaker.ecs.serverGroupCommandBuilder.service';
|
|
12
|
+
export const name = ECS_SERVERGROUP_CONFIGURE_SERVERGROUPCOMMANDBUILDER_SERVICE; // for backwards compatibility
|
|
13
|
+
angular
|
|
14
|
+
.module(ECS_SERVERGROUP_CONFIGURE_SERVERGROUPCOMMANDBUILDER_SERVICE, [
|
|
15
|
+
INSTANCE_TYPE_SERVICE,
|
|
16
|
+
ECS_SERVER_GROUP_CONFIGURATION_SERVICE,
|
|
17
|
+
])
|
|
18
|
+
.factory('ecsServerGroupCommandBuilder', [
|
|
19
|
+
'$q',
|
|
20
|
+
'instanceTypeService',
|
|
21
|
+
'ecsServerGroupConfigurationService',
|
|
22
|
+
function ($q, instanceTypeService, ecsServerGroupConfigurationService) {
|
|
23
|
+
function reconcileUpstreamImages(image, upstreamImages) {
|
|
24
|
+
if (image.fromContext) {
|
|
25
|
+
const matchingImage = upstreamImages.find((otherImage) => image.stageId === otherImage.stageId);
|
|
26
|
+
|
|
27
|
+
if (matchingImage) {
|
|
28
|
+
image.cluster = matchingImage.cluster;
|
|
29
|
+
image.pattern = matchingImage.pattern;
|
|
30
|
+
image.repository = matchingImage.repository;
|
|
31
|
+
return image;
|
|
32
|
+
} else {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
} else if (image.fromTrigger) {
|
|
36
|
+
const matchingImage = upstreamImages.find((otherImage) => {
|
|
37
|
+
return (
|
|
38
|
+
image.registry === otherImage.registry &&
|
|
39
|
+
image.repository === otherImage.repository &&
|
|
40
|
+
image.tag === otherImage.tag
|
|
41
|
+
);
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
if (matchingImage) {
|
|
45
|
+
return image;
|
|
46
|
+
} else {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
} else {
|
|
50
|
+
return image;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function findUpstreamImages(current, all, visited = {}) {
|
|
55
|
+
// This actually indicates a loop in the stage dependencies.
|
|
56
|
+
if (visited[current.refId]) {
|
|
57
|
+
return [];
|
|
58
|
+
} else {
|
|
59
|
+
visited[current.refId] = true;
|
|
60
|
+
}
|
|
61
|
+
let result = [];
|
|
62
|
+
if (current.type === 'findImageFromTags') {
|
|
63
|
+
result.push({
|
|
64
|
+
fromContext: true,
|
|
65
|
+
imageLabelOrSha: current.imageLabelOrSha,
|
|
66
|
+
stageId: current.refId,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
current.requisiteStageRefIds.forEach(function (id) {
|
|
70
|
+
const next = all.find((stage) => stage.refId === id);
|
|
71
|
+
if (next) {
|
|
72
|
+
result = result.concat(findUpstreamImages(next, all, visited));
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function findTriggerImages(triggers) {
|
|
80
|
+
const result = triggers
|
|
81
|
+
.filter((trigger) => {
|
|
82
|
+
return trigger.type === 'docker';
|
|
83
|
+
})
|
|
84
|
+
.map((trigger) => {
|
|
85
|
+
return {
|
|
86
|
+
fromTrigger: true,
|
|
87
|
+
repository: trigger.repository,
|
|
88
|
+
account: trigger.account,
|
|
89
|
+
organization: trigger.organization,
|
|
90
|
+
registry: trigger.registry,
|
|
91
|
+
tag: trigger.tag,
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
return result;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function buildNewServerGroupCommand(application, defaults) {
|
|
99
|
+
defaults = defaults || {};
|
|
100
|
+
const credentialsLoader = AccountService.getCredentialsKeyedByAccount('ecs');
|
|
101
|
+
|
|
102
|
+
const defaultCredentials = defaults.account || application.defaultCredentials.ecs;
|
|
103
|
+
const defaultRegion = defaults.region || application.defaultRegions.ecs;
|
|
104
|
+
|
|
105
|
+
const preferredZonesLoader = AccountService.getAvailabilityZonesForAccountAndRegion(
|
|
106
|
+
'ecs',
|
|
107
|
+
defaultCredentials,
|
|
108
|
+
defaultRegion,
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
return $q
|
|
112
|
+
.all({
|
|
113
|
+
preferredZones: preferredZonesLoader,
|
|
114
|
+
credentialsKeyedByAccount: credentialsLoader,
|
|
115
|
+
})
|
|
116
|
+
.then(function (asyncData) {
|
|
117
|
+
const availabilityZones = asyncData.preferredZones;
|
|
118
|
+
|
|
119
|
+
let defaultIamRole = 'None (No IAM role)';
|
|
120
|
+
defaultIamRole = defaultIamRole.replace('{{application}}', application.name);
|
|
121
|
+
|
|
122
|
+
const defaultImageCredentials = 'None (No registry credentials)';
|
|
123
|
+
|
|
124
|
+
const command = {
|
|
125
|
+
application: application.name,
|
|
126
|
+
credentials: defaultCredentials,
|
|
127
|
+
region: defaultRegion,
|
|
128
|
+
strategy: '',
|
|
129
|
+
capacity: {
|
|
130
|
+
min: 1,
|
|
131
|
+
max: 1,
|
|
132
|
+
desired: 1,
|
|
133
|
+
},
|
|
134
|
+
launchType: 'EC2',
|
|
135
|
+
healthCheckType: 'EC2',
|
|
136
|
+
selectedProvider: 'ecs',
|
|
137
|
+
iamRole: defaultIamRole,
|
|
138
|
+
dockerImageCredentialsSecret: defaultImageCredentials,
|
|
139
|
+
availabilityZones: availabilityZones,
|
|
140
|
+
subnetType: '',
|
|
141
|
+
securityGroupNames: [],
|
|
142
|
+
healthCheckGracePeriodSeconds: '',
|
|
143
|
+
placementConstraints: [],
|
|
144
|
+
placementStrategyName: '',
|
|
145
|
+
taskDefinitionArtifact: {},
|
|
146
|
+
useTaskDefinitionArtifact: false,
|
|
147
|
+
placementStrategySequence: [],
|
|
148
|
+
serviceDiscoveryAssociations: [],
|
|
149
|
+
ecsClusterName: '',
|
|
150
|
+
targetGroup: '',
|
|
151
|
+
copySourceScalingPoliciesAndActions: true,
|
|
152
|
+
preferSourceCapacity: true,
|
|
153
|
+
useSourceCapacity: true,
|
|
154
|
+
enableDeploymentCircuitBreaker: false,
|
|
155
|
+
viewState: {
|
|
156
|
+
useAllImageSelection: false,
|
|
157
|
+
useSimpleCapacity: true,
|
|
158
|
+
usePreferredZones: true,
|
|
159
|
+
mode: defaults.mode || 'create',
|
|
160
|
+
disableStrategySelection: true,
|
|
161
|
+
dirty: {},
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
if (
|
|
166
|
+
application.attributes &&
|
|
167
|
+
application.attributes.platformHealthOnlyShowOverride &&
|
|
168
|
+
application.attributes.platformHealthOnly
|
|
169
|
+
) {
|
|
170
|
+
command.interestingHealthProviderNames = ['ecs'];
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return command;
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function buildServerGroupCommandFromPipeline(application, originalCluster, current, pipeline) {
|
|
178
|
+
const pipelineCluster = _.cloneDeep(originalCluster);
|
|
179
|
+
const region = Object.keys(pipelineCluster.availabilityZones)[0];
|
|
180
|
+
// var instanceTypeCategoryLoader = instanceTypeService.getCategoryForInstanceType('ecs', pipelineCluster.instanceType);
|
|
181
|
+
|
|
182
|
+
const commandOptions = { account: pipelineCluster.account, region: region };
|
|
183
|
+
return buildNewServerGroupCommand(application, commandOptions).then(function (command) {
|
|
184
|
+
const zones = pipelineCluster.availabilityZones[region];
|
|
185
|
+
const usePreferredZones = zones.join(',') === command.availabilityZones.join(',');
|
|
186
|
+
|
|
187
|
+
let contextImages = findUpstreamImages(current, pipeline.stages) || [];
|
|
188
|
+
contextImages = contextImages.concat(findTriggerImages(pipeline.triggers));
|
|
189
|
+
|
|
190
|
+
if (command.docker && command.docker.image) {
|
|
191
|
+
command.docker.image = reconcileUpstreamImages(command.docker.image, contextImages);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
const viewState = {
|
|
195
|
+
instanceProfile: undefined,
|
|
196
|
+
disableImageSelection: true,
|
|
197
|
+
useSimpleCapacity:
|
|
198
|
+
pipelineCluster.capacity.min === pipelineCluster.capacity.max &&
|
|
199
|
+
pipelineCluster.useSourceCapacity !== true,
|
|
200
|
+
usePreferredZones: usePreferredZones,
|
|
201
|
+
mode: 'editPipeline',
|
|
202
|
+
submitButtonLabel: 'Done',
|
|
203
|
+
templatingEnabled: true,
|
|
204
|
+
existingPipelineCluster: true,
|
|
205
|
+
dirty: {},
|
|
206
|
+
contextImages: contextImages,
|
|
207
|
+
pipeline: pipeline,
|
|
208
|
+
currentStage: current,
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
const viewOverrides = {
|
|
212
|
+
region: region,
|
|
213
|
+
credentials: pipelineCluster.account,
|
|
214
|
+
availabilityZones: pipelineCluster.availabilityZones[region],
|
|
215
|
+
viewState: viewState,
|
|
216
|
+
};
|
|
217
|
+
|
|
218
|
+
pipelineCluster.strategy = pipelineCluster.strategy || '';
|
|
219
|
+
|
|
220
|
+
return angular.extend({}, command, pipelineCluster, viewOverrides);
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// Only used to prepare view requiring template selecting
|
|
225
|
+
function buildNewServerGroupCommandForPipeline(current, pipeline) {
|
|
226
|
+
let contextImages = findUpstreamImages(current, pipeline.stages) || [];
|
|
227
|
+
contextImages = contextImages.concat(findTriggerImages(pipeline.triggers));
|
|
228
|
+
|
|
229
|
+
return $q.when({
|
|
230
|
+
viewState: {
|
|
231
|
+
requiresTemplateSelection: true,
|
|
232
|
+
// applies viewState overrides after template selection
|
|
233
|
+
overrides: {
|
|
234
|
+
viewState: {
|
|
235
|
+
mode: 'editPipeline',
|
|
236
|
+
contextImages: contextImages,
|
|
237
|
+
pipeline: pipeline,
|
|
238
|
+
currentStage: current,
|
|
239
|
+
},
|
|
240
|
+
},
|
|
241
|
+
},
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
function buildUpdateServerGroupCommand(serverGroup) {
|
|
246
|
+
const command = {
|
|
247
|
+
type: 'modifyAsg',
|
|
248
|
+
asgs: [{ asgName: serverGroup.name, region: serverGroup.region }],
|
|
249
|
+
healthCheckType: serverGroup.asg.healthCheckType,
|
|
250
|
+
credentials: serverGroup.account,
|
|
251
|
+
};
|
|
252
|
+
ecsServerGroupConfigurationService.configureUpdateCommand(command);
|
|
253
|
+
return command;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
function buildServerGroupCommandFromExisting(application, serverGroup, mode = 'clone') {
|
|
257
|
+
// do NOT copy: deployment strategy. DO copy: account, region, cluster name, stack
|
|
258
|
+
// TODO: query for & pull in ECS-specific data that would be useful, e.g, network mode, launch type
|
|
259
|
+
const commandOptions = { account: serverGroup.account, region: serverGroup.region };
|
|
260
|
+
return buildNewServerGroupCommand(application, commandOptions).then(function (command) {
|
|
261
|
+
command.credentials = serverGroup.account;
|
|
262
|
+
command.app = serverGroup.moniker.app;
|
|
263
|
+
command.stack = serverGroup.moniker.stack;
|
|
264
|
+
command.region = serverGroup.region;
|
|
265
|
+
command.ecsClusterName = serverGroup.ecsCluster;
|
|
266
|
+
command.capacity = serverGroup.capacity;
|
|
267
|
+
command.viewState.mode = mode;
|
|
268
|
+
|
|
269
|
+
return command;
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
return {
|
|
274
|
+
buildNewServerGroupCommand: buildNewServerGroupCommand,
|
|
275
|
+
buildServerGroupCommandFromExisting: buildServerGroupCommandFromExisting,
|
|
276
|
+
buildNewServerGroupCommandForPipeline: buildNewServerGroupCommandForPipeline,
|
|
277
|
+
buildServerGroupCommandFromPipeline: buildServerGroupCommandFromPipeline,
|
|
278
|
+
buildUpdateServerGroupCommand: buildUpdateServerGroupCommand,
|
|
279
|
+
};
|
|
280
|
+
},
|
|
281
|
+
]);
|