Skip to content

[fix][cluster] modify code for list cluster with project_id #187

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions dingo_command/api/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ async def create_cluster(cluster_object:ClusterObject, token: str = Depends(get_
@router.get("/cluster/list", summary="k8s集群列表", description="k8s集群列表")
async def list_cluster(id:str = Query(None, description="集群id"),
name:str = Query(None, description="集群名称"),
project_id: str = Query(None, description="项目id"),
type:str = Query(None, description="集群类型"),
page: int = Query(1, description="页码"),
page_size: int = Query(10, description="页数量大小"),
Expand All @@ -50,6 +51,8 @@ async def list_cluster(id:str = Query(None, description="集群id"),
# 查询条件组装
if name:
query_params['name'] = name
if project_id:
query_params['project_id'] = project_id
if type:
query_params['type'] = type
query_params = {}
Expand All @@ -60,7 +63,7 @@ async def list_cluster(id:str = Query(None, description="集群id"),
query_params['name'] = name
if type:
query_params['type'] = type
result = ClusterService.list_clusters(id, query_params, page,page_size, sort_keys,sort_dirs)
result = cluster_service.list_clusters(query_params, page,page_size, sort_keys,sort_dirs)
return result
except Exception as e:
return None
Expand All @@ -73,8 +76,7 @@ async def get_cluster_private_key(cluster_id:str = Query(None, description="集
return None
try:
# 根据id查询集群
cs=ClusterService()
private_key = cs.get_key_file(cluster_id, instance_id)
private_key = cluster_service.get_key_file(cluster_id, instance_id)
if private_key is None:
raise HTTPException(status_code=400, detail="Key not found")
filename = "id_rsa.pem"
Expand Down