Add per-cluster Tools Management and stop auto-installing side tools.
Introduce a catalog-driven Tools Management section under Clusters so admins can install/uninstall infrastructure tools per cluster: cert-manager (Helm/jetstack), ClusterIssuer (email + HTTP01 form, depends on cert-manager), and central Elasticsearch. Cluster creation no longer auto-installs Elastic or the cloudhost-node-cluster-dns DaemonSet; build bootstrap stays automatic. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
import {
|
||||
Controller,
|
||||
Get,
|
||||
Post,
|
||||
Delete,
|
||||
Body,
|
||||
Param,
|
||||
UseGuards,
|
||||
} from '@nestjs/common';
|
||||
import { AuthGuard } from '@nestjs/passport';
|
||||
import { ApiTags, ApiOperation, ApiBearerAuth } from '@nestjs/swagger';
|
||||
import { ClusterToolsService } from './cluster-tools.service';
|
||||
import { InstallToolDto } from './dto/install-tool.dto';
|
||||
import { RolesGuard } from '../common/guards/roles.guard';
|
||||
import { Roles } from '../common/decorators/roles.decorator';
|
||||
import { UserRole } from '../common/enums';
|
||||
import { ClusterToolId } from './cluster-tools.types';
|
||||
|
||||
@ApiTags('Clusters - Tools')
|
||||
@ApiBearerAuth()
|
||||
@Controller('clusters/:id/tools')
|
||||
@UseGuards(AuthGuard('jwt'), RolesGuard)
|
||||
@Roles(UserRole.ADMIN)
|
||||
export class ClusterToolsController {
|
||||
constructor(private readonly toolsService: ClusterToolsService) {}
|
||||
|
||||
@Get()
|
||||
@ApiOperation({ summary: 'List installable tools and their status on a cluster (Admin)' })
|
||||
async list(@Param('id') id: string) {
|
||||
return this.toolsService.getToolsForCluster(id);
|
||||
}
|
||||
|
||||
@Post(':toolId/install')
|
||||
@ApiOperation({ summary: 'Install an infrastructure tool on a cluster (Admin)' })
|
||||
async install(
|
||||
@Param('id') id: string,
|
||||
@Param('toolId') toolId: ClusterToolId,
|
||||
@Body() dto: InstallToolDto,
|
||||
) {
|
||||
return this.toolsService.install(id, toolId, { ...dto } as Record<string, string>);
|
||||
}
|
||||
|
||||
@Delete(':toolId')
|
||||
@ApiOperation({ summary: 'Uninstall an infrastructure tool from a cluster (Admin)' })
|
||||
async uninstall(
|
||||
@Param('id') id: string,
|
||||
@Param('toolId') toolId: ClusterToolId,
|
||||
) {
|
||||
return this.toolsService.uninstall(id, toolId);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user