Skip to content

feat(adminpanel): 리소스 브로커 VM 목록을 계정 노드 상태로 조회하는 API 추가 - #85

Merged
samdi70 merged 2 commits into
mainfrom
feature/admin-resources
Oct 1, 2026
Merged

samdi70 merged 2 commits into
mainfrom
feature/admin-resources

Conversation

@samdi70

@samdi70 samdi70 commented Sep 24, 2026

Copy link
Copy Markdown
Collaborator

배경

GET /admin/resources 는 명세와 프론트 화면이 있는데 백엔드 경로가 없었습니다.
리소스 브로커의 GET /v1/inventory/resource-targets 를 기준으로 구현했습니다.

매핑

  • 브로커는 VM 평면 목록, 백엔드는 계정→노드 계층입니다. account_id 로 묶습니다.
  • 브로커 limit 상한이 500 이라 total 을 채울 때까지 offset 으로 이어 받습니다.

설정

RESOURCE_BROKER_BASE_URL RESOURCE_BROKER_TIMEOUT_SECONDS INVENTORY_API_TOKEN
(.env.example 에 추가). 기본값만으로도 부팅되며, 실제 주소와 토큰은 배포 환경에서 넣습니다.

config/settings.py 의 스케줄러 블록은 손대지 않고, 뒤에 같은 규칙의 URL 검증 함수와 브로커
설정 3줄만 추가했습니다. #80·#26 도 같은 파일 끝에 붙여서 머지 순서에 따라 파일 끝 충돌이
나지만 양쪽 살리기로 끝납니다.

테스트

  • 8개: adminpanel 233개, 전체 590개 통과. URL 검증은 나쁜 값 4종 거부·정상값 통과 확인.
  • 머지 이전에 리소스 브로커와 테스트해볼 수 있으면 해보겠습니다.

하지 않은 것

응답 캐싱. 호출마다 브로커에 바로 묻습니다. 느리면 cache.get_or_set 로 추가하겠습니다.

Comment on lines +36 to +38
with urlopen( # nosec B310
request, timeout=settings.RESOURCE_BROKER_TIMEOUT_SECONDS
) as response:

@jongcoding jongcoding left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

문제 인스턴스 1개에 컨테이너 2개를 띄우니 running_instances가 2로 내려옵니다
컨테이너 수를 인스턴스 수로 쓰고 있어서, 실제 인스턴스 수를 집계하거나 필드명을 맞춰주시면 좋겠습니다

Comment thread apps/adminpanel/views.py Outdated
"node_id": target.get("resource_target_id"),
"node_name": target.get("name"),
"status": "HEALTHY" if healthy else "DEGRADED",
"running_instances": (target.get("container_storage_usage") or {}).get(

@jongcoding jongcoding Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

total_container_count는 컨테이너 수라 멀티 컨테이너 인스턴스 1개도 2개로 집계됩니다
인스턴스 수를 별도로 받거나 container_count로 표시해주시면 좋겠습니다

@samdi70
samdi70 force-pushed the feature/admin-resources branch from 4616d01 to 2ca56ed Compare October 1, 2026 02:56

@jongcoding jongcoding left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

컨테이너 수를 인스턴스 수로 표시하던 부분은 수정됐습니다
실제 브로커로 501개 노드 조회와 계정별 합산도 확인했고, 추가 수정 의견은 없습니다

@samdi70
samdi70 merged commit f752723 into main Oct 1, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants