@geek-fun/serverlessinsight 0.8.8 → 0.8.9
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/.serverlessinsight/state-cdn-flow-app-cdn-flow-service.json.backup +1 -1
- package/.serverlessinsight/state-iam-test-app-iam-test-service.json.backup +2 -2
- package/.serverlessinsight/state-insight-poc-app-insight-poc-tencent.json.backup +2 -2
- package/.serverlessinsight/state-insight-poc-deploy-app-insight-poc-deploy.json.backup +4 -4
- package/.serverlessinsight/state-insight-poc-destroy-app-insight-poc-destroy.json.backup +1 -1
- package/.serverlessinsight/state-insight-volc-app-insight-volc.json.backup +2 -2
- package/.serverlessinsight/state-role-reconcile-test-app-role-reconcile-test-service.json.backup +3 -3
- package/dist/package.json +1 -1
- package/dist/src/common/aliyunClient/index.js +44 -35
- package/dist/src/common/constants.js +5 -1
- package/dist/src/common/imsClient.js +2 -2
- package/dist/src/stack/aliyunStack/fc3Resource.js +91 -70
- package/package.json +1 -1
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
"id": "iam-test-app-dev-sls"
|
|
23
23
|
}
|
|
24
24
|
],
|
|
25
|
-
"lastUpdated": "2026-09-
|
|
25
|
+
"lastUpdated": "2026-09-09T03:54:49.979Z"
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
29
|
},
|
|
30
|
-
"lineage": "
|
|
30
|
+
"lineage": "cd48c96b-c142-4bb9-ad37-45ae62a374d5",
|
|
31
31
|
"serial": 3
|
|
32
32
|
}
|
|
@@ -83,12 +83,12 @@
|
|
|
83
83
|
"id": "test-fn"
|
|
84
84
|
}
|
|
85
85
|
],
|
|
86
|
-
"lastUpdated": "2026-09-
|
|
86
|
+
"lastUpdated": "2026-09-09T03:55:26.686Z"
|
|
87
87
|
}
|
|
88
88
|
},
|
|
89
89
|
"shared": {}
|
|
90
90
|
}
|
|
91
91
|
},
|
|
92
|
-
"lineage": "
|
|
92
|
+
"lineage": "4c4e86be-cceb-4748-a6c9-f5126ae02f03",
|
|
93
93
|
"serial": 4
|
|
94
94
|
}
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
]
|
|
112
112
|
}
|
|
113
113
|
],
|
|
114
|
-
"lastUpdated": "2026-09-
|
|
114
|
+
"lastUpdated": "2026-09-09T03:55:39.018Z",
|
|
115
115
|
"status": "ready"
|
|
116
116
|
},
|
|
117
117
|
"events.gateway_event": {
|
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
"stageName": "RELEASE"
|
|
187
187
|
}
|
|
188
188
|
],
|
|
189
|
-
"lastUpdated": "2026-09-
|
|
189
|
+
"lastUpdated": "2026-09-09T03:55:39.019Z"
|
|
190
190
|
}
|
|
191
191
|
},
|
|
192
192
|
"shared": {
|
|
@@ -205,11 +205,11 @@
|
|
|
205
205
|
"id": "insight-poc-deploy-app-dev-sls"
|
|
206
206
|
}
|
|
207
207
|
],
|
|
208
|
-
"lastUpdated": "2026-09-
|
|
208
|
+
"lastUpdated": "2026-09-09T03:55:34.015Z"
|
|
209
209
|
}
|
|
210
210
|
}
|
|
211
211
|
}
|
|
212
212
|
},
|
|
213
|
-
"lineage": "
|
|
213
|
+
"lineage": "657df5d6-2d8c-4e5c-9ff4-3bd32560eb7d",
|
|
214
214
|
"serial": 2
|
|
215
215
|
}
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"serverSideEncryptionConfiguration": null
|
|
45
45
|
}
|
|
46
46
|
],
|
|
47
|
-
"lastUpdated": "2026-09-
|
|
47
|
+
"lastUpdated": "2026-09-09T03:55:46.801Z"
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"shared": {}
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
|
-
"lineage": "
|
|
53
|
+
"lineage": "5564129a-8c36-4321-83b5-d996a4e7941d",
|
|
54
54
|
"serial": 4
|
|
55
55
|
}
|
package/.serverlessinsight/state-role-reconcile-test-app-role-reconcile-test-service.json.backup
CHANGED
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
]
|
|
119
119
|
}
|
|
120
120
|
],
|
|
121
|
-
"lastUpdated": "2026-09-
|
|
121
|
+
"lastUpdated": "2026-09-09T03:54:26.028Z",
|
|
122
122
|
"status": "ready"
|
|
123
123
|
}
|
|
124
124
|
},
|
|
@@ -138,11 +138,11 @@
|
|
|
138
138
|
"id": "role-reconcile-test-app-dev-sls"
|
|
139
139
|
}
|
|
140
140
|
],
|
|
141
|
-
"lastUpdated": "2026-09-
|
|
141
|
+
"lastUpdated": "2026-09-09T03:54:21.027Z"
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
},
|
|
146
|
-
"lineage": "
|
|
146
|
+
"lineage": "7f0a433e-535b-45c8-a718-a94b154f82ce",
|
|
147
147
|
"serial": 2
|
|
148
148
|
}
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geek-fun/serverlessinsight",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.9",
|
|
4
4
|
"description": "Full life cycle cross providers serverless application management for your fast-growing business.",
|
|
5
5
|
"homepage": "https://serverlessinsight.com",
|
|
6
6
|
"main": "dist/src/index.js",
|
|
@@ -76,6 +76,15 @@ __exportStar(require("./tablestoreOperations"), exports);
|
|
|
76
76
|
__exportStar(require("./dnsOperations"), exports);
|
|
77
77
|
__exportStar(require("./casOperations"), exports);
|
|
78
78
|
__exportStar(require("./cdnOperations"), exports);
|
|
79
|
+
// Non-fc3 aliyun clients are synchronous management-plane RPCs — they share
|
|
80
|
+
// the short query-tier timeout budget (issue #234: sls ran on the SDK default
|
|
81
|
+
// 3s read timeout and a cold read aborted whole deploys; the deploy-tier
|
|
82
|
+
// budget would instead let a hung call stall a deploy for minutes).
|
|
83
|
+
const applyAliyunQueryTimeouts = (config) => {
|
|
84
|
+
config.connectTimeout = constants_1.ALIYUN_QUERY_CONNECT_TIMEOUT_MS;
|
|
85
|
+
config.readTimeout = constants_1.ALIYUN_QUERY_READ_TIMEOUT_MS;
|
|
86
|
+
return config;
|
|
87
|
+
};
|
|
79
88
|
const initializeSdkClients = (context) => {
|
|
80
89
|
const baseConfig = {
|
|
81
90
|
accessKeyId: context.accessKeyId,
|
|
@@ -83,47 +92,47 @@ const initializeSdkClients = (context) => {
|
|
|
83
92
|
regionId: context.region,
|
|
84
93
|
securityToken: context.securityToken,
|
|
85
94
|
};
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
95
|
+
const fc3Client = new fc20230330_1.default(Object.assign(new $OpenApi.Config(baseConfig), {
|
|
96
|
+
endpoint: `${context.accountId}.${context.region}.fc.aliyuncs.com`,
|
|
97
|
+
connectTimeout: constants_1.ALIYUN_FC3_CONNECT_TIMEOUT_MS,
|
|
98
|
+
readTimeout: constants_1.ALIYUN_FC3_READ_TIMEOUT_MS,
|
|
99
|
+
}));
|
|
100
|
+
const slsClient = new sls20201230_1.default(applyAliyunQueryTimeouts(Object.assign(new $OpenApi.Config(baseConfig), {
|
|
101
|
+
endpoint: `${context.region}.log.aliyuncs.com`,
|
|
102
|
+
})));
|
|
103
|
+
const ramClient = new ram20150501_1.default(applyAliyunQueryTimeouts(Object.assign(new $OpenApi.Config(baseConfig), {
|
|
104
|
+
endpoint: 'ram.aliyuncs.com',
|
|
105
|
+
})));
|
|
106
|
+
const ecsClient = new ecs20140526_1.default(applyAliyunQueryTimeouts(Object.assign(new $OpenApi.Config(baseConfig), {
|
|
107
|
+
endpoint: `ecs.${context.region}.aliyuncs.com`,
|
|
108
|
+
})));
|
|
109
|
+
const nasClient = new nas20170626_1.default(applyAliyunQueryTimeouts(Object.assign(new $OpenApi.Config(baseConfig), {
|
|
110
|
+
endpoint: `nas.${context.region}.aliyuncs.com`,
|
|
111
|
+
})));
|
|
103
112
|
const ossClient = new ali_oss_1.default({
|
|
104
113
|
accessKeyId: context.accessKeyId,
|
|
105
114
|
accessKeySecret: context.accessKeySecret,
|
|
106
115
|
region: `oss-${context.region}`,
|
|
107
116
|
stsToken: context.securityToken,
|
|
108
117
|
});
|
|
109
|
-
const
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
118
|
+
const apigwClient = new cloudapi20160714_1.default(applyAliyunQueryTimeouts(Object.assign(new $OpenApi.Config(baseConfig), {
|
|
119
|
+
endpoint: `apigateway.${context.region}.aliyuncs.com`,
|
|
120
|
+
})));
|
|
121
|
+
const rdsClient = new rds20140815_1.default(applyAliyunQueryTimeouts(Object.assign(new $OpenApi.Config(baseConfig), {
|
|
122
|
+
endpoint: `rds.aliyuncs.com`,
|
|
123
|
+
})));
|
|
124
|
+
const esClient = new es_serverless20230627_1.default(applyAliyunQueryTimeouts(Object.assign(new $OpenApi.Config(baseConfig), {
|
|
125
|
+
endpoint: `elasticsearch-serverless.${context.region}.aliyuncs.com`,
|
|
126
|
+
})));
|
|
127
|
+
const dnsClient = new alidns20150109_1.default(applyAliyunQueryTimeouts(Object.assign(new $OpenApi.Config(baseConfig), {
|
|
128
|
+
endpoint: `alidns.aliyuncs.com`,
|
|
129
|
+
})));
|
|
130
|
+
const casClient = new cas20200407_1.default(applyAliyunQueryTimeouts(Object.assign(new $OpenApi.Config(baseConfig), {
|
|
131
|
+
endpoint: `cas.aliyuncs.com`,
|
|
132
|
+
})));
|
|
133
|
+
const cdnClient = new cdn20180510_1.default(applyAliyunQueryTimeouts(Object.assign(new $OpenApi.Config(baseConfig), {
|
|
134
|
+
endpoint: `cdn.aliyuncs.com`,
|
|
135
|
+
})));
|
|
127
136
|
return {
|
|
128
137
|
fc3: fc3Client,
|
|
129
138
|
sls: slsClient,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CLS_TOPIC_POLL_MAX_ATTEMPTS = exports.CLS_TOPIC_POLL_INTERVAL_MS = exports.SCF_STATUS_POLL_MAX_ATTEMPTS = exports.SCF_STATUS_POLL_INTERVAL_MS = exports.RAM_ROLE_PROPAGATION_DELAY_MS = exports.APIGW_DNS_PUBLIC_RESOLUTION_DELAY_MS = exports.APIGW_DNS_PUBLIC_RESOLUTION_MAX_ATTEMPTS = exports.APIGW_DOMAIN_BIND_RETRY_DELAY_MS = exports.APIGW_DOMAIN_BIND_MAX_RETRIES = exports.DNS_PROPAGATION_DELAY_MS = exports.DNS_PROPAGATION_MAX_ATTEMPTS = exports.DOMAIN_BIND_RETRY_DELAY_MS = exports.DOMAIN_BIND_MAX_RETRIES = exports.STALE_LOCK_THRESHOLD = exports.DEFAULT_LOCK_RETRY_DELAY = exports.DEFAULT_LOCK_TIMEOUT = exports.LOCK_FILE_SUFFIX = exports.OSS_STATE_REQUEST_TIMEOUT_MS = exports.OSS_STATE_CONNECT_TIMEOUT_MS = exports.FC3_CODE_INLINE_SIZE_LIMIT = exports.ALIYUN_FC3_READ_TIMEOUT_MS = exports.ALIYUN_FC3_CONNECT_TIMEOUT_MS = exports.SI_LOCALSTACK_SERVER_PORT = exports.SI_BOOTSTRAP_BUCKET_PREFIX = exports.SI_BOOTSTRAP_FC_PREFIX = exports.OSS_DEPLOYMENT_TIMEOUT = exports.CODE_ZIP_SIZE_LIMIT = void 0;
|
|
3
|
+
exports.CLS_TOPIC_POLL_MAX_ATTEMPTS = exports.CLS_TOPIC_POLL_INTERVAL_MS = exports.SCF_STATUS_POLL_MAX_ATTEMPTS = exports.SCF_STATUS_POLL_INTERVAL_MS = exports.RAM_ROLE_PROPAGATION_DELAY_MS = exports.APIGW_DNS_PUBLIC_RESOLUTION_DELAY_MS = exports.APIGW_DNS_PUBLIC_RESOLUTION_MAX_ATTEMPTS = exports.APIGW_DOMAIN_BIND_RETRY_DELAY_MS = exports.APIGW_DOMAIN_BIND_MAX_RETRIES = exports.DNS_PROPAGATION_DELAY_MS = exports.DNS_PROPAGATION_MAX_ATTEMPTS = exports.DOMAIN_BIND_RETRY_DELAY_MS = exports.DOMAIN_BIND_MAX_RETRIES = exports.STALE_LOCK_THRESHOLD = exports.DEFAULT_LOCK_RETRY_DELAY = exports.DEFAULT_LOCK_TIMEOUT = exports.LOCK_FILE_SUFFIX = exports.OSS_STATE_REQUEST_TIMEOUT_MS = exports.OSS_STATE_CONNECT_TIMEOUT_MS = exports.FC3_CODE_INLINE_SIZE_LIMIT = exports.ALIYUN_QUERY_READ_TIMEOUT_MS = exports.ALIYUN_QUERY_CONNECT_TIMEOUT_MS = exports.ALIYUN_FC3_READ_TIMEOUT_MS = exports.ALIYUN_FC3_CONNECT_TIMEOUT_MS = exports.SI_LOCALSTACK_SERVER_PORT = exports.SI_BOOTSTRAP_BUCKET_PREFIX = exports.SI_BOOTSTRAP_FC_PREFIX = exports.OSS_DEPLOYMENT_TIMEOUT = exports.CODE_ZIP_SIZE_LIMIT = void 0;
|
|
4
4
|
exports.CODE_ZIP_SIZE_LIMIT = 300 * 1000; // 300 KB - code package size limit for inline deployment
|
|
5
5
|
exports.OSS_DEPLOYMENT_TIMEOUT = 3000; // in seconds
|
|
6
6
|
exports.SI_BOOTSTRAP_FC_PREFIX = 'si-bootstrap-api';
|
|
@@ -8,6 +8,10 @@ exports.SI_BOOTSTRAP_BUCKET_PREFIX = 'si-bootstrap-artifacts';
|
|
|
8
8
|
exports.SI_LOCALSTACK_SERVER_PORT = 4567;
|
|
9
9
|
exports.ALIYUN_FC3_CONNECT_TIMEOUT_MS = 120000;
|
|
10
10
|
exports.ALIYUN_FC3_READ_TIMEOUT_MS = 600000;
|
|
11
|
+
// Query-tier budget for synchronous management-plane RPCs (all non-fc3 aliyun
|
|
12
|
+
// clients): fast fail beats long hang — long waits are polling loops, not calls.
|
|
13
|
+
exports.ALIYUN_QUERY_CONNECT_TIMEOUT_MS = 10000; // 10 seconds
|
|
14
|
+
exports.ALIYUN_QUERY_READ_TIMEOUT_MS = 30000; // 30 seconds
|
|
11
15
|
exports.FC3_CODE_INLINE_SIZE_LIMIT = 70 * 1024 * 1024; // 70MB threshold for OSS upload
|
|
12
16
|
// OSS state backend timeouts
|
|
13
17
|
exports.OSS_STATE_CONNECT_TIMEOUT_MS = 10000; // 10 seconds
|
|
@@ -48,8 +48,8 @@ const getIamInfo = async (context) => {
|
|
|
48
48
|
regionId: context.region,
|
|
49
49
|
endpoint: 'ims.aliyuncs.com',
|
|
50
50
|
});
|
|
51
|
-
imsConfig.connectTimeout = constants_1.
|
|
52
|
-
imsConfig.readTimeout = constants_1.
|
|
51
|
+
imsConfig.connectTimeout = constants_1.ALIYUN_QUERY_CONNECT_TIMEOUT_MS;
|
|
52
|
+
imsConfig.readTimeout = constants_1.ALIYUN_QUERY_READ_TIMEOUT_MS;
|
|
53
53
|
const imsClient = new ims20190815_1.default(imsConfig);
|
|
54
54
|
const { body } = await imsClient.getUser(new ims20190815.GetUserRequest({ userAccessKeyId: context.accessKeyId }));
|
|
55
55
|
return body?.user
|
|
@@ -803,20 +803,27 @@ const updateResource = async (context, fn, state, options) => {
|
|
|
803
803
|
// reconcile logstore ttl/shards and index presence against what si
|
|
804
804
|
// creates. Shard deficits are repaired upward; Aliyun cannot shrink.
|
|
805
805
|
if (options?.force) {
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
await client.sls.
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
806
|
+
// Nested repair is best-effort: a transient read/write failure here
|
|
807
|
+
// must not fail the function update itself (SLS ReadTimeout in prod).
|
|
808
|
+
try {
|
|
809
|
+
const liveLogstore = await client.sls.getLogstore(projectName, logstoreName);
|
|
810
|
+
if (!liveLogstore) {
|
|
811
|
+
logger_1.logger.warn(lang_1.lang.__('NESTED_LOGSTORE_RECREATED', { logstoreName }));
|
|
812
|
+
await client.sls.createLogstore(projectName, logstoreName);
|
|
813
|
+
}
|
|
814
|
+
else if (liveLogstore.ttl !== slsOperations_1.SLS_LOGSTORE_TTL ||
|
|
815
|
+
(liveLogstore.shardCount ?? 0) < slsOperations_1.SLS_LOGSTORE_SHARDS) {
|
|
816
|
+
await client.sls.updateLogstore(projectName, logstoreName, slsOperations_1.SLS_LOGSTORE_TTL, Math.max(liveLogstore.shardCount ?? 0, slsOperations_1.SLS_LOGSTORE_SHARDS));
|
|
817
|
+
logger_1.logger.info(lang_1.lang.__('NESTED_LOGSTORE_UPDATED', { logstoreName }));
|
|
818
|
+
}
|
|
819
|
+
const liveIndex = await client.sls.getIndex(projectName, logstoreName);
|
|
820
|
+
if (!liveIndex) {
|
|
821
|
+
logger_1.logger.warn(lang_1.lang.__('NESTED_INDEX_RECREATED', { logstoreName }));
|
|
822
|
+
await client.sls.createIndex(projectName, logstoreName);
|
|
823
|
+
}
|
|
815
824
|
}
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
logger_1.logger.warn(lang_1.lang.__('NESTED_INDEX_RECREATED', { logstoreName }));
|
|
819
|
-
await client.sls.createIndex(projectName, logstoreName);
|
|
825
|
+
catch (error) {
|
|
826
|
+
logger_1.logger.warn(lang_1.lang.__('NESTED_REPAIR_FAILED', { resource: logstoreName, error: String(error) }));
|
|
820
827
|
}
|
|
821
828
|
}
|
|
822
829
|
}
|
|
@@ -925,59 +932,65 @@ const updateResource = async (context, fn, state, options) => {
|
|
|
925
932
|
// config no longer declares. Invalid config rules are skipped at create
|
|
926
933
|
// time too.
|
|
927
934
|
if (options?.force && fn.network) {
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
935
|
+
// Best-effort: a transient SG read failure must not fail the update.
|
|
936
|
+
try {
|
|
937
|
+
const parseRule = (rule) => {
|
|
938
|
+
try {
|
|
939
|
+
return (0, ecsOperations_1.parseSecurityGroupRule)(rule);
|
|
940
|
+
}
|
|
941
|
+
catch {
|
|
942
|
+
return null;
|
|
943
|
+
}
|
|
944
|
+
};
|
|
945
|
+
const desiredIngress = (fn.network.security_group.ingress ?? [])
|
|
946
|
+
.map(parseRule)
|
|
947
|
+
.filter((r) => Boolean(r));
|
|
948
|
+
const desiredEgress = (fn.network.security_group.egress ?? [])
|
|
949
|
+
.map(parseRule)
|
|
950
|
+
.filter((r) => Boolean(r));
|
|
951
|
+
const live = await client.ecs.getSecurityGroupRules(sgInstance.id);
|
|
952
|
+
const liveIngressKeys = (live?.ingressRules ?? []).map((r) => (0, ecsOperations_1.canonicalSecurityGroupRule)(r.ipProtocol ?? '', r.portRange ?? '', r.sourceCidrIp ?? ''));
|
|
953
|
+
const liveEgressKeys = (live?.egressRules ?? []).map((r) => (0, ecsOperations_1.canonicalSecurityGroupRule)(r.ipProtocol ?? '', r.portRange ?? '', r.destCidrIp ?? ''));
|
|
954
|
+
const missingIngress = desiredIngress.filter((d) => !liveIngressKeys.includes((0, ecsOperations_1.canonicalSecurityGroupRule)(d.protocol, d.portRange, d.cidr)));
|
|
955
|
+
const missingEgress = desiredEgress.filter((d) => !liveEgressKeys.includes((0, ecsOperations_1.canonicalSecurityGroupRule)(d.protocol, d.portRange, d.cidr)));
|
|
956
|
+
// The extra check reuses the raw live canonical keys — the same space
|
|
957
|
+
// the missing check uses. Reconstructing a parsed rule here would
|
|
958
|
+
// collapse port ranges (80/443 -> 80) and wrongly revoke matching
|
|
959
|
+
// range rules.
|
|
960
|
+
const desiredIngressKeys = desiredIngress.map((d) => (0, ecsOperations_1.canonicalSecurityGroupRule)(d.protocol, d.portRange, d.cidr));
|
|
961
|
+
const desiredEgressKeys = desiredEgress.map((d) => (0, ecsOperations_1.canonicalSecurityGroupRule)(d.protocol, d.portRange, d.cidr));
|
|
962
|
+
const extraIngress = (live?.ingressRules ?? []).filter((r, i) => {
|
|
963
|
+
const key = liveIngressKeys[i];
|
|
964
|
+
return !key || !desiredIngressKeys.includes(key);
|
|
965
|
+
});
|
|
966
|
+
const extraEgress = (live?.egressRules ?? []).filter((r, i) => {
|
|
967
|
+
const key = liveEgressKeys[i];
|
|
968
|
+
return !key || !desiredEgressKeys.includes(key);
|
|
969
|
+
});
|
|
970
|
+
if (missingIngress.length > 0 || missingEgress.length > 0) {
|
|
971
|
+
await client.ecs.authorizeSecurityGroupRules(sgInstance.id, 'ingress', missingIngress);
|
|
972
|
+
await client.ecs.authorizeSecurityGroupRules(sgInstance.id, 'egress', missingEgress);
|
|
931
973
|
}
|
|
932
|
-
|
|
933
|
-
|
|
974
|
+
if (extraIngress.length > 0 || extraEgress.length > 0) {
|
|
975
|
+
const toParsed = (r) => ({
|
|
976
|
+
// Live portRange is already in Aliyun wire format — pass verbatim
|
|
977
|
+
// so the revoke matches the rule exactly (ranges included).
|
|
978
|
+
protocol: r.ipProtocol ?? '',
|
|
979
|
+
cidr: r.sourceCidrIp ?? r.destCidrIp ?? '',
|
|
980
|
+
portRange: r.portRange ?? '',
|
|
981
|
+
});
|
|
982
|
+
await client.ecs.revokeSecurityGroupRules(sgInstance.id, 'ingress', extraIngress.map(toParsed));
|
|
983
|
+
await client.ecs.revokeSecurityGroupRules(sgInstance.id, 'egress', extraEgress.map(toParsed));
|
|
934
984
|
}
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
.map(parseRule)
|
|
941
|
-
.filter((r) => Boolean(r));
|
|
942
|
-
const live = await client.ecs.getSecurityGroupRules(sgInstance.id);
|
|
943
|
-
const liveIngressKeys = (live?.ingressRules ?? []).map((r) => (0, ecsOperations_1.canonicalSecurityGroupRule)(r.ipProtocol ?? '', r.portRange ?? '', r.sourceCidrIp ?? ''));
|
|
944
|
-
const liveEgressKeys = (live?.egressRules ?? []).map((r) => (0, ecsOperations_1.canonicalSecurityGroupRule)(r.ipProtocol ?? '', r.portRange ?? '', r.destCidrIp ?? ''));
|
|
945
|
-
const missingIngress = desiredIngress.filter((d) => !liveIngressKeys.includes((0, ecsOperations_1.canonicalSecurityGroupRule)(d.protocol, d.portRange, d.cidr)));
|
|
946
|
-
const missingEgress = desiredEgress.filter((d) => !liveEgressKeys.includes((0, ecsOperations_1.canonicalSecurityGroupRule)(d.protocol, d.portRange, d.cidr)));
|
|
947
|
-
// The extra check reuses the raw live canonical keys — the same space
|
|
948
|
-
// the missing check uses. Reconstructing a parsed rule here would
|
|
949
|
-
// collapse port ranges (80/443 -> 80) and wrongly revoke matching
|
|
950
|
-
// range rules.
|
|
951
|
-
const desiredIngressKeys = desiredIngress.map((d) => (0, ecsOperations_1.canonicalSecurityGroupRule)(d.protocol, d.portRange, d.cidr));
|
|
952
|
-
const desiredEgressKeys = desiredEgress.map((d) => (0, ecsOperations_1.canonicalSecurityGroupRule)(d.protocol, d.portRange, d.cidr));
|
|
953
|
-
const extraIngress = (live?.ingressRules ?? []).filter((r, i) => {
|
|
954
|
-
const key = liveIngressKeys[i];
|
|
955
|
-
return !key || !desiredIngressKeys.includes(key);
|
|
956
|
-
});
|
|
957
|
-
const extraEgress = (live?.egressRules ?? []).filter((r, i) => {
|
|
958
|
-
const key = liveEgressKeys[i];
|
|
959
|
-
return !key || !desiredEgressKeys.includes(key);
|
|
960
|
-
});
|
|
961
|
-
if (missingIngress.length > 0 || missingEgress.length > 0) {
|
|
962
|
-
await client.ecs.authorizeSecurityGroupRules(sgInstance.id, 'ingress', missingIngress);
|
|
963
|
-
await client.ecs.authorizeSecurityGroupRules(sgInstance.id, 'egress', missingEgress);
|
|
985
|
+
logger_1.logger.info(lang_1.lang.__('NESTED_SG_RULES_REPAIRED', {
|
|
986
|
+
securityGroupId: sgInstance.id,
|
|
987
|
+
added: String(missingIngress.length + missingEgress.length),
|
|
988
|
+
removed: String(extraIngress.length + extraEgress.length),
|
|
989
|
+
}));
|
|
964
990
|
}
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
// Live portRange is already in Aliyun wire format — pass verbatim
|
|
968
|
-
// so the revoke matches the rule exactly (ranges included).
|
|
969
|
-
protocol: r.ipProtocol ?? '',
|
|
970
|
-
cidr: r.sourceCidrIp ?? r.destCidrIp ?? '',
|
|
971
|
-
portRange: r.portRange ?? '',
|
|
972
|
-
});
|
|
973
|
-
await client.ecs.revokeSecurityGroupRules(sgInstance.id, 'ingress', extraIngress.map(toParsed));
|
|
974
|
-
await client.ecs.revokeSecurityGroupRules(sgInstance.id, 'egress', extraEgress.map(toParsed));
|
|
991
|
+
catch (error) {
|
|
992
|
+
logger_1.logger.warn(lang_1.lang.__('NESTED_REPAIR_FAILED', { resource: sgInstance.id, error: String(error) }));
|
|
975
993
|
}
|
|
976
|
-
logger_1.logger.info(lang_1.lang.__('NESTED_SG_RULES_REPAIRED', {
|
|
977
|
-
securityGroupId: sgInstance.id,
|
|
978
|
-
added: String(missingIngress.length + missingEgress.length),
|
|
979
|
-
removed: String(extraIngress.length + extraEgress.length),
|
|
980
|
-
}));
|
|
981
994
|
}
|
|
982
995
|
}
|
|
983
996
|
}
|
|
@@ -1005,16 +1018,24 @@ const updateResource = async (context, fn, state, options) => {
|
|
|
1005
1018
|
// (console deletions); extra mount targets are left alone — deleting
|
|
1006
1019
|
// shared infrastructure on a reconcile is never safe.
|
|
1007
1020
|
if (options?.force && fn.network) {
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
await client.nas.
|
|
1015
|
-
|
|
1021
|
+
// Best-effort: a transient NAS read failure must not fail the update.
|
|
1022
|
+
let failingFsId;
|
|
1023
|
+
try {
|
|
1024
|
+
const fsInstances = existingInstances.filter((i) => i.type === 'ALIYUN_NAS_FILE_SYSTEM');
|
|
1025
|
+
for (const fsEntry of fsInstances) {
|
|
1026
|
+
failingFsId = fsEntry.id;
|
|
1027
|
+
const liveTargets = await client.nas.listMountTargets(fsEntry.id);
|
|
1028
|
+
if (!liveTargets || liveTargets.length === 0) {
|
|
1029
|
+
const mountPath = nasStorageItems[0]?.mount_path ?? '/mnt/nas';
|
|
1030
|
+
const accessGroupName = `${fn.name}-${context.stage}-nas-access-${mountPath}`;
|
|
1031
|
+
await client.nas.createMountTarget(fsEntry.id, accessGroupName, fn.network.vpc_id, fn.network.subnet_ids[0]);
|
|
1032
|
+
logger_1.logger.warn(lang_1.lang.__('NESTED_MOUNT_TARGET_RECREATED', { fileSystemId: fsEntry.id }));
|
|
1033
|
+
}
|
|
1016
1034
|
}
|
|
1017
1035
|
}
|
|
1036
|
+
catch (error) {
|
|
1037
|
+
logger_1.logger.warn(lang_1.lang.__('NESTED_REPAIR_FAILED', { resource: failingFsId ?? 'nas', error: String(error) }));
|
|
1038
|
+
}
|
|
1018
1039
|
}
|
|
1019
1040
|
if (mountTargetInstances.length > 0 && nasStorageItems.length > 0) {
|
|
1020
1041
|
nasConfig = {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geek-fun/serverlessinsight",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.9",
|
|
4
4
|
"description": "Full life cycle cross providers serverless application management for your fast-growing business.",
|
|
5
5
|
"homepage": "https://serverlessinsight.com",
|
|
6
6
|
"main": "dist/src/index.js",
|