fix: 删除操作清理远端资源并拦截悬空引用
- 部署删除: k8s 模式清理 StatefulSet/Service/ConfigMap 与 PVC,先卸载关联采集器 - 采集器删除: 同步卸载成功后再删记录,失败保留避免孤儿 - 集群/存储/主机删除: 有部署或采集器引用时拒绝,避免悬空外键 - Token RBAC 补 services/proxy,保证 cluster-svc 数据源可查询
This commit is contained in:
1 parent
56e1245b70
commit
b433b5f9dd
7 files changed
+91
-20
No files matched your search
@@ -211,6 +211,11 @@ func (s *ClusterService) Delete(id uint) error {
|
||||
defer db.Unlock()
|
||||
for i, c := range db.Clusters {
|
||||
if c.ID == id {
|
||||
for _, d := range db.Deployments {
|
||||
if d.ClusterID != nil && *d.ClusterID == id {
|
||||
return fmt.Errorf("仍有部署使用该集群,请先删除部署")
|
||||
}
|
||||
}
|
||||
if c.KubeConfigPath != "" {
|
||||
_ = os.Remove(c.KubeConfigPath)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user