@spinnaker/amazon 2026.4.1 → 2026.4.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/dist/common/awsSdkFieldNames.d.ts +24 -0
- package/dist/domain/IAmazonFunction.d.ts +2 -1
- package/dist/domain/IAmazonFunctionSourceData.d.ts +2 -1
- package/dist/domain/IAmazonLoadBalancerSourceData.d.ts +5 -2
- package/dist/domain/IAmazonServerGroup.d.ts +1 -0
- package/dist/domain/IScalingPolicy.d.ts +1 -0
- package/dist/index.js +193 -193
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/common/awsSdkFieldNames.spec.ts +47 -0
- package/src/common/awsSdkFieldNames.ts +26 -0
- package/src/domain/IAmazonFunction.ts +2 -1
- package/src/domain/IAmazonFunctionSourceData.ts +2 -1
- package/src/domain/IAmazonLoadBalancerSourceData.ts +6 -6
- package/src/domain/IAmazonServerGroup.ts +2 -1
- package/src/domain/IScalingPolicy.ts +2 -1
- package/src/function/function.transformer.spec.ts +23 -0
- package/src/function/function.transformer.ts +4 -1
- package/src/loadBalancer/TargetGroupDetails.tsx +2 -1
- package/src/loadBalancer/details/amazonLoadBalancerDetails.tsx +3 -2
- package/src/loadBalancer/loadBalancer.transformer.spec.ts +50 -0
- package/src/loadBalancer/loadBalancer.transformer.ts +13 -10
- package/src/serverGroup/configure/serverGroupCommandBuilder.aws.service.spec.js +27 -3
- package/src/serverGroup/configure/serverGroupCommandBuilder.service.ts +3 -2
- package/src/serverGroup/configure/serverGroupCommandBuilder.spec.js +4 -4
- package/src/serverGroup/details/amazonServerGroupDetailsGetter.ts +3 -2
- package/src/serverGroup/details/scalingPolicy/targetTracking/TargetTrackingChart.tsx +1 -1
- package/src/serverGroup/details/scalingPolicy/upsert/ScalingPolicyCommandBuilderService.ts +2 -1
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"url": "https://github.com/spinnaker/spinnaker.git"
|
|
6
6
|
},
|
|
7
7
|
"license": "Apache-2.0",
|
|
8
|
-
"version": "2026.4.
|
|
8
|
+
"version": "2026.4.2",
|
|
9
9
|
"module": "dist/index.js",
|
|
10
10
|
"typings": "dist/index.d.ts",
|
|
11
11
|
"publishConfig": {
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"shx": "0.3.3",
|
|
54
54
|
"typescript": "5.0.4"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "a455cb2bf1d417754d40d8f575ee5514d4bc2abd"
|
|
57
57
|
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Copyright 2026 spinnaker.io
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
getDnsName,
|
|
6
|
+
getKmsKeyArn,
|
|
7
|
+
getOkActions,
|
|
8
|
+
getSslCertificateId,
|
|
9
|
+
getVpcId,
|
|
10
|
+
getVpcZoneIdentifier,
|
|
11
|
+
} from './awsSdkFieldNames';
|
|
12
|
+
|
|
13
|
+
describe('awsSdkFieldNames', () => {
|
|
14
|
+
const cases: Array<{ name: string; read: (o: any) => any; current: string; legacy: string }> = [
|
|
15
|
+
{
|
|
16
|
+
name: 'getVpcZoneIdentifier',
|
|
17
|
+
read: getVpcZoneIdentifier,
|
|
18
|
+
current: 'vpcZoneIdentifier',
|
|
19
|
+
legacy: 'vpczoneIdentifier',
|
|
20
|
+
},
|
|
21
|
+
{ name: 'getDnsName', read: getDnsName, current: 'dnsName', legacy: 'dnsname' },
|
|
22
|
+
{ name: 'getVpcId', read: getVpcId, current: 'vpcId', legacy: 'vpcid' },
|
|
23
|
+
{ name: 'getSslCertificateId', read: getSslCertificateId, current: 'sslCertificateId', legacy: 'sslcertificateId' },
|
|
24
|
+
{ name: 'getKmsKeyArn', read: getKmsKeyArn, current: 'kmsKeyArn', legacy: 'kmskeyArn' },
|
|
25
|
+
{ name: 'getOkActions', read: getOkActions, current: 'okActions', legacy: 'okactions' },
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
cases.forEach(({ name, read, current, legacy }) => {
|
|
29
|
+
describe(name, () => {
|
|
30
|
+
it(`reads ${current}`, () => {
|
|
31
|
+
expect(read({ [current]: 'new' })).toBe('new');
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
it(`falls back to legacy ${legacy}`, () => {
|
|
35
|
+
expect(read({ [legacy]: 'old' })).toBe('old');
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it(`prefers ${current} over ${legacy}`, () => {
|
|
39
|
+
expect(read({ [current]: 'new', [legacy]: 'old' })).toBe('new');
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('tolerates a missing object', () => {
|
|
43
|
+
expect(read(undefined)).toBeUndefined();
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Copyright 2026 spinnaker.io
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
// Clouddriver serializes AWS SDK v2 model objects using their builder property names
|
|
5
|
+
// (e.g. vpcZoneIdentifier, dnsName). Data cached before that change still carries the
|
|
6
|
+
// AWS SDK v1 Jackson names (e.g. vpczoneIdentifier, dnsname). These accessors prefer the
|
|
7
|
+
// builder name and fall back to the legacy name.
|
|
8
|
+
// legacy: pre-AWS SDK v2 builder names; remove the fallbacks once caches have refreshed
|
|
9
|
+
|
|
10
|
+
export const getVpcZoneIdentifier = (asg: { vpcZoneIdentifier?: string; vpczoneIdentifier?: string }): string =>
|
|
11
|
+
asg?.vpcZoneIdentifier ?? asg?.vpczoneIdentifier;
|
|
12
|
+
|
|
13
|
+
export const getDnsName = (loadBalancer: { dnsName?: string; dnsname?: string }): string =>
|
|
14
|
+
loadBalancer?.dnsName ?? loadBalancer?.dnsname;
|
|
15
|
+
|
|
16
|
+
export const getVpcId = (loadBalancer: { vpcId?: string; vpcid?: string }): string =>
|
|
17
|
+
loadBalancer?.vpcId || loadBalancer?.vpcid;
|
|
18
|
+
|
|
19
|
+
export const getSslCertificateId = (listener: { sslCertificateId?: string; sslcertificateId?: string }): string =>
|
|
20
|
+
listener?.sslCertificateId ?? listener?.sslcertificateId;
|
|
21
|
+
|
|
22
|
+
export const getKmsKeyArn = (functionDef: { kmsKeyArn?: string; kmskeyArn?: string }): string =>
|
|
23
|
+
functionDef?.kmsKeyArn ?? functionDef?.kmskeyArn;
|
|
24
|
+
|
|
25
|
+
export const getOkActions = (alarm: { okActions?: string[]; okactions?: string[] }): string[] =>
|
|
26
|
+
alarm?.okActions ?? alarm?.okactions;
|
|
@@ -23,7 +23,8 @@ export interface IAmazonFunction extends IFunction {
|
|
|
23
23
|
deadLetterConfig: {
|
|
24
24
|
targetArn: string;
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
kmsKeyArn?: string;
|
|
27
|
+
kmskeyArn?: string; // legacy: pre-AWS SDK v2 builder name; remove once caches have refreshed
|
|
27
28
|
vpcConfig: {
|
|
28
29
|
securityGroupIds: [];
|
|
29
30
|
subnetIds: [];
|
|
@@ -40,6 +40,7 @@ export interface IAmazonFunctionSourceData extends IFunctionSourceData {
|
|
|
40
40
|
deadLetterConfig: {
|
|
41
41
|
targetArn: string;
|
|
42
42
|
};
|
|
43
|
-
|
|
43
|
+
kmsKeyArn?: string;
|
|
44
|
+
kmskeyArn?: string; // legacy: pre-AWS SDK v2 builder name; remove once caches have refreshed
|
|
44
45
|
targetGroups: string[];
|
|
45
46
|
}
|
|
@@ -37,6 +37,8 @@ export interface IClassicListenerSourceData {
|
|
|
37
37
|
instanceProtocol: string;
|
|
38
38
|
loadBalancerPort: number;
|
|
39
39
|
protocol: string;
|
|
40
|
+
sslCertificateId?: string;
|
|
41
|
+
sslcertificateId?: string; // legacy: pre-AWS SDK v2 builder name; remove once caches have refreshed
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
export interface IAmazonLoadBalancerSourceData extends ILoadBalancerSourceData {
|
|
@@ -44,7 +46,8 @@ export interface IAmazonLoadBalancerSourceData extends ILoadBalancerSourceData {
|
|
|
44
46
|
availabilityZones: string[];
|
|
45
47
|
cloudProvider: string;
|
|
46
48
|
createdTime: number;
|
|
47
|
-
|
|
49
|
+
dnsName?: string;
|
|
50
|
+
dnsname?: string; // legacy: pre-AWS SDK v2 builder name; remove once caches have refreshed
|
|
48
51
|
loadBalancerName: string;
|
|
49
52
|
loadBalancerType?: string;
|
|
50
53
|
name: string;
|
|
@@ -55,10 +58,7 @@ export interface IAmazonLoadBalancerSourceData extends ILoadBalancerSourceData {
|
|
|
55
58
|
subnets: string[];
|
|
56
59
|
type: string;
|
|
57
60
|
vpcId: string;
|
|
58
|
-
//
|
|
59
|
-
// and was cached with some of that. Until caches roll off and we are
|
|
60
|
-
// sure clouddriver is cleaed up, leave this dirtiness in here
|
|
61
|
-
vpcid?: string;
|
|
61
|
+
vpcid?: string; // legacy: pre-AWS SDK v2 builder name; remove once caches have refreshed
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
export interface IAmazonLoadBalancerInstanceSourceData {
|
|
@@ -175,7 +175,7 @@ export interface IClassicLoadBalancerSourceData extends IAmazonLoadBalancerSourc
|
|
|
175
175
|
CookieName: string;
|
|
176
176
|
PolicyName: string;
|
|
177
177
|
}>;
|
|
178
|
-
|
|
178
|
+
lbCookieStickinessPolicies: Array<{
|
|
179
179
|
CookieExpirationPeriod: string;
|
|
180
180
|
PolicyName: string;
|
|
181
181
|
}>;
|
|
@@ -30,7 +30,8 @@ export interface IAmazonAsg extends IAsg {
|
|
|
30
30
|
loadBalancerNames: string[];
|
|
31
31
|
terminationPolicies: string[];
|
|
32
32
|
enabledMetrics: Array<{ metric: string }>;
|
|
33
|
-
|
|
33
|
+
vpcZoneIdentifier?: string;
|
|
34
|
+
vpczoneIdentifier?: string; // legacy: pre-AWS SDK v2 builder name; remove once caches have refreshed
|
|
34
35
|
suspendedProcesses?: ISuspendedProcess[];
|
|
35
36
|
capacityRebalance?: boolean;
|
|
36
37
|
tags: IAmazonAsgTag[];
|
|
@@ -11,7 +11,8 @@ export interface IScalingPolicyAlarm {
|
|
|
11
11
|
period: number;
|
|
12
12
|
threshold: number;
|
|
13
13
|
comparisonOperator: AlarmComparisonOperator;
|
|
14
|
-
|
|
14
|
+
okActions?: string[];
|
|
15
|
+
okactions?: string[]; // legacy: pre-AWS SDK v2 builder name; remove once caches have refreshed
|
|
15
16
|
insufficientDataActions?: string[];
|
|
16
17
|
alarmActions?: string[];
|
|
17
18
|
evaluationPeriods?: number;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Copyright 2026 spinnaker.io
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { AwsFunctionTransformer } from './function.transformer';
|
|
5
|
+
|
|
6
|
+
describe('AwsFunctionTransformer.convertFunctionForEditing', () => {
|
|
7
|
+
const kmsKeyArn = 'arn:aws:kms:us-east-1:123456789012:key/abcd';
|
|
8
|
+
|
|
9
|
+
[
|
|
10
|
+
{ desc: 'kmsKeyArn', functionDef: { kmsKeyArn } },
|
|
11
|
+
{ desc: 'legacy kmskeyArn', functionDef: { kmskeyArn: kmsKeyArn } },
|
|
12
|
+
].forEach(({ desc, functionDef }) => {
|
|
13
|
+
it(`maps ${desc} onto the kmskeyArn upsert field`, () => {
|
|
14
|
+
const command = new AwsFunctionTransformer().convertFunctionForEditing({
|
|
15
|
+
account: 'test',
|
|
16
|
+
region: 'us-east-1',
|
|
17
|
+
...functionDef,
|
|
18
|
+
} as any);
|
|
19
|
+
|
|
20
|
+
expect(command.kmskeyArn).toBe(kmsKeyArn);
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
});
|
|
@@ -2,6 +2,7 @@ import { isEmpty } from 'lodash';
|
|
|
2
2
|
|
|
3
3
|
import type { Application } from '@spinnaker/core';
|
|
4
4
|
import { AWSProviderSettings } from '../aws.settings';
|
|
5
|
+
import { getKmsKeyArn } from '../common/awsSdkFieldNames';
|
|
5
6
|
import type { IAmazonFunction, IAmazonFunctionUpsertCommand } from '../domain';
|
|
6
7
|
|
|
7
8
|
export class AwsFunctionTransformer {
|
|
@@ -25,7 +26,9 @@ export class AwsFunctionTransformer {
|
|
|
25
26
|
deadLetterConfig: {
|
|
26
27
|
targetArn: functionDef.deadLetterConfig ? functionDef.deadLetterConfig.targetArn : '',
|
|
27
28
|
},
|
|
28
|
-
|
|
29
|
+
// The upsert description field is still named kmskeyArn
|
|
30
|
+
kmskeyArn: getKmsKeyArn(functionDef),
|
|
31
|
+
KMSKeyArn: getKmsKeyArn(functionDef) || '',
|
|
29
32
|
subnetIds: functionDef.vpcConfig ? functionDef.vpcConfig.subnetIds : [],
|
|
30
33
|
securityGroupIds: functionDef.vpcConfig ? functionDef.vpcConfig.securityGroupIds : [],
|
|
31
34
|
vpcId: functionDef.vpcConfig ? functionDef.vpcConfig.vpcId : '',
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
withRouter,
|
|
13
13
|
} from '@spinnaker/core';
|
|
14
14
|
|
|
15
|
+
import { getDnsName } from '../common/awsSdkFieldNames';
|
|
15
16
|
import type { IAmazonApplicationLoadBalancer, ITargetGroup } from '../domain';
|
|
16
17
|
import { VpcTag } from '../vpc/VpcTag';
|
|
17
18
|
|
|
@@ -148,7 +149,7 @@ export class TargetGroupDetailsComponent extends React.Component<
|
|
|
148
149
|
}
|
|
149
150
|
|
|
150
151
|
private renderDetails(loadBalancer: IAmazonApplicationLoadBalancer, targetGroup: ITargetGroup) {
|
|
151
|
-
const dnsName = (loadBalancer as any)
|
|
152
|
+
const dnsName = getDnsName(loadBalancer as any) || getDnsName(loadBalancer.elb);
|
|
152
153
|
const attributes = (targetGroup.attributes || {}) as any;
|
|
153
154
|
return (
|
|
154
155
|
<div className="content">
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
} from '@spinnaker/core';
|
|
29
29
|
|
|
30
30
|
import { LoadBalancerActions } from './LoadBalancerActions';
|
|
31
|
+
import { getDnsName, getVpcId } from '../../common/awsSdkFieldNames';
|
|
31
32
|
import type {
|
|
32
33
|
IAmazonApplicationLoadBalancer,
|
|
33
34
|
IAmazonLoadBalancer,
|
|
@@ -165,7 +166,7 @@ export async function loadAmazonLoadBalancerDetails({
|
|
|
165
166
|
.get()) as IAmazonLoadBalancerSourceData[];
|
|
166
167
|
if (details.length) {
|
|
167
168
|
loadBalancer.elb = details[0];
|
|
168
|
-
loadBalancer.elb.vpcId = loadBalancer.elb
|
|
169
|
+
loadBalancer.elb.vpcId = getVpcId(loadBalancer.elb);
|
|
169
170
|
loadBalancer.account = accountId;
|
|
170
171
|
loadBalancer.securityGroups = resolveSecurityGroups(
|
|
171
172
|
app,
|
|
@@ -292,7 +293,7 @@ export function AmazonLoadBalancerActions({ app, loadBalancer }: ILoadBalancerAc
|
|
|
292
293
|
export function AmazonLoadBalancerDetailsSection({ app, loadBalancer }: ILoadBalancerDetailsSectionProps): JSX.Element {
|
|
293
294
|
const amazonLoadBalancer = loadBalancer as IAmazonLoadBalancer;
|
|
294
295
|
const elb = amazonLoadBalancer.elb || ({} as IAmazonLoadBalancerSourceData);
|
|
295
|
-
const dnsName =
|
|
296
|
+
const dnsName = getDnsName(elb);
|
|
296
297
|
const subnetPurpose = head((amazonLoadBalancer.subnetDetails || []).map((subnet) => subnet.purpose)) || '';
|
|
297
298
|
|
|
298
299
|
return (
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// Copyright 2026 spinnaker.io
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { AwsLoadBalancerTransformer } from './loadBalancer.transformer';
|
|
5
|
+
|
|
6
|
+
describe('AwsLoadBalancerTransformer.convertClassicLoadBalancerForEditing', () => {
|
|
7
|
+
const certificateArn = 'arn:aws:iam::123456789012:server-certificate/my-cert';
|
|
8
|
+
|
|
9
|
+
const classicLoadBalancer = (listener: any, vpc: any): any => ({
|
|
10
|
+
name: 'app-frontend',
|
|
11
|
+
region: 'us-east-1',
|
|
12
|
+
account: 'test',
|
|
13
|
+
availabilityZones: [],
|
|
14
|
+
elb: {
|
|
15
|
+
securityGroups: [],
|
|
16
|
+
...vpc,
|
|
17
|
+
listenerDescriptions: [
|
|
18
|
+
{
|
|
19
|
+
listener: {
|
|
20
|
+
protocol: 'HTTPS',
|
|
21
|
+
loadBalancerPort: 443,
|
|
22
|
+
instanceProtocol: 'HTTP',
|
|
23
|
+
instancePort: 7001,
|
|
24
|
+
...listener,
|
|
25
|
+
},
|
|
26
|
+
policyNames: [],
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
[
|
|
33
|
+
{ desc: 'SDK v2 builder names', listener: { sslCertificateId: certificateArn }, vpc: { vpcId: 'vpc-1' } },
|
|
34
|
+
{ desc: 'legacy names', listener: { sslcertificateId: certificateArn }, vpc: { vpcid: 'vpc-1' } },
|
|
35
|
+
].forEach(({ desc, listener, vpc }) => {
|
|
36
|
+
it(`reads the listener certificate and VPC from ${desc}`, () => {
|
|
37
|
+
const loadBalancer = classicLoadBalancer(listener, vpc);
|
|
38
|
+
const command = AwsLoadBalancerTransformer.convertClassicLoadBalancerForEditing(loadBalancer);
|
|
39
|
+
|
|
40
|
+
expect(command.vpcId).toBe('vpc-1');
|
|
41
|
+
expect(command.listeners[0]).toEqual(
|
|
42
|
+
expect.objectContaining({
|
|
43
|
+
sslCertificateId: 'my-cert',
|
|
44
|
+
sslCertificateName: 'my-cert',
|
|
45
|
+
sslCertificateType: 'iam',
|
|
46
|
+
}),
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
});
|
|
@@ -3,6 +3,7 @@ import { chain, filter, flatten, map } from 'lodash';
|
|
|
3
3
|
import type { Application, IHealth, IInstance, IServerGroup, IVpc } from '@spinnaker/core';
|
|
4
4
|
import { AccountService, NameUtils, SETTINGS } from '@spinnaker/core';
|
|
5
5
|
import { AWSProviderSettings } from '../aws.settings';
|
|
6
|
+
import { getSslCertificateId, getVpcId } from '../common/awsSdkFieldNames';
|
|
6
7
|
import type {
|
|
7
8
|
IALBListenerCertificate,
|
|
8
9
|
IAmazonApplicationLoadBalancer,
|
|
@@ -197,25 +198,27 @@ export class AwsLoadBalancerTransformer {
|
|
|
197
198
|
if (loadBalancer.elb) {
|
|
198
199
|
const elb = loadBalancer.elb as IClassicLoadBalancerSourceData;
|
|
199
200
|
toEdit.securityGroups = elb.securityGroups;
|
|
200
|
-
toEdit.vpcId = elb
|
|
201
|
+
toEdit.vpcId = getVpcId(elb);
|
|
201
202
|
|
|
202
203
|
if (elb.listenerDescriptions) {
|
|
203
204
|
toEdit.listeners = elb.listenerDescriptions.map(
|
|
204
205
|
(description: any): IClassicListenerDescription => {
|
|
205
206
|
const listener = description.listener;
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
let sslCertificateId = getSslCertificateId(listener);
|
|
208
|
+
let sslCertificateType: string;
|
|
209
|
+
if (sslCertificateId) {
|
|
210
|
+
const splitCertificateId = sslCertificateId.split('/');
|
|
211
|
+
sslCertificateId = splitCertificateId[1];
|
|
212
|
+
sslCertificateType = splitCertificateId[0].split(':')[2];
|
|
210
213
|
}
|
|
211
214
|
return {
|
|
212
215
|
internalProtocol: listener.instanceProtocol,
|
|
213
216
|
internalPort: listener.instancePort,
|
|
214
217
|
externalProtocol: listener.protocol,
|
|
215
218
|
externalPort: listener.loadBalancerPort,
|
|
216
|
-
sslCertificateId
|
|
217
|
-
sslCertificateName:
|
|
218
|
-
sslCertificateType
|
|
219
|
+
sslCertificateId,
|
|
220
|
+
sslCertificateName: sslCertificateId,
|
|
221
|
+
sslCertificateType,
|
|
219
222
|
policyNames: description.policyNames,
|
|
220
223
|
};
|
|
221
224
|
},
|
|
@@ -278,7 +281,7 @@ export class AwsLoadBalancerTransformer {
|
|
|
278
281
|
if (loadBalancer.elb) {
|
|
279
282
|
const elb = loadBalancer.elb as IApplicationLoadBalancerSourceData;
|
|
280
283
|
toEdit.securityGroups = elb.securityGroups;
|
|
281
|
-
toEdit.vpcId = elb
|
|
284
|
+
toEdit.vpcId = getVpcId(elb);
|
|
282
285
|
|
|
283
286
|
// Convert listeners
|
|
284
287
|
if (elb.listeners) {
|
|
@@ -392,7 +395,7 @@ export class AwsLoadBalancerTransformer {
|
|
|
392
395
|
if (loadBalancer.elb) {
|
|
393
396
|
const elb = loadBalancer.elb as INetworkLoadBalancerSourceData;
|
|
394
397
|
toEdit.securityGroups = elb.securityGroups;
|
|
395
|
-
toEdit.vpcId = elb
|
|
398
|
+
toEdit.vpcId = getVpcId(elb);
|
|
396
399
|
|
|
397
400
|
// Convert listeners
|
|
398
401
|
if (elb.listeners) {
|
|
@@ -144,7 +144,7 @@ describe('Service: awsServerGroup', function () {
|
|
|
144
144
|
var serverGroup = {
|
|
145
145
|
asg: {
|
|
146
146
|
availabilityZones: [],
|
|
147
|
-
|
|
147
|
+
vpcZoneIdentifier: '',
|
|
148
148
|
suspendedProcesses: [
|
|
149
149
|
{ processName: 'Launch' },
|
|
150
150
|
{ processName: 'Terminate' },
|
|
@@ -162,7 +162,7 @@ describe('Service: awsServerGroup', function () {
|
|
|
162
162
|
var serverGroup = {
|
|
163
163
|
asg: {
|
|
164
164
|
availabilityZones: [],
|
|
165
|
-
|
|
165
|
+
vpcZoneIdentifier: '',
|
|
166
166
|
suspendedProcesses: [],
|
|
167
167
|
},
|
|
168
168
|
launchTemplate: mockLaunchTemplate,
|
|
@@ -173,13 +173,37 @@ describe('Service: awsServerGroup', function () {
|
|
|
173
173
|
expect(command.useSourceCapacity).toBe(true);
|
|
174
174
|
});
|
|
175
175
|
|
|
176
|
+
describe('derives subnet type and VPC from the ASG zone identifier', function () {
|
|
177
|
+
beforeEach(function () {
|
|
178
|
+
SubnetReader.listSubnets.mockReturnValue(
|
|
179
|
+
Promise.resolve([{ id: 'subnet-1', purpose: 'internal', vpcId: 'vpc-1' }]),
|
|
180
|
+
);
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
[
|
|
184
|
+
{ desc: 'vpcZoneIdentifier', asg: { vpcZoneIdentifier: 'subnet-1,subnet-2' } },
|
|
185
|
+
{ desc: 'legacy vpczoneIdentifier', asg: { vpczoneIdentifier: 'subnet-1,subnet-2' } },
|
|
186
|
+
].forEach((test) => {
|
|
187
|
+
it(`reads ${test.desc}`, async function () {
|
|
188
|
+
const serverGroup = {
|
|
189
|
+
asg: { availabilityZones: [], suspendedProcesses: [], ...test.asg },
|
|
190
|
+
launchTemplate: mockLaunchTemplate,
|
|
191
|
+
};
|
|
192
|
+
const command = await testContext.service.buildServerGroupCommandFromExisting({}, serverGroup);
|
|
193
|
+
|
|
194
|
+
expect(command.subnetType).toBe('internal');
|
|
195
|
+
expect(command.vpcId).toBe('vpc-1');
|
|
196
|
+
});
|
|
197
|
+
});
|
|
198
|
+
});
|
|
199
|
+
|
|
176
200
|
describe('extracts properties from server group correctly', function () {
|
|
177
201
|
const sgCommon = {
|
|
178
202
|
...mockServerGroup,
|
|
179
203
|
asg: {
|
|
180
204
|
autoScalingGroupName: 'myasg-test-v000',
|
|
181
205
|
availabilityZones: [],
|
|
182
|
-
|
|
206
|
+
vpcZoneIdentifier: '',
|
|
183
207
|
suspendedProcesses: [],
|
|
184
208
|
enabledMetrics: [],
|
|
185
209
|
},
|
|
@@ -4,6 +4,7 @@ import type { Application, DeckRuntimeServices, InstanceTypeService } from '@spi
|
|
|
4
4
|
import { AccountService, DeploymentStrategyRegistry, NameUtils, SubnetReader } from '@spinnaker/core';
|
|
5
5
|
|
|
6
6
|
import { AWSProviderSettings } from '../../aws.settings';
|
|
7
|
+
import { getVpcZoneIdentifier } from '../../common/awsSdkFieldNames';
|
|
7
8
|
import type { IAmazonLaunchTemplateOverrides, ILaunchTemplateData } from '../../domain';
|
|
8
9
|
import type { IAmazonServerGroup, IAmazonServerGroupView, INetworkInterface } from '../../domain';
|
|
9
10
|
import type { AwsServerGroupConfigurationService } from './serverGroupConfiguration.service';
|
|
@@ -338,8 +339,8 @@ export function createAwsServerGroupCommandBuilder(
|
|
|
338
339
|
command.suspendedProcesses = [];
|
|
339
340
|
}
|
|
340
341
|
|
|
341
|
-
const vpcZoneIdentifier = serverGroup.asg
|
|
342
|
-
if (vpcZoneIdentifier
|
|
342
|
+
const vpcZoneIdentifier = getVpcZoneIdentifier(serverGroup.asg);
|
|
343
|
+
if (vpcZoneIdentifier) {
|
|
343
344
|
const subnetId = vpcZoneIdentifier.split(',')[0];
|
|
344
345
|
const subnet = subnets.find((x) => x.id === subnetId);
|
|
345
346
|
command.subnetType = subnet.purpose;
|
|
@@ -66,7 +66,7 @@ describe('awsServerGroupCommandBuilder', function () {
|
|
|
66
66
|
region: 'us-west-1',
|
|
67
67
|
asg: {
|
|
68
68
|
availabilityZones: ['g', 'h', 'i'],
|
|
69
|
-
|
|
69
|
+
vpcZoneIdentifier: '',
|
|
70
70
|
},
|
|
71
71
|
launchTemplate: mockLaunchTemplate,
|
|
72
72
|
};
|
|
@@ -99,7 +99,7 @@ describe('awsServerGroupCommandBuilder', function () {
|
|
|
99
99
|
region: 'us-west-1',
|
|
100
100
|
asg: {
|
|
101
101
|
availabilityZones: ['g', 'h', 'i'],
|
|
102
|
-
|
|
102
|
+
vpcZoneIdentifier: '',
|
|
103
103
|
},
|
|
104
104
|
launchConfig: {
|
|
105
105
|
instanceType: 'something-custom',
|
|
@@ -126,7 +126,7 @@ describe('awsServerGroupCommandBuilder', function () {
|
|
|
126
126
|
region: 'us-west-1',
|
|
127
127
|
asg: {
|
|
128
128
|
availabilityZones: ['g', 'h', 'i'],
|
|
129
|
-
|
|
129
|
+
vpcZoneIdentifier: '',
|
|
130
130
|
suspendedProcesses: [{ processName: 'x' }, { processName: 'a' }],
|
|
131
131
|
},
|
|
132
132
|
launchConfig: {
|
|
@@ -162,7 +162,7 @@ describe('awsServerGroupCommandBuilder', function () {
|
|
|
162
162
|
tags: null,
|
|
163
163
|
asg: {
|
|
164
164
|
availabilityZones: ['g', 'h', 'i'],
|
|
165
|
-
|
|
165
|
+
vpcZoneIdentifier: '',
|
|
166
166
|
tags: [
|
|
167
167
|
{
|
|
168
168
|
key: 'some-key',
|
|
@@ -5,6 +5,7 @@ import type { IServerGroupDetailsProps, ISubnet } from '@spinnaker/core';
|
|
|
5
5
|
import { AccountService, ServerGroupReader, SubnetReader } from '@spinnaker/core';
|
|
6
6
|
|
|
7
7
|
import { AwsServices } from '../../aws.services';
|
|
8
|
+
import { getVpcZoneIdentifier } from '../../common/awsSdkFieldNames';
|
|
8
9
|
import type { IAmazonLoadBalancer, IAmazonServerGroup, IAmazonServerGroupView } from '../../domain';
|
|
9
10
|
import { AutoScalingProcessService } from './scalingProcesses/AutoScalingProcessService';
|
|
10
11
|
|
|
@@ -60,9 +61,9 @@ export function amazonServerGroupDetailsGetter(
|
|
|
60
61
|
});
|
|
61
62
|
|
|
62
63
|
if (!isEmpty(serverGroup)) {
|
|
63
|
-
const vpc = serverGroup.asg
|
|
64
|
+
const vpc = getVpcZoneIdentifier(serverGroup.asg);
|
|
64
65
|
|
|
65
|
-
if (vpc
|
|
66
|
+
if (vpc) {
|
|
66
67
|
const subnetId = vpc.split(',')[0];
|
|
67
68
|
SubnetReader.listSubnets().then((subnets: ISubnet[]) => {
|
|
68
69
|
const subnet = subnets.find((s) => s.id === subnetId);
|
|
@@ -31,7 +31,7 @@ export const TargetTrackingChart = ({ config, serverGroup, updateUnit }: ITarget
|
|
|
31
31
|
period: 60,
|
|
32
32
|
threshold: config.targetValue,
|
|
33
33
|
comparisonOperator: 'GreaterThanThreshold',
|
|
34
|
-
|
|
34
|
+
okActions: [],
|
|
35
35
|
insufficientDataActions: [],
|
|
36
36
|
alarmActions: [],
|
|
37
37
|
evaluationPeriods: null,
|
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
IUpsertAlarmDescription,
|
|
7
7
|
IUpsertScalingPolicyCommand,
|
|
8
8
|
} from '../ScalingPolicyWriter';
|
|
9
|
+
import { getOkActions } from '../../../../common/awsSdkFieldNames';
|
|
9
10
|
import type {
|
|
10
11
|
IAmazonServerGroup,
|
|
11
12
|
IScalingPolicy,
|
|
@@ -31,7 +32,7 @@ export const ScalingPolicyCommandBuilder = {
|
|
|
31
32
|
insufficientDataActionArns: alarm.insufficientDataActions,
|
|
32
33
|
metricName: alarm.metricName,
|
|
33
34
|
namespace: alarm.namespace,
|
|
34
|
-
okActionArns: alarm
|
|
35
|
+
okActionArns: getOkActions(alarm),
|
|
35
36
|
period: alarm.period,
|
|
36
37
|
region,
|
|
37
38
|
statistic: alarm.statistic,
|