feat(k8s): M2 Pod Metrics 详情页接入 — ListPods 注入 metrics
后端: - 新增 buildPodMetricsMap() 公共辅助函数,聚合多容器 CPU/Memory - ListPods / listPodsWithNS / ListPodsAllNS 三个 handler 全部注入 - PodSummary 增加 cpu_usage_m / mem_usage_mi 字段 前端: - KubernetesWorkloads Pod 表格增加 CPU/内存列 - NamespaceResourcePage Pod 表格增加 CPU/内存列 验证: - 17 个 Pod 全部返回真实 metrics (argocd/demo-jar) - curl /kubernetes-clusters/1/pods → cpu_usage_m='2m' mem_usage_mi='61Mi' 文档: - ROADMAP M1→done, M2→done, 验收标准全部勾选 - TDD_PLAN M2 通过标准补充 - PROJECT_EVALUATION P0 缺失项移除
This commit is contained in:
1 parent
8c272a6fa6
commit
4f1ffd1275
27 files changed
+2617
-352
No files matched your search
@@ -5,6 +5,7 @@ import (
|
||||
"ezops/internal/api/middleware"
|
||||
"ezops/internal/config"
|
||||
ezredis "ezops/pkg/redis"
|
||||
"ezops/pkg/toolinstaller"
|
||||
"fmt"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -81,8 +82,11 @@ func Register(r *gin.Engine, db *gorm.DB, log *zap.Logger, cfg *config.Config, c
|
||||
k8sHandler := handlers.NewKubernetesHandler(db)
|
||||
r.GET("/ws/kubernetes-exec/:id/namespaces/:namespace/pods/:podName", middleware.JWTAuth(&cfg.JWT), k8sHandler.ExecTerminal)
|
||||
|
||||
// ToolInstaller(工具懒加载服务 — kubectl/maven/node/helm)// Logan.Li
|
||||
ti := toolinstaller.New(db)
|
||||
|
||||
// WebSocket kubectl 命令行终端 // Logan.Li
|
||||
kubectlShellHandler := handlers.NewKubectlShellHandler(db)
|
||||
kubectlShellHandler := handlers.NewKubectlShellHandler(db, ti)
|
||||
r.GET("/ws/kubectl", middleware.JWTAuth(&cfg.JWT), kubectlShellHandler.Terminal)
|
||||
|
||||
// 公开路由
|
||||
@@ -496,6 +500,17 @@ func Register(r *gin.Engine, db *gorm.DB, log *zap.Logger, cfg *config.Config, c
|
||||
registries.DELETE("/:id", deployHandler.DeleteRegistry)
|
||||
}
|
||||
|
||||
// 工具配置路由(发布配置 Tab ④)// Logan.Li
|
||||
toolConfigHandler := handlers.NewToolConfigHandler(db)
|
||||
tools := authorized.Group("/deploy/tools")
|
||||
{
|
||||
tools.GET("", toolConfigHandler.ListTools)
|
||||
tools.GET("/:id", toolConfigHandler.GetTool)
|
||||
tools.PUT("/:id", toolConfigHandler.UpdateTool)
|
||||
tools.POST("/:id/install", toolConfigHandler.InstallTool)
|
||||
tools.POST("/:id/check", toolConfigHandler.CheckToolStatus)
|
||||
}
|
||||
|
||||
// 自动化运维路由
|
||||
automationHandler := handlers.NewAutomationHandler(db)
|
||||
cronJobs := authorized.Group("/cron-jobs")
|
||||
@@ -521,29 +536,14 @@ func Register(r *gin.Engine, db *gorm.DB, log *zap.Logger, cfg *config.Config, c
|
||||
scripts.POST("/:id/execute", automationHandler.ExecuteScript)
|
||||
}
|
||||
|
||||
// Ansible 自动化路由 // Logan.Li
|
||||
ansibleHandler := handlers.NewAnsibleHandler(db)
|
||||
ansible := authorized.Group("/ansible")
|
||||
// 远程执行路由 — Go 原生 SSH 批量执行替代 Ansible // Logan.Li
|
||||
remoteExecHandler := handlers.NewRemoteExecHandler(db)
|
||||
remoteExec := authorized.Group("/remote-exec")
|
||||
{
|
||||
ansible.GET("/playbooks", ansibleHandler.ListPlaybooks)
|
||||
ansible.POST("/playbooks", ansibleHandler.CreatePlaybook)
|
||||
ansible.GET("/playbooks/:id", ansibleHandler.GetPlaybook)
|
||||
ansible.PUT("/playbooks/:id", ansibleHandler.UpdatePlaybook)
|
||||
ansible.DELETE("/playbooks/:id", ansibleHandler.DeletePlaybook)
|
||||
ansible.DELETE("/playbooks/batch-delete", ansibleHandler.BatchDeletePlaybooks)
|
||||
ansible.POST("/playbooks/:id/execute", ansibleHandler.ExecutePlaybook)
|
||||
ansible.POST("/playbooks/:id/clone", ansibleHandler.ClonePlaybook)
|
||||
|
||||
ansible.GET("/jobs", ansibleHandler.ListJobs)
|
||||
ansible.GET("/jobs/:id", ansibleHandler.GetJob)
|
||||
|
||||
ansible.GET("/inventories", ansibleHandler.ListInventories)
|
||||
ansible.POST("/inventories", ansibleHandler.CreateInventory)
|
||||
ansible.PUT("/inventories/:id", ansibleHandler.UpdateInventory)
|
||||
ansible.DELETE("/inventories/:id", ansibleHandler.DeleteInventory)
|
||||
|
||||
// 主机匹配(资产服务器查询)// Logan.Li
|
||||
ansible.GET("/match-hosts", ansibleHandler.MatchHosts)
|
||||
remoteExec.POST("/execute", remoteExecHandler.BatchExec)
|
||||
remoteExec.POST("/upload", remoteExecHandler.BatchUpload)
|
||||
remoteExec.GET("/hosts", remoteExecHandler.MatchHosts)
|
||||
remoteExec.POST("/server/:id/exec", remoteExecHandler.ExecOnServer)
|
||||
}
|
||||
|
||||
// 任务执行记录(脚本/定时任务执行历史,不含 Ansible)
|
||||
|
||||
Reference in new issue
Block a user