Go(Gin) + React(Vite + shadcn/ui + Tailwind) 前后端分离,全中文 UI - 集群管理:Kubeconfig / Token 双接入,kubectl + helm 部署 - 主机管理:SSH 密钥 / 密码双认证,CPU/内存/磁盘使用率监控,SSH 错误中文友好提示 - 存储配置、部署管理、系统设置 - Docker 镜像内置 kubectl + helm,开箱即用 - run.sh 一键启停(start/stop/restart/status) Co-Authored-By: Claude <noreply@anthropic.com>
39 lines
1.3 KiB
Go
39 lines
1.3 KiB
Go
package models
|
|
|
|
import "time"
|
|
|
|
type Cluster struct {
|
|
ID uint `json:"id"`
|
|
Name string `json:"name"`
|
|
Description string `json:"description"`
|
|
ConfigType string `json:"configType"` // kubeconfig | token(空值视为 kubeconfig,向后兼容)
|
|
APIServer string `json:"apiServer"` // 展示用
|
|
KubeConfig string `json:"kubeconfig"` // 统一存储(token 接入时存构造出的等价 kubeconfig)
|
|
KubeConfigPath string `json:"kubeconfigPath"`
|
|
Context string `json:"context"`
|
|
Version string `json:"version"`
|
|
NodesCount int `json:"nodesCount"`
|
|
Status string `json:"status"`
|
|
LastConnected time.Time `json:"lastConnected"`
|
|
CreatedAt time.Time `json:"createdAt"`
|
|
UpdatedAt time.Time `json:"updatedAt"`
|
|
}
|
|
|
|
func (c *Cluster) Sanitized() map[string]interface{} {
|
|
return map[string]interface{}{
|
|
"id": c.ID,
|
|
"name": c.Name,
|
|
"description": c.Description,
|
|
"configType": c.ConfigType,
|
|
"apiServer": c.APIServer,
|
|
"context": c.Context,
|
|
"version": c.Version,
|
|
"nodesCount": c.NodesCount,
|
|
"status": c.Status,
|
|
"hasKubeconfig": c.KubeConfig != "",
|
|
"lastConnected": c.LastConnected,
|
|
"createdAt": c.CreatedAt,
|
|
"updatedAt": c.UpdatedAt,
|
|
}
|
|
}
|