Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(server): runtime add sealos manager labels #1577

Merged
merged 1 commit into from
Oct 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions server/src/instance/instance.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
}
}