icurfer 6207f6b83f
All checks were successful
Build And Test / build-and-push (push) Successful in 1m54s
v0.0.13 | Skip Django JWT auth for NHN API (Kong handles it)
- Add NHNBaseView with authentication_classes = []
- All NHN View classes now inherit from NHNBaseView
- Kong already validates JWT, no need for Django to re-validate

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 17:22:23 +09:00
2026-01-24 02:16:23 +09:00
2026-01-17 00:04:18 +09:00

msa-django-nhn

NHN Cloud 리소스 관리를 위한 통합 API 서비스입니다.

기술 스택

분류 기술
Framework Django 4.2.14
API Django REST Framework 3.16.0
Auth SimpleJWT 5.5.0 (RS256)
Database MySQL (mysqlclient 2.2.7)
Docs drf-yasg 1.21.10
Server Gunicorn 20.1.0

지원 서비스

  • Compute: 인스턴스, Flavor, Keypair, 이미지
  • VPC: VPC, 서브넷, Floating IP, 보안 그룹
  • NKS: Kubernetes 클러스터, 노드 그룹
  • Storage: Object Storage 컨테이너
  • DNS Plus: Zone, 레코드셋, GSLB, Pool, 헬스체크
  • Load Balancer: LB, 리스너, 풀, 멤버, L7 정책

API 엔드포인트

Token

Method Endpoint 설명
POST /api/nhn/token/ 토큰 생성

Compute

Method Endpoint 설명
GET /api/nhn/compute/instances/ 인스턴스 목록
POST /api/nhn/compute/instances/create/ 인스턴스 생성
GET /api/nhn/compute/instances/<id>/ 인스턴스 상세
POST /api/nhn/compute/instances/<id>/action/ 인스턴스 액션
GET /api/nhn/compute/flavors/ Flavor 목록
GET /api/nhn/compute/keypairs/ Keypair 목록
GET /api/nhn/compute/images/ 이미지 목록

VPC/Network

Method Endpoint 설명
GET/POST /api/nhn/vpc/ VPC 목록/생성
GET /api/nhn/vpc/<id>/ VPC 상세
GET/POST /api/nhn/subnet/ 서브넷 목록/생성
GET /api/nhn/floatingip/ Floating IP 목록
GET /api/nhn/securitygroup/ 보안 그룹 목록

NKS (Kubernetes)

Method Endpoint 설명
GET /api/nhn/nks/clusters/ 클러스터 목록
POST /api/nhn/nks/clusters/create/ 클러스터 생성
GET /api/nhn/nks/clusters/<name>/ 클러스터 상세
GET /api/nhn/nks/clusters/<name>/config/ kubeconfig
GET /api/nhn/nks/clusters/<name>/nodegroups/ 노드 그룹 목록
POST /api/nhn/nks/clusters/<name>/nodegroups/create/ 노드 그룹 생성

DNS Plus

Method Endpoint 설명
GET/POST /api/nhn/dns/zones/ Zone 목록/생성
GET/POST /api/nhn/dns/zones/<id>/recordsets/ 레코드셋
GET/POST /api/nhn/dns/gslbs/ GSLB 목록/생성
GET/POST /api/nhn/dns/pools/ Pool 목록/생성
GET/POST /api/nhn/dns/health-checks/ 헬스체크

Load Balancer

Method Endpoint 설명
GET/POST /api/nhn/lb/loadbalancers/ LB 목록/생성
GET/POST /api/nhn/lb/listeners/ 리스너
GET/POST /api/nhn/lb/pools/
GET/POST /api/nhn/lb/pools/<id>/members/ 멤버
GET/POST /api/nhn/lb/healthmonitors/ 헬스 모니터
GET/POST /api/nhn/lb/l7policies/ L7 정책

Async Task

Method Endpoint 설명
GET /api/nhn/tasks/ 비동기 작업 목록
GET /api/nhn/tasks/<id>/ 작업 상세

API 문서

  • Swagger UI: /swagger/

프로젝트 구조

nhn/
├── views.py           # API 뷰 (40개 이상)
├── models.py          # AsyncTask 모델
├── urls.py            # URL 라우팅
├── serializers.py     # DRF 직렬화
├── authentication.py  # JWT 인증
└── packages/          # NHN Cloud API 클라이언트
    ├── base.py        # 기본 클래스, 엔드포인트
    ├── token.py       # Token API
    ├── compute.py     # Compute API
    ├── vpc.py         # VPC API
    ├── nks.py         # NKS API
    ├── storage.py     # Storage API
    ├── dnsplus.py     # DNS Plus API
    └── loadbalancer.py # LB API

환경 변수

# Django
DEBUG=1
SECRET_KEY=your-secret-key
ISTIO_JWT=1

# Database
SQL_ENGINE=django.db.backends.mysql
SQL_HOST=localhost
SQL_USER=user
SQL_PASSWORD=password
SQL_DATABASE=msa-nhn
SQL_PORT=3306

요청 헤더

NHN Cloud API 호출 시 다음 헤더가 필요합니다:

헤더 설명
X-NHN-Token NHN Cloud API 토큰
X-NHN-Region 리전 (kr1, kr2, jp1)
X-NHN-Tenant-ID 테넌트 ID
X-NHN-Appkey DNS Plus Appkey (DNS API용)

실행 방법

개발 서버

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python3 manage.py migrate
python3 manage.py runserver 0.0.0.0:8900

Docker

docker build -t msa-django-nhn .
docker run -p 8000:8000 --env-file .env.dev msa-django-nhn
Description
No description provided
Readme 175 KiB
Languages
Python 99.8%
Dockerfile 0.2%