Skip to content

Commit

Permalink
delete all pvc in tidbcluster ns (#5373)
Browse files Browse the repository at this point in the history
  • Loading branch information
z2665 authored Nov 6, 2023
1 parent 0b10432 commit b7170fa
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/http-service/server/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1158,6 +1158,17 @@ func (s *ClusterServer) DeleteCluster(ctx context.Context, req *api.DeleteCluste

}
// we don't delete the ns for now, since some backup may still stored in it
// TODO(http-service): we delete all pvc in ns for now, but we may only delete tidbcluster pvc in future
if err := kubeCli.CoreV1().PersistentVolumeClaims(req.ClusterId).DeleteCollection(ctx, metav1.DeleteOptions{}, metav1.ListOptions{}); err != nil {
if apierrors.IsNotFound(err) {
logger.Warn("PersistentVolumeClaims not found", zap.Error(err))
} else {
logger.Error("Delete PersistentVolumeClaims failed", zap.Error(err))
setResponseStatusCodes(ctx, http.StatusInternalServerError)
message := fmt.Sprintf("delete PersistentVolumeClaims failed: %s", err.Error())
return &api.DeleteClusterResp{Success: false, Message: &message}, nil
}
}
return &api.DeleteClusterResp{Success: true}, nil
}

Expand Down

0 comments on commit b7170fa

Please sign in to comment.