feat(k8s): M14 Namespace 管理看板(资源配额 + 命名空间 CRUD)
- 后端: ListNamespacesDetailed/CreateNamespace/DeleteNamespace/ListResourceQuotas/ListLimitRanges - 后端: GetNamespacesDetail handler (6 API calls aggregate, not N×3) - 后端: CreateNamespaceHandler + DeleteNamespaceHandler (system NS protection) - 前端: NamespaceManagementPage.tsx (~280行) — 表格+概览卡片+创建/删除弹框 - 路由: GET/POST/DELETE /:clusterCode/namespaces + GET /namespace/:ns/detail - 验证: 9/9 通过 (urllib), TS 零错误, Vite 构建成功
This commit is contained in:
1 parent
c7b61968bc
commit
8240a88a84
33 files changed
+2029
-71
No files matched your search
@@ -79,6 +79,9 @@ func main() {
|
||||
}
|
||||
|
||||
switch cmd {
|
||||
case "version", "v", "-v", "--version":
|
||||
fmt.Printf("AIOps Agent %s (built %s) go=%s\n", version, buildTime, runtime.Version())
|
||||
return
|
||||
case "output":
|
||||
runOutput(cfg)
|
||||
return
|
||||
@@ -279,10 +282,25 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
pullPortPolicy := func() {
|
||||
policy, err := taskClient.PollPortPolicy(ctx)
|
||||
if err != nil {
|
||||
if ctx.Err() != nil {
|
||||
return
|
||||
}
|
||||
// 静默忽略 — 端口策略为可选配置
|
||||
return
|
||||
}
|
||||
if policy != nil {
|
||||
portCollector.SetPolicy(policy)
|
||||
}
|
||||
}
|
||||
|
||||
const pollInterval = 5 * time.Second
|
||||
go func() {
|
||||
pollAndExecute()
|
||||
pullProbes()
|
||||
pullPortPolicy()
|
||||
ticker := time.NewTicker(pollInterval)
|
||||
defer ticker.Stop()
|
||||
for {
|
||||
@@ -290,6 +308,7 @@ func main() {
|
||||
case <-ticker.C:
|
||||
pollAndExecute()
|
||||
pullProbes()
|
||||
pullPortPolicy()
|
||||
case <-ctx.Done():
|
||||
return
|
||||
}
|
||||
@@ -404,6 +423,7 @@ func runOutput(cfg Config) {
|
||||
|
||||
// CPU
|
||||
pd("cpu.usage_percent", report.CPU.UsagePercent)
|
||||
pd("cpu.iowait", report.CPU.IOWait)
|
||||
pu("cpu.core_count", report.CPU.CoreCount)
|
||||
pd("cpu.load1", report.CPU.Load1)
|
||||
pd("cpu.load5", report.CPU.Load5)
|
||||
@@ -413,6 +433,8 @@ func runOutput(cfg Config) {
|
||||
pd("memory.total_gb", report.Memory.TotalGB)
|
||||
pd("memory.used_gb", report.Memory.UsedGB)
|
||||
pd("memory.cached_gb", report.Memory.CachedGB)
|
||||
pd("memory.available_gb", report.Memory.AvailableGB)
|
||||
pd("memory.swap_used_gb", report.Memory.SwapUsedGB)
|
||||
pd("memory.usage_percent", report.Memory.UsagePercent)
|
||||
|
||||
// Swap
|
||||
@@ -428,6 +450,7 @@ func runOutput(cfg Config) {
|
||||
pd(prefix+".total_gb", d.TotalGB)
|
||||
pd(prefix+".used_gb", d.UsedGB)
|
||||
pd(prefix+".usage_percent", d.UsagePercent)
|
||||
pd(prefix+".inode_usage_pct", d.InodeUsagePct)
|
||||
}
|
||||
|
||||
// 端口 (监听)
|
||||
@@ -457,14 +480,18 @@ func runOutput(cfg Config) {
|
||||
pu("net.tcp.time_wait", report.Network.TCPTimeWait)
|
||||
pu("net.tcp.close_wait", report.Network.TCPCloseWait)
|
||||
pu("net.tcp.total", report.Network.TCPTotal)
|
||||
pu("net.connection.total", report.Network.TCPEstablished+report.Network.TCPTimeWait+report.Network.TCPCloseWait)
|
||||
pd("net.rx_bps", report.Network.NetRxBPS)
|
||||
pd("net.tx_bps", report.Network.NetTxBPS)
|
||||
pu64("net.rx_errors", report.Network.NetRxErrors)
|
||||
pu64("net.tx_errors", report.Network.NetTxErrors)
|
||||
|
||||
// 磁盘 IO
|
||||
pd("disk_io.read_bps", report.DiskIO.ReadBPS)
|
||||
pd("disk_io.write_bps", report.DiskIO.WriteBPS)
|
||||
pd("disk_io.read_iops", report.DiskIO.ReadIOPS)
|
||||
pd("disk_io.write_iops", report.DiskIO.WriteIOPS)
|
||||
pd("disk_io.util", report.DiskIO.Util)
|
||||
|
||||
// 进程 TOP
|
||||
for i, pr := range report.ProcessTop {
|
||||
|
||||
Reference in new issue
Block a user