feat: add support for replica ranges and HorizontalPodAutoscaler integration
This commit is contained in:
@@ -474,6 +474,19 @@ export function createManagementService(dependencies: ManagementDependencies) {
|
||||
|
||||
async stop(workspace: Workspace, names?: string[]): Promise<string[]> {
|
||||
const selected = await targets(workspace, names);
|
||||
const selectedSet = new Set(selected);
|
||||
const hpas = (await dependencies.listProjectResources(workspace.project))
|
||||
.filter(
|
||||
(resource) =>
|
||||
resource.apiVersion === "autoscaling/v2" &&
|
||||
resource.kind === "HorizontalPodAutoscaler" &&
|
||||
resource.metadata?.name !== undefined &&
|
||||
selectedSet.has(resource.metadata.name),
|
||||
)
|
||||
.map((resource) => identity(workspace, resource));
|
||||
if (hpas.length > 0) {
|
||||
await deleteResources(workspace, hpas);
|
||||
}
|
||||
for (const name of selected) {
|
||||
await dependencies.scaleDeployment(workspace.project, name, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user