@spinnaker/cloudrun 2026.2.2 → 2026.3.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.
- package/dist/cloudrun.module.d.ts +1 -1
- package/dist/common/ComponentUrlDetails.d.ts +7 -0
- package/dist/common/LoadBalancerMessage.d.ts +4 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/instance/details/CloudrunInstanceDetails.d.ts +23 -0
- package/dist/loadBalancer/configure/wizard/CloudrunLoadBalancerModal.d.ts +32 -0
- package/dist/loadBalancer/details/CloudrunLoadBalancerActions.d.ts +3 -0
- package/dist/loadBalancer/details/sections.d.ts +7 -0
- package/dist/loadBalancer/details/useCloudrunLoadBalancerDetails.d.ts +4 -0
- package/dist/loadBalancer/index.d.ts +4 -2
- package/dist/loadBalancer/loadBalancerTransformer.d.ts +2 -6
- package/dist/manifest/manifest.service.d.ts +5 -0
- package/dist/manifest/manifestCommandBuilder.service.d.ts +1 -1
- package/dist/pipeline/stages/deployManifest/manifestStatus/DeployStatus.d.ts +1 -0
- package/dist/pipeline/stages/deployManifest/manifestStatus/ManifestDetailsLink.d.ts +6 -3
- package/dist/pipeline/stages/editLoadBalancer/CloudrunEditLoadBalancerExecutionDetails.d.ts +7 -0
- package/dist/pipeline/stages/editLoadBalancer/CloudrunEditLoadBalancerStageConfig.d.ts +30 -0
- package/dist/pipeline/stages/editLoadBalancer/cloudrunEditLoadBalancerStage.d.ts +2 -1
- package/dist/serverGroup/configure/serverGroupCommandBuilder.service.d.ts +4 -6
- package/dist/serverGroup/configure/wizard/BasicSettings.d.ts +5 -2
- package/dist/serverGroup/configure/wizard/serverGroupWizard.d.ts +18 -6
- package/dist/serverGroup/details/CloudrunServerGroupActions.d.ts +6 -0
- package/dist/serverGroup/details/cloudrunServerGroupDetailsGetter.d.ts +3 -0
- package/dist/serverGroup/details/sections.d.ts +5 -0
- package/dist/serverGroup/index.d.ts +3 -1
- package/dist/serverGroup/serverGroupTransformer.service.d.ts +1 -5
- package/package.json +4 -11
- package/src/cloudrun.module.spec.ts +22 -0
- package/src/cloudrun.module.ts +54 -59
- package/src/common/ComponentUrlDetails.tsx +25 -0
- package/src/common/LoadBalancerMessage.tsx +17 -0
- package/src/index.ts +2 -1
- package/src/instance/details/CloudrunInstanceDetails.tsx +164 -0
- package/src/loadBalancer/configure/wizard/CloudrunLoadBalancerModal.spec.tsx +85 -0
- package/src/loadBalancer/configure/wizard/CloudrunLoadBalancerModal.tsx +395 -0
- package/src/loadBalancer/details/CloudrunLoadBalancerActions.tsx +66 -0
- package/src/loadBalancer/details/sections.spec.ts +19 -0
- package/src/loadBalancer/details/sections.tsx +91 -0
- package/src/loadBalancer/details/useCloudrunLoadBalancerDetails.ts +56 -0
- package/src/loadBalancer/index.ts +4 -2
- package/src/loadBalancer/loadBalancerTransformer.ts +3 -13
- package/src/manifest/manifest.service.ts +18 -1
- package/src/manifest/manifestCommandBuilder.service.ts +46 -53
- package/src/pipeline/stages/deployManifest/manifestStatus/DeployStatus.tsx +33 -4
- package/src/pipeline/stages/deployManifest/manifestStatus/ManifestDetailsLink.spec.tsx +35 -0
- package/src/pipeline/stages/deployManifest/manifestStatus/ManifestDetailsLink.tsx +10 -5
- package/src/pipeline/stages/editLoadBalancer/CloudrunEditLoadBalancerExecutionDetails.tsx +70 -0
- package/src/pipeline/stages/editLoadBalancer/CloudrunEditLoadBalancerStageConfig.tsx +245 -0
- package/src/pipeline/stages/editLoadBalancer/cloudrunEditLoadBalancerStage.spec.ts +205 -0
- package/src/pipeline/stages/editLoadBalancer/cloudrunEditLoadBalancerStage.ts +14 -71
- package/src/serverGroup/configure/serverGroupCommandBuilder.service.ts +5 -15
- package/src/serverGroup/configure/wizard/BasicSettings.tsx +10 -8
- package/src/serverGroup/configure/wizard/serverGroupWizard.tsx +59 -15
- package/src/serverGroup/details/CloudrunServerGroupActions.tsx +80 -0
- package/src/serverGroup/details/cloudrunServerGroupDetailsGetter.spec.ts +46 -0
- package/src/serverGroup/details/cloudrunServerGroupDetailsGetter.ts +53 -0
- package/src/serverGroup/details/sections.tsx +60 -0
- package/src/serverGroup/index.ts +3 -1
- package/src/serverGroup/routerConsumers.spec.tsx +152 -0
- package/src/serverGroup/serverGroupTransformer.service.ts +2 -12
- package/dist/common/componentUrlDetails.component.d.ts +0 -1
- package/dist/common/conditionalDescriptionListItem.component.d.ts +0 -1
- package/dist/common/loadBalancerMessage.component.d.ts +0 -1
- package/dist/instance/details/details.controller.d.ts +0 -1
- package/dist/loadBalancer/configure/wizard/allocationConfigurationRow.component.d.ts +0 -1
- package/dist/loadBalancer/configure/wizard/basicSettings.component.d.ts +0 -1
- package/dist/loadBalancer/configure/wizard/stageAllocationConfigurationRow.component.d.ts +0 -1
- package/dist/loadBalancer/configure/wizard/wizard.controller.d.ts +0 -2
- package/dist/loadBalancer/details/details.controller.d.ts +0 -1
- package/dist/pipeline/pipeline.module.d.ts +0 -1
- package/dist/pipeline/stages/editLoadBalancer/loadBalancerChoice.modal.controller.d.ts +0 -1
- package/dist/serverGroup/details/details.controller.d.ts +0 -1
- package/src/common/componentUrlDetails.component.ts +0 -22
- package/src/common/conditionalDescriptionListItem.component.ts +0 -37
- package/src/common/loadBalancerMessage.component.html +0 -11
- package/src/common/loadBalancerMessage.component.ts +0 -13
- package/src/instance/details/details.controller.ts +0 -84
- package/src/instance/details/details.html +0 -68
- package/src/loadBalancer/configure/wizard/allocationConfigurationRow.component.ts +0 -70
- package/src/loadBalancer/configure/wizard/basicSettings.component.html +0 -44
- package/src/loadBalancer/configure/wizard/basicSettings.component.ts +0 -86
- package/src/loadBalancer/configure/wizard/stageAllocationConfigurationRow.component.html +0 -45
- package/src/loadBalancer/configure/wizard/stageAllocationConfigurationRow.component.ts +0 -84
- package/src/loadBalancer/configure/wizard/wizard.controller.ts +0 -157
- package/src/loadBalancer/configure/wizard/wizard.html +0 -39
- package/src/loadBalancer/configure/wizard/wizard.less +0 -9
- package/src/loadBalancer/details/details.controller.ts +0 -140
- package/src/loadBalancer/details/details.html +0 -89
- package/src/pipeline/pipeline.module.ts +0 -6
- package/src/pipeline/stages/editLoadBalancer/editLoadBalancerExecutionDetails.html +0 -33
- package/src/pipeline/stages/editLoadBalancer/editLoadBalancerStage.html +0 -51
- package/src/pipeline/stages/editLoadBalancer/loadBalancerChoice.modal.controller.ts +0 -65
- package/src/pipeline/stages/editLoadBalancer/loadBalancerChoice.modal.html +0 -53
- package/src/serverGroup/details/details.controller.ts +0 -134
- package/src/serverGroup/details/details.html +0 -94
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import type { IComponentOptions, IController, IFilterService } from 'angular';
|
|
2
|
-
import { module } from 'angular';
|
|
3
|
-
|
|
4
|
-
class CloudrunConditionalDescriptionListItemCtrl implements IController {
|
|
5
|
-
public label: string;
|
|
6
|
-
public key: string;
|
|
7
|
-
public component: any;
|
|
8
|
-
|
|
9
|
-
public static $inject = ['$filter'];
|
|
10
|
-
constructor(private $filter: IFilterService) {}
|
|
11
|
-
|
|
12
|
-
public $onInit(): void {
|
|
13
|
-
if (!this.label) {
|
|
14
|
-
this.label = this.$filter<Function>('robotToHuman')(this.key);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const cloudrunConditionalDescriptionListItem: IComponentOptions = {
|
|
20
|
-
bindings: { label: '@', key: '@', component: '<' },
|
|
21
|
-
transclude: {
|
|
22
|
-
keyLabel: '?keyText',
|
|
23
|
-
valueLabel: '?valueLabel',
|
|
24
|
-
},
|
|
25
|
-
template: `
|
|
26
|
-
<dt ng-if="$ctrl.component[$ctrl.key]">{{$ctrl.label}}<span ng-transclude="keyLabel"></span></dt>
|
|
27
|
-
<dd ng-if="$ctrl.component[$ctrl.key]">{{$ctrl.component[$ctrl.key]}}<span ng-transclude="valueLabel"></span></dd>
|
|
28
|
-
`,
|
|
29
|
-
controller: CloudrunConditionalDescriptionListItemCtrl,
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export const CLOUDRUN_CONDITIONAL_DESCRIPTION_LIST_ITEM = 'spinnaker.cloudrun.conditionalDescriptionListItem';
|
|
33
|
-
|
|
34
|
-
module(CLOUDRUN_CONDITIONAL_DESCRIPTION_LIST_ITEM, []).component(
|
|
35
|
-
'cloudrunConditionalDtDd',
|
|
36
|
-
cloudrunConditionalDescriptionListItem,
|
|
37
|
-
);
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
<div class="row">
|
|
2
|
-
<div class="col-md-offset-{{ $ctrl.columnOffset || 0 }} col-md-{{ $ctrl.columns || 12 }}">
|
|
3
|
-
<div class="well">
|
|
4
|
-
<p>
|
|
5
|
-
<span ng-if="$ctrl.showCreateMessage">Spinnaker cannot create a load balancer for Cloud Run.</span>
|
|
6
|
-
A Spinnaker load balancer maps to an Cloud Run Service, which will be created automatically alongside a
|
|
7
|
-
Revision. Once created, the Service can be edited as a Load Balancer.
|
|
8
|
-
</p>
|
|
9
|
-
</div>
|
|
10
|
-
</div>
|
|
11
|
-
</div>
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { module } from 'angular';
|
|
2
|
-
|
|
3
|
-
const cloudRunLoadBalancerMessageComponent: ng.IComponentOptions = {
|
|
4
|
-
bindings: { showCreateMessage: '<', columnOffset: '@', columns: '@' },
|
|
5
|
-
templateUrl: require('./loadBalancerMessage.component.html'),
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
export const CLOUDRUN_LOAD_BALANCER_CREATE_MESSAGE = 'spinnaker.cloudrun.loadBalancer.createMessage.component';
|
|
9
|
-
|
|
10
|
-
module(CLOUDRUN_LOAD_BALANCER_CREATE_MESSAGE, []).component(
|
|
11
|
-
'cloudrunLoadBalancerMessage',
|
|
12
|
-
cloudRunLoadBalancerMessageComponent,
|
|
13
|
-
);
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import type { IController, IQService } from 'angular';
|
|
2
|
-
import { module } from 'angular';
|
|
3
|
-
import { flattenDeep } from 'lodash';
|
|
4
|
-
|
|
5
|
-
import type { Application, ILoadBalancer } from '@spinnaker/core';
|
|
6
|
-
import { InstanceReader, RecentHistoryService } from '@spinnaker/core';
|
|
7
|
-
import type { ICloudrunInstance } from '../../common/domain';
|
|
8
|
-
|
|
9
|
-
interface InstanceFromStateParams {
|
|
10
|
-
instanceId: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface InstanceManager {
|
|
14
|
-
account: string;
|
|
15
|
-
region: string;
|
|
16
|
-
category: string; // e.g., serverGroup, loadBalancer.
|
|
17
|
-
name: string; // Parent resource name, not instance name.
|
|
18
|
-
instances: ICloudrunInstance[];
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
class CloudrunInstanceDetailsController implements IController {
|
|
22
|
-
public state = { loading: true };
|
|
23
|
-
public instance: ICloudrunInstance;
|
|
24
|
-
public instanceIdNotFound: string;
|
|
25
|
-
public upToolTip = "A Cloud Run instance is 'Up' if a load balancer is directing traffic to its server group.";
|
|
26
|
-
public outOfServiceToolTip = `
|
|
27
|
-
A Cloud Run instance is 'Out Of Service' if no load balancers are directing traffic to its server group.`;
|
|
28
|
-
|
|
29
|
-
public static $inject = ['$q', 'app', 'instance'];
|
|
30
|
-
|
|
31
|
-
constructor(private $q: IQService, private app: Application, instance: InstanceFromStateParams) {
|
|
32
|
-
this.app
|
|
33
|
-
.ready()
|
|
34
|
-
.then(() => this.retrieveInstance(instance))
|
|
35
|
-
.then((instanceDetails) => {
|
|
36
|
-
this.instance = instanceDetails;
|
|
37
|
-
this.state.loading = false;
|
|
38
|
-
})
|
|
39
|
-
.catch(() => {
|
|
40
|
-
this.instanceIdNotFound = instance.instanceId;
|
|
41
|
-
this.state.loading = false;
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
private retrieveInstance(instance: InstanceFromStateParams): PromiseLike<ICloudrunInstance> {
|
|
46
|
-
const instanceLocatorPredicate = (dataSource: InstanceManager) => {
|
|
47
|
-
return dataSource.instances.some((possibleMatch) => possibleMatch.id === instance.instanceId);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const dataSources: InstanceManager[] = flattenDeep([
|
|
51
|
-
this.app.getDataSource('serverGroups').data,
|
|
52
|
-
this.app.getDataSource('loadBalancers').data,
|
|
53
|
-
this.app.getDataSource('loadBalancers').data.map((loadBalancer: ILoadBalancer) => loadBalancer.serverGroups),
|
|
54
|
-
]);
|
|
55
|
-
|
|
56
|
-
const instanceManager = dataSources.find(instanceLocatorPredicate);
|
|
57
|
-
|
|
58
|
-
if (instanceManager) {
|
|
59
|
-
const recentHistoryExtraData: { [key: string]: string } = {
|
|
60
|
-
region: instanceManager.region,
|
|
61
|
-
account: instanceManager.account,
|
|
62
|
-
};
|
|
63
|
-
if (instanceManager.category === 'serverGroup') {
|
|
64
|
-
recentHistoryExtraData.serverGroup = instanceManager.name;
|
|
65
|
-
}
|
|
66
|
-
RecentHistoryService.addExtraDataToLatest('instances', recentHistoryExtraData);
|
|
67
|
-
|
|
68
|
-
return InstanceReader.getInstanceDetails(
|
|
69
|
-
instanceManager.account,
|
|
70
|
-
instanceManager.region,
|
|
71
|
-
instance.instanceId,
|
|
72
|
-
).then((instanceDetails: ICloudrunInstance) => {
|
|
73
|
-
instanceDetails.account = instanceManager.account;
|
|
74
|
-
instanceDetails.region = instanceManager.region;
|
|
75
|
-
return instanceDetails;
|
|
76
|
-
});
|
|
77
|
-
} else {
|
|
78
|
-
return this.$q.reject();
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export const CLOUDRUN_INSTANCE_DETAILS_CTRL = 'spinnaker.cloudrun.instanceDetails.controller';
|
|
84
|
-
module(CLOUDRUN_INSTANCE_DETAILS_CTRL, []).controller('cloudrunInstanceDetailsCtrl', CloudrunInstanceDetailsController);
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
<div class="details-panel">
|
|
2
|
-
<div class="header">
|
|
3
|
-
<instance-details-header
|
|
4
|
-
health-state="ctrl.instance.healthState"
|
|
5
|
-
instance-id="ctrl.instance ? ctrl.instance.name : ctrl.instanceIdNotFound"
|
|
6
|
-
loading="ctrl.state.loading"
|
|
7
|
-
standalone="false"
|
|
8
|
-
></instance-details-header>
|
|
9
|
-
<div ng-if="!ctrl.state.loading">
|
|
10
|
-
<div class="actions">
|
|
11
|
-
<div class="dropdown" uib-dropdown dropdown-append-to-body>
|
|
12
|
-
<button type="button" class="btn btn-sm btn-primary dropdown-toggle" uib-dropdown-toggle>
|
|
13
|
-
Instance Actions <span class="caret"></span>
|
|
14
|
-
</button>
|
|
15
|
-
</div>
|
|
16
|
-
</div>
|
|
17
|
-
</div>
|
|
18
|
-
</div>
|
|
19
|
-
<div class="content" ng-if="!ctrl.state.loading && ctrl.instance">
|
|
20
|
-
<collapsible-section heading="Instance Information" expanded="true">
|
|
21
|
-
<dl class="dl-horizontal dl-narrow">
|
|
22
|
-
<dt>Launched</dt>
|
|
23
|
-
<dd ng-if="ctrl.instance.launchTime">{{ctrl.instance.launchTime | timestamp}}</dd>
|
|
24
|
-
<dt>In</dt>
|
|
25
|
-
<dd><account-tag account="ctrl.instance.account" pad="right"></account-tag>{{}}</dd>
|
|
26
|
-
<dt ng-if="ctrl.instance.serverGroup">Server Group</dt>
|
|
27
|
-
<dd ng-if="ctrl.instance.serverGroup">
|
|
28
|
-
<a
|
|
29
|
-
ui-sref="^.serverGroup({region: ctrl.instance.region,
|
|
30
|
-
accountId: ctrl.instance.account,
|
|
31
|
-
serverGroup: ctrl.instance.serverGroup,
|
|
32
|
-
provider: 'cloudrun'})"
|
|
33
|
-
>{{ctrl.instance.serverGroup}}</a
|
|
34
|
-
>
|
|
35
|
-
</dd>
|
|
36
|
-
<dt>Region</dt>
|
|
37
|
-
<dd>{{ctrl.instance.region}}</dd>
|
|
38
|
-
<cloudrun-conditional-dt-dd
|
|
39
|
-
component="ctrl.instance"
|
|
40
|
-
key="vmZoneName"
|
|
41
|
-
label="Zone"
|
|
42
|
-
></cloudrun-conditional-dt-dd>
|
|
43
|
-
</dl>
|
|
44
|
-
</collapsible-section>
|
|
45
|
-
<collapsible-section heading="Status" expanded="true">
|
|
46
|
-
<dl>
|
|
47
|
-
<dt>Load Balancer</dt>
|
|
48
|
-
<dd>
|
|
49
|
-
<span
|
|
50
|
-
class="pull-left"
|
|
51
|
-
uib-tooltip="{{ctrl.instance.healthState === 'Up' ? ctrl.upToolTip : ctrl.outOfServiceToolTip}}"
|
|
52
|
-
tooltip-placement="right"
|
|
53
|
-
>
|
|
54
|
-
<span class="glyphicon glyphicon-{{ctrl.instance.healthState}}-triangle"></span>
|
|
55
|
-
{{ctrl.instance.loadBalancers[0]}}
|
|
56
|
-
</span>
|
|
57
|
-
</dd>
|
|
58
|
-
</dl>
|
|
59
|
-
</collapsible-section>
|
|
60
|
-
</div>
|
|
61
|
-
<div class="content" ng-if="!ctrl.state.loading && !ctrl.instance">
|
|
62
|
-
<div class="content-section">
|
|
63
|
-
<div class="content-body text-center">
|
|
64
|
-
<h3>Instance not found.</h3>
|
|
65
|
-
</div>
|
|
66
|
-
</div>
|
|
67
|
-
</div>
|
|
68
|
-
</div>
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import type { IComponentOptions, IController } from 'angular';
|
|
2
|
-
import { module } from 'angular';
|
|
3
|
-
import { uniq } from 'lodash';
|
|
4
|
-
|
|
5
|
-
import type { ICloudrunAllocationDescription } from '../../loadBalancerTransformer';
|
|
6
|
-
|
|
7
|
-
class CloudrunAllocationConfigurationRowCtrl implements IController {
|
|
8
|
-
public allocationDescription: ICloudrunAllocationDescription;
|
|
9
|
-
public serverGroupOptions: string[];
|
|
10
|
-
|
|
11
|
-
public getServerGroupOptions(): string[] {
|
|
12
|
-
if (this.allocationDescription.revisionName) {
|
|
13
|
-
return uniq(this.serverGroupOptions.concat(this.allocationDescription.revisionName));
|
|
14
|
-
} else {
|
|
15
|
-
return this.serverGroupOptions;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const cloudrunAllocationConfigurationRowComponent: IComponentOptions = {
|
|
21
|
-
bindings: {
|
|
22
|
-
allocationDescription: '<',
|
|
23
|
-
removeAllocation: '&',
|
|
24
|
-
serverGroupOptions: '<',
|
|
25
|
-
onAllocationChange: '&',
|
|
26
|
-
},
|
|
27
|
-
template: `
|
|
28
|
-
<div class="form-group">
|
|
29
|
-
<div class="row">
|
|
30
|
-
<div class="col-md-7">
|
|
31
|
-
<ui-select ng-model="$ctrl.allocationDescription.revisionName"
|
|
32
|
-
on-select="$ctrl.onAllocationChange()"
|
|
33
|
-
class="form-control input-sm">
|
|
34
|
-
<ui-select-match placeholder="Select...">
|
|
35
|
-
{{$select.selected}}
|
|
36
|
-
</ui-select-match>
|
|
37
|
-
<ui-select-choices repeat="serverGroup as serverGroup in $ctrl.getServerGroupOptions() | filter: $select.search">
|
|
38
|
-
<div ng-bind-html="serverGroup | highlight: $select.search"></div>
|
|
39
|
-
</ui-select-choices>
|
|
40
|
-
</ui-select>
|
|
41
|
-
</div>
|
|
42
|
-
<div class="col-md-3">
|
|
43
|
-
<div class="input-group input-group-sm">
|
|
44
|
-
<input type="number"
|
|
45
|
-
ng-model="$ctrl.allocationDescription.percent"
|
|
46
|
-
required
|
|
47
|
-
class="form-control input-sm"
|
|
48
|
-
min="0"
|
|
49
|
-
ng-change="$ctrl.onAllocationChange()"
|
|
50
|
-
max="100"/>
|
|
51
|
-
<span class="input-group-addon">%</span>
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
<div class="col-md-2">
|
|
55
|
-
<a class="btn btn-link sm-label" ng-click="$ctrl.removeAllocation()">
|
|
56
|
-
<span class="glyphicon glyphicon-trash"></span>
|
|
57
|
-
</a>
|
|
58
|
-
</div>
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
`,
|
|
62
|
-
controller: CloudrunAllocationConfigurationRowCtrl,
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
export const CLOUDRUN_ALLOCATION_CONFIGURATION_ROW = 'spinnaker.cloudrun.allocationConfigurationRow.component';
|
|
66
|
-
|
|
67
|
-
module(CLOUDRUN_ALLOCATION_CONFIGURATION_ROW, []).component(
|
|
68
|
-
'cloudrunAllocationConfigurationRow',
|
|
69
|
-
cloudrunAllocationConfigurationRowComponent,
|
|
70
|
-
);
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
<ng-form name="basicSettingsForm">
|
|
2
|
-
<div class="row">
|
|
3
|
-
<div class="form-group">
|
|
4
|
-
<div class="col-md-3 sm-label-right">
|
|
5
|
-
Allocations
|
|
6
|
-
<help-field key="cloudrun.loadBalancer.allocations"></help-field>
|
|
7
|
-
</div>
|
|
8
|
-
<div class="col-md-9">
|
|
9
|
-
<div ng-if="!$ctrl.forPipelineConfig">
|
|
10
|
-
<cloudrun-allocation-configuration-row
|
|
11
|
-
ng-repeat="description in $ctrl.loadBalancer.splitDescription.allocationDescriptions"
|
|
12
|
-
allocation-description="description"
|
|
13
|
-
server-group-options="$ctrl.serverGroupOptions"
|
|
14
|
-
on-allocation-change="$ctrl.updateServerGroupOptions()"
|
|
15
|
-
remove-allocation="$ctrl.removeAllocation($index)"
|
|
16
|
-
>
|
|
17
|
-
</cloudrun-allocation-configuration-row>
|
|
18
|
-
</div>
|
|
19
|
-
<div ng-if="$ctrl.forPipelineConfig">
|
|
20
|
-
<cloudrun-stage-allocation-configuration-row
|
|
21
|
-
ng-repeat="description in $ctrl.loadBalancer.splitDescription.allocationDescriptions"
|
|
22
|
-
allocation-description="description"
|
|
23
|
-
application="$ctrl.application"
|
|
24
|
-
region="{{ $ctrl.loadBalancer.region }}"
|
|
25
|
-
account="{{ $ctrl.loadBalancer.account || $ctrl.loadBalancer.credentials }}"
|
|
26
|
-
name="{{ $ctrl.loadBalancer.name }}"
|
|
27
|
-
server-group-options="$ctrl.serverGroupOptions"
|
|
28
|
-
on-allocation-change="$ctrl.updateServerGroupOptions()"
|
|
29
|
-
remove-allocation="$ctrl.removeAllocation($index)"
|
|
30
|
-
>
|
|
31
|
-
</cloudrun-stage-allocation-configuration-row>
|
|
32
|
-
</div>
|
|
33
|
-
<button class="add-new col-md-11" ng-if="$ctrl.showAddButton()" ng-click="$ctrl.addAllocation()">
|
|
34
|
-
<span class="glyphicon glyphicon-plus-sign"></span> Add allocation
|
|
35
|
-
</button>
|
|
36
|
-
</div>
|
|
37
|
-
</div>
|
|
38
|
-
<div class="form-group" ng-if="$ctrl.allocationIsInvalid()">
|
|
39
|
-
<div class="col-md-12 text-center">
|
|
40
|
-
<p class="alert alert-warning">Allocations must sum to 100%.</p>
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
</ng-form>
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
import type { IController } from 'angular';
|
|
2
|
-
import { module } from 'angular';
|
|
3
|
-
import { difference } from 'lodash';
|
|
4
|
-
|
|
5
|
-
import type { CloudrunLoadBalancerUpsertDescription } from '../../loadBalancerTransformer';
|
|
6
|
-
|
|
7
|
-
class CloudrunLoadBalancerSettingsController implements IController {
|
|
8
|
-
public loadBalancer: CloudrunLoadBalancerUpsertDescription;
|
|
9
|
-
public serverGroupOptions: string[];
|
|
10
|
-
public forPipelineConfig: boolean;
|
|
11
|
-
|
|
12
|
-
public $onInit(): void {
|
|
13
|
-
this.updateServerGroupOptions();
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
public addAllocation(): void {
|
|
17
|
-
const remainingServerGroups = this.serverGroupsWithoutAllocation();
|
|
18
|
-
if (remainingServerGroups.length) {
|
|
19
|
-
this.loadBalancer.splitDescription.allocationDescriptions.push({
|
|
20
|
-
revisionName: remainingServerGroups[0],
|
|
21
|
-
percent: 0,
|
|
22
|
-
});
|
|
23
|
-
this.updateServerGroupOptions();
|
|
24
|
-
} else if (this.forPipelineConfig) {
|
|
25
|
-
this.loadBalancer.splitDescription.allocationDescriptions.push({
|
|
26
|
-
percent: 0,
|
|
27
|
-
revisionName: '',
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
public removeAllocation(index: number): void {
|
|
33
|
-
this.loadBalancer.splitDescription.allocationDescriptions.splice(index, 1);
|
|
34
|
-
this.updateServerGroupOptions();
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
public allocationIsInvalid(): boolean {
|
|
38
|
-
return (
|
|
39
|
-
this.loadBalancer.splitDescription.allocationDescriptions.reduce(
|
|
40
|
-
(sum, allocationDescription) => sum + allocationDescription.percent,
|
|
41
|
-
0,
|
|
42
|
-
) !== 100
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
public updateServerGroupOptions(): void {
|
|
47
|
-
this.serverGroupOptions = this.serverGroupsWithoutAllocation();
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
public showAddButton(): boolean {
|
|
51
|
-
if (this.forPipelineConfig) {
|
|
52
|
-
return true;
|
|
53
|
-
} else {
|
|
54
|
-
return this.serverGroupsWithoutAllocation().length > 0;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
public initializeAsTextInput(serverGroupName: string): boolean {
|
|
59
|
-
if (this.forPipelineConfig) {
|
|
60
|
-
return !this.loadBalancer.serverGroups.map((serverGroup) => serverGroup.name).includes(serverGroupName);
|
|
61
|
-
} else {
|
|
62
|
-
return false;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
private serverGroupsWithoutAllocation(): string[] {
|
|
67
|
-
const serverGroupsWithAllocation = this.loadBalancer.splitDescription.allocationDescriptions.map(
|
|
68
|
-
(description) => description.revisionName,
|
|
69
|
-
);
|
|
70
|
-
const allServerGroups = this.loadBalancer.serverGroups.map((serverGroup) => serverGroup.name);
|
|
71
|
-
return difference(allServerGroups, serverGroupsWithAllocation);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
const cloudrunLoadBalancerSettingsComponent: ng.IComponentOptions = {
|
|
76
|
-
bindings: { loadBalancer: '=', forPipelineConfig: '<', application: '<' },
|
|
77
|
-
controller: CloudrunLoadBalancerSettingsController,
|
|
78
|
-
templateUrl: require('./basicSettings.component.html'),
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
export const CLOUDRUN_LOAD_BALANCER_BASIC_SETTINGS = 'spinnaker.cloudrun.loadBalancerSettings.component';
|
|
82
|
-
|
|
83
|
-
module(CLOUDRUN_LOAD_BALANCER_BASIC_SETTINGS, []).component(
|
|
84
|
-
'cloudrunLoadBalancerBasicSettings',
|
|
85
|
-
cloudrunLoadBalancerSettingsComponent,
|
|
86
|
-
);
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
<div class="form-group">
|
|
2
|
-
<div class="row">
|
|
3
|
-
<div class="col-md-7">
|
|
4
|
-
<cloudrun-stage-allocation-label allocation-description="$ctrl.allocationDescription">
|
|
5
|
-
</cloudrun-stage-allocation-label>
|
|
6
|
-
</div>
|
|
7
|
-
<div class="col-md-3">
|
|
8
|
-
<div class="input-group input-group-sm">
|
|
9
|
-
<input
|
|
10
|
-
type="number"
|
|
11
|
-
ng-model="$ctrl.allocationDescription.percent"
|
|
12
|
-
required
|
|
13
|
-
class="form-control input-sm"
|
|
14
|
-
min="0"
|
|
15
|
-
ng-change="$ctrl.onAllocationChange()"
|
|
16
|
-
max="100"
|
|
17
|
-
/>
|
|
18
|
-
<span class="input-group-addon">%</span>
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
<div class="col-md-2">
|
|
22
|
-
<a class="btn btn-link sm-label" ng-click="$ctrl.removeAllocation()">
|
|
23
|
-
<span class="glyphicon glyphicon-trash"></span>
|
|
24
|
-
</a>
|
|
25
|
-
</div>
|
|
26
|
-
</div>
|
|
27
|
-
</div>
|
|
28
|
-
<div class="form-group">
|
|
29
|
-
<div class="well col-md-11" style="padding-top: 5px; padding-bottom: 10px">
|
|
30
|
-
<div class="row">
|
|
31
|
-
<div class="form-group">
|
|
32
|
-
<div>
|
|
33
|
-
<div class="col-md-3 sm-label-right">Cluster</div>
|
|
34
|
-
<div class="col-md-7" style="margin-bottom: 10px">
|
|
35
|
-
<input ng-model="$ctrl.allocationDescription.cluster" type="text" class="form-control input-sm" readonly />
|
|
36
|
-
</div>
|
|
37
|
-
<div class="col-md-3 sm-label-right">Target</div>
|
|
38
|
-
<div class="col-md-7">
|
|
39
|
-
<target-select model="$ctrl.allocationDescription" options="$ctrl.targets"></target-select>
|
|
40
|
-
</div>
|
|
41
|
-
</div>
|
|
42
|
-
</div>
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import type { IComponentOptions, IController } from 'angular';
|
|
2
|
-
import { module } from 'angular';
|
|
3
|
-
import { uniq } from 'lodash';
|
|
4
|
-
|
|
5
|
-
import { StageConstants } from '@spinnaker/core';
|
|
6
|
-
|
|
7
|
-
import type { ICloudrunAllocationDescription } from '../../loadBalancerTransformer';
|
|
8
|
-
|
|
9
|
-
class CloudrunStageAllocationLabelCtrl implements IController {
|
|
10
|
-
public inputViewValue: string;
|
|
11
|
-
private allocationDescription: ICloudrunAllocationDescription;
|
|
12
|
-
|
|
13
|
-
private static mapTargetCoordinateToLabel(targetCoordinate: string): string {
|
|
14
|
-
const target = StageConstants.TARGET_LIST.find((t) => t.val === targetCoordinate);
|
|
15
|
-
if (target) {
|
|
16
|
-
return target.label;
|
|
17
|
-
} else {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
public $doCheck(): void {
|
|
23
|
-
this.setInputViewValue();
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
private setInputViewValue(): void {
|
|
27
|
-
if (this.allocationDescription.cluster && this.allocationDescription.target) {
|
|
28
|
-
const targetLabel = CloudrunStageAllocationLabelCtrl.mapTargetCoordinateToLabel(
|
|
29
|
-
this.allocationDescription.target,
|
|
30
|
-
);
|
|
31
|
-
this.inputViewValue = `${targetLabel} (${this.allocationDescription.cluster})`;
|
|
32
|
-
} else {
|
|
33
|
-
this.inputViewValue = null;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
const cloudrunStageAllocationLabel: IComponentOptions = {
|
|
39
|
-
bindings: { allocationDescription: '<' },
|
|
40
|
-
controller: CloudrunStageAllocationLabelCtrl,
|
|
41
|
-
template: `<input ng-model="$ctrl.inputViewValue" type="text" class="form-control input-sm" readonly/>`,
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
class CloudrunStageAllocationConfigurationRowCtrl implements IController {
|
|
45
|
-
public allocationDescription: ICloudrunAllocationDescription;
|
|
46
|
-
public serverGroupOptions: string[];
|
|
47
|
-
public targets = StageConstants.TARGET_LIST;
|
|
48
|
-
public clusterList: string[];
|
|
49
|
-
public onAllocationChange: Function;
|
|
50
|
-
private name: string;
|
|
51
|
-
|
|
52
|
-
public $onInit() {
|
|
53
|
-
this.allocationDescription.cluster = this.name;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
public getServerGroupOptions(): string[] {
|
|
57
|
-
if (this.allocationDescription.revisionName) {
|
|
58
|
-
return uniq(this.serverGroupOptions.concat(this.allocationDescription.revisionName));
|
|
59
|
-
} else {
|
|
60
|
-
return this.serverGroupOptions;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const cloudrunStageAllocationConfigurationRow: IComponentOptions = {
|
|
66
|
-
bindings: {
|
|
67
|
-
application: '<',
|
|
68
|
-
region: '@',
|
|
69
|
-
account: '@',
|
|
70
|
-
name: '@',
|
|
71
|
-
allocationDescription: '<',
|
|
72
|
-
removeAllocation: '&',
|
|
73
|
-
serverGroupOptions: '<',
|
|
74
|
-
onAllocationChange: '&',
|
|
75
|
-
},
|
|
76
|
-
controller: CloudrunStageAllocationConfigurationRowCtrl,
|
|
77
|
-
templateUrl: require('./stageAllocationConfigurationRow.component.html'),
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
export const CLOUDRUN_STAGE_ALLOCATION_CONFIGURATION_ROW =
|
|
81
|
-
'spinnaker.cloudrun.stageAllocationConfigurationRow.component';
|
|
82
|
-
module(CLOUDRUN_STAGE_ALLOCATION_CONFIGURATION_ROW, [])
|
|
83
|
-
.component('cloudrunStageAllocationConfigurationRow', cloudrunStageAllocationConfigurationRow)
|
|
84
|
-
.component('cloudrunStageAllocationLabel', cloudrunStageAllocationLabel);
|