perf: 优化阿里云nlb支持部署扩展证书

This commit is contained in:
xiaojunnuo
2025-06-09 23:41:44 +08:00
parent c1fbc8cd68
commit 9cbdfda829
3 changed files with 183 additions and 33 deletions
@@ -114,10 +114,11 @@ export class AliyunDeployCertToALB extends AbstractTaskPlugin {
value: "extension"
}
]
}
},
required: true
}
)
deployType!: string;
deployType: string = "default";
async onInstance() {
@@ -146,16 +147,20 @@ export class AliyunDeployCertToALB extends AbstractTaskPlugin {
const access = await this.getAccess<AliyunAccess>(this.accessId);
const certId = await this.getAliyunCertId(access);
//部署扩展证书
const albClientV2 = this.getALBClientV2(access);
if (this.deployType === "extension") {
//部署扩展证书
const client = this.getALBClientV2(access);
await this.deployExtensionCert(client, certId);
await this.deployExtensionCert(albClientV2, certId);
} else {
const client = await this.getLBClient(access, this.regionId);
await this.deployDefaultCert(certId, client);
}
await this.ctx.utils.sleep(10000)
for (const listener of this.listeners) {
await this.clearInvalidCert(albClientV2, listener);
}
this.logger.info("执行完成");
}
@@ -200,15 +205,10 @@ export class AliyunDeployCertToALB extends AbstractTaskPlugin {
this.logger.info(`部署监听器${listenerId}的扩展证书成功`);
}
await this.ctx.utils.sleep(10000)
for (const listener of this.listeners) {
await this.clearInvalidCert(client, listener);
}
}
async clearInvalidCert(client: AliyunClientV2, listener: string) {
this.logger.info(`开始清理监听器${listener}的过期证书`);
const req = {
// 接口名称
action: "ListListenerCertificates",