Add new frontend pages for the multi-tenant OCDP platform: - Charts page (/charts): Browse Harbor OCI registries to list Helm chart repositories and versions, with deploy modal to launch charts on selected clusters - Monitoring page (/monitoring): Display cluster metrics (CPU/Memory/GPU usage) and per-node details with resource utilization bars - Chart References page (/chart-references): CRUD for chart metadata references - Values Templates page (/templates): CRUD for Helm values templates with version history and rollback support - Sidebar: Add Charts navigation, update Storage and Templates links - api.ts: Add all API client functions (clusterApi, registryApi, instanceApi, monitoringApi, storageApi, chartReferenceApi, valuesTemplateApi, workspaceApi, userApi) with full TypeScript types Note: deploy flow and values template rollback not yet end-to-end tested.
95 lines
3.4 KiB
Go
95 lines
3.4 KiB
Go
package dto
|
|
|
|
// CreateClusterRequest 创建集群请求
|
|
type CreateClusterRequest struct {
|
|
Name string `json:"name" binding:"required"`
|
|
Host string `json:"host" binding:"required"`
|
|
CAData string `json:"caData"`
|
|
CADataAlt string `json:"ca_data"`
|
|
CertData string `json:"certData"`
|
|
CertDataAlt string `json:"cert_data"`
|
|
KeyData string `json:"keyData"`
|
|
KeyDataAlt string `json:"key_data"`
|
|
Token string `json:"token"`
|
|
Description string `json:"description"`
|
|
IsolationMode string `json:"isolationMode"` // 'namespace' | 'cluster'
|
|
DefaultNamespace string `json:"defaultNamespace"` // 默认 namespace 前缀
|
|
IsShared bool `json:"isShared"` // 是否为共享集群
|
|
}
|
|
|
|
// UpdateClusterRequest 更新集群请求
|
|
type UpdateClusterRequest struct {
|
|
Name string `json:"name"`
|
|
Host string `json:"host"`
|
|
CAData string `json:"caData"`
|
|
CADataAlt string `json:"ca_data"`
|
|
CertData string `json:"certData"`
|
|
CertDataAlt string `json:"cert_data"`
|
|
KeyData string `json:"keyData"`
|
|
KeyDataAlt string `json:"key_data"`
|
|
Token string `json:"token"`
|
|
Description string `json:"description"`
|
|
IsolationMode string `json:"isolationMode"`
|
|
DefaultNamespace string `json:"defaultNamespace"`
|
|
IsShared *bool `json:"isShared"`
|
|
}
|
|
|
|
// Normalize 将多种命名风格的字段合并到统一字段
|
|
func (r *CreateClusterRequest) Normalize() {
|
|
if r.CAData == "" {
|
|
r.CAData = r.CADataAlt
|
|
}
|
|
if r.CertData == "" {
|
|
r.CertData = r.CertDataAlt
|
|
}
|
|
if r.KeyData == "" {
|
|
r.KeyData = r.KeyDataAlt
|
|
}
|
|
}
|
|
|
|
// Normalize 将多种命名风格的字段合并到统一字段
|
|
func (r *UpdateClusterRequest) Normalize() {
|
|
if r.CAData == "" {
|
|
r.CAData = r.CADataAlt
|
|
}
|
|
if r.CertData == "" {
|
|
r.CertData = r.CertDataAlt
|
|
}
|
|
if r.KeyData == "" {
|
|
r.KeyData = r.KeyDataAlt
|
|
}
|
|
}
|
|
|
|
// ClusterResponse 集群响应(敏感数据已脱敏)
|
|
type ClusterResponse struct {
|
|
ID string `json:"id"`
|
|
WorkspaceID string `json:"workspaceId,omitempty"`
|
|
OwnerID string `json:"ownerId,omitempty"`
|
|
Name string `json:"name"`
|
|
Host string `json:"host"`
|
|
Description string `json:"description"`
|
|
IsolationMode string `json:"isolationMode"` // 'namespace' | 'cluster'
|
|
DefaultNamespace string `json:"defaultNamespace"` // 默认 namespace 前缀
|
|
IsShared bool `json:"isShared"` // 是否为共享集群
|
|
|
|
// 认证配置状态(不返回实际证书数据,仅返回是否已配置)
|
|
HasCAData bool `json:"hasCaData"`
|
|
HasCertData bool `json:"hasCertData"`
|
|
HasKeyData bool `json:"hasKeyData"`
|
|
HasToken bool `json:"hasToken"`
|
|
// 脱敏数据(仅用于前端显示,实际值为掩码)
|
|
CAData string `json:"caData,omitempty"` // 脱敏显示(••••••••)
|
|
CertData string `json:"certData,omitempty"` // 脱敏显示(••••••••)
|
|
KeyData string `json:"keyData,omitempty"` // 脱敏显示(••••••••)
|
|
Token string `json:"token,omitempty"` // 脱敏显示(••••••••)
|
|
CreatedAt string `json:"createdAt"`
|
|
UpdatedAt string `json:"updatedAt"`
|
|
}
|
|
|
|
// ClusterHealthResponse 集群健康状态响应
|
|
type ClusterHealthResponse struct {
|
|
Healthy bool `json:"healthy"`
|
|
Message string `json:"message,omitempty"`
|
|
Version string `json:"version,omitempty"`
|
|
}
|