From 17c7caed6a8526c1cc3bf177f97197b6a54bd1fb Mon Sep 17 00:00:00 2001 From: HUAHUAI23 Date: Wed, 11 Oct 2023 12:06:24 +0000 Subject: [PATCH] feat(server): rumtime add sealos manager labels --- server/src/instance/instance.service.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/server/src/instance/instance.service.ts b/server/src/instance/instance.service.ts index ec906c08aa..f27ca547dd 100644 --- a/server/src/instance/instance.service.ts +++ b/server/src/instance/instance.service.ts @@ -31,7 +31,7 @@ export class InstanceService { public async create(appid: string) { const app = await this.applicationService.findOneUnsafe(appid) - const labels = { [LABEL_KEY_APP_ID]: appid } + const labels = this.getRuntimeLabel(appid) // const region = app.region // // Although a namespace has already been created during application creation, @@ -557,10 +557,21 @@ export class InstanceService { hpa, ) } else { - const labels = { [LABEL_KEY_APP_ID]: appid } + const labels = this.getRuntimeLabel(appid) await this.createHorizontalPodAutoscaler(app, labels) } this.logger.log(`reapply k8s hpa ${app.appid}`) } } + + private getRuntimeLabel(appid: string) { + const SEALOS = 'cloud.sealos.io/app-deploy-manager' + const labels = { + [LABEL_KEY_APP_ID]: appid, + [SEALOS]: appid, + app: appid, + } + + return labels + } }