Skip to content

Commit 7e5ecba

Browse files
committed
feat: yml支持job镜像配置&修复cfs找不到挂载点问题
1 parent e91c2ec commit 7e5ecba

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

src/modules/scf/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const WebServerImageDefaultPort = 9000;

src/modules/scf/interface.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ export interface FunctionCode {
1212
RegistryId?: string;
1313
Command?: string;
1414
Args?: string;
15+
ContainerImageAccelerate?: boolean;
16+
ImagePort?: number;
1517
};
1618
}
1719

@@ -203,6 +205,7 @@ export interface ScfCreateFunctionInputs {
203205

204206
cfs?: {
205207
cfsId: string;
208+
mountInsId?: string;
206209
MountInsId?: string;
207210
localMountDir: string;
208211
remoteMountDir: string;
@@ -228,6 +231,10 @@ export interface ScfCreateFunctionInputs {
228231
command?: string;
229232
// 启动命令参数
230233
args?: string;
234+
// 是否开启镜像加速
235+
containerImageAccelerate?: boolean;
236+
// 监听端口: -1 表示job镜像,0~65535 表示Web Server镜像
237+
imagePort?: number;
231238
};
232239

233240
// 异步调用重试配置
@@ -391,25 +398,25 @@ export interface GetRequestStatusOptions {
391398
/**
392399
* 函数名称
393400
*/
394-
functionName: string
401+
functionName: string;
395402

396403
/**
397404
* 需要查询状态的请求id
398405
*/
399-
functionRequestId: string
406+
functionRequestId: string;
400407

401408
/**
402409
* 函数的所在的命名空间
403410
*/
404-
namespace?: string
411+
namespace?: string;
405412

406413
/**
407414
* 查询的开始时间,例如:2017-05-16 20:00:00,不填默认为当前时间 - 15min
408415
*/
409-
startTime?: string
416+
startTime?: string;
410417

411418
/**
412419
* 查询的结束时间,例如:2017-05-16 20:59:59,不填默认为当前时间。EndTime 需要晚于 StartTime。
413420
*/
414-
endTime?: string
421+
endTime?: string;
415422
}

src/modules/scf/utils.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { WebServerImageDefaultPort } from './constants';
12
import { ScfCreateFunctionInputs, BaseFunctionConfig, ProtocolParams } from './interface';
23
const CONFIGS = require('./config').default;
34

@@ -41,6 +42,8 @@ export const formatInputs = (inputs: ScfCreateFunctionInputs) => {
4142
ImageConfig: {
4243
ImageType: imageConfig.imageType,
4344
ImageUri: imageConfig.imageUri,
45+
ContainerImageAccelerate: imageConfig.containerImageAccelerate || false,
46+
ImagePort: imageConfig.imagePort || WebServerImageDefaultPort,
4447
},
4548
};
4649
if (imageConfig.registryId) {
@@ -149,7 +152,7 @@ export const formatInputs = (inputs: ScfCreateFunctionInputs) => {
149152
inputs.cfs.forEach((item) => {
150153
functionInputs.CfsConfig?.CfsInsList.push({
151154
CfsId: item.cfsId,
152-
MountInsId: item.MountInsId || item.cfsId,
155+
MountInsId: item.mountInsId || item.MountInsId || item.cfsId,
153156
LocalMountDir: item.localMountDir,
154157
RemoteMountDir: item.remoteMountDir,
155158
UserGroupId: String(item.userGroupId || 10000),

0 commit comments

Comments
 (0)