@bifos/nhncloud-cli 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +147 -1
- package/dist/index.js +1398 -20
- package/package.json +1 -1
- package/skills/nhncloud-cli/SKILL.md +138 -3
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: nhncloud-cli
|
|
3
|
-
description: NHN Cloud 서비스 CLI. 자격증명 설정(configure), Log & Crash 로그 검색·전송(logncrash search/send), Deploy 배포 실행·바이너리 그룹·바이너리 목록 조회·업로드·다운로드(deploy upload/download), Compute 인스턴스 관리(instance
|
|
3
|
+
description: NHN Cloud 서비스 CLI. 자격증명 설정(configure), Log & Crash 로그 검색·전송(logncrash search/send/export), Deploy 배포 실행·바이너리 그룹·바이너리 목록 조회·업로드·다운로드(deploy upload/download), Compute 인스턴스 관리(instance), VPC·서브넷 조회(network), Block Storage(volume), Floating IP(floatingip), NHN Container Registry(ncr), NHN Kubernetes Service(nks supports/cluster/nodegroup/addon/kubeconfig) 등 NHN Cloud API 를 터미널·AI 에이전트에서 호출한다.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# nhncloud-cli
|
|
7
7
|
|
|
8
|
-
NHN Cloud
|
|
9
|
-
`configure`, `logncrash search/send`, `deploy`, `instance
|
|
8
|
+
NHN Cloud 서비스를 AWS CLI 방식으로 호출하는 TypeScript CLI.
|
|
9
|
+
`configure`, `logncrash search/send/export`, `deploy`, `instance`, `network`, `volume`, `floatingip`, `ncr`, `nks` 명령을 지원한다.
|
|
10
10
|
|
|
11
11
|
## 설치
|
|
12
12
|
|
|
@@ -86,6 +86,43 @@ logncrash appkey 와 secret 은 콘솔 → Log & Crash Search → 프로젝트
|
|
|
86
86
|
| `--quiet` | 핵심 식별자만 출력 | 스크립팅 |
|
|
87
87
|
|
|
88
88
|
**AI 에이전트는 `--json` 을 사용하여 구조화된 데이터를 파싱하라.**
|
|
89
|
+
단, `--json`은 CLI 출력 계약이며 API 원본 래퍼를 그대로 보존하지 않을 수 있다.
|
|
90
|
+
|
|
91
|
+
| 명령 | `--json` 출력 shape |
|
|
92
|
+
|------|---------------------|
|
|
93
|
+
| `logncrash search` | `{ totalItems, pageNumber, pageSize, data }` 객체 |
|
|
94
|
+
| `deploy binary-groups` | `binaryGroups` 래퍼를 언랩한 배열 |
|
|
95
|
+
| `deploy binaries` | `{ totalCount, binaries }` 객체 |
|
|
96
|
+
| `instance list` | `servers` 래퍼를 언랩한 server 배열 |
|
|
97
|
+
| `instance get` | `server` 래퍼를 언랩한 단일 server 객체 |
|
|
98
|
+
| `instance flavors` | `flavors` 래퍼를 언랩한 flavor 배열 |
|
|
99
|
+
| `instance images` | `images` 래퍼를 언랩한 image 배열 |
|
|
100
|
+
| `instance availability-zones` | `availabilityZoneInfo` 래퍼를 언랩한 배열 |
|
|
101
|
+
| `instance keypairs` | `keypairs[].keypair`를 flatten한 keypair 배열 |
|
|
102
|
+
| `network list` | VPC 배열 |
|
|
103
|
+
| `network subnet list` | subnet 배열 |
|
|
104
|
+
| `volume list` | volume 배열 |
|
|
105
|
+
| `volume get` | 단일 volume 객체 |
|
|
106
|
+
| `floatingip list` | floating IP 배열 |
|
|
107
|
+
| `ncr list` | `registries` 래퍼를 언랩한 registry 배열 |
|
|
108
|
+
| `ncr get` | `registry` 래퍼를 언랩한 단일 registry 객체 |
|
|
109
|
+
| `ncr images` | repository 배열 |
|
|
110
|
+
| `ncr tags` | tag 배열 |
|
|
111
|
+
| `nks supports` | 지원 Kubernetes version / event type 객체 |
|
|
112
|
+
| `nks cluster list` | cluster 배열 |
|
|
113
|
+
| `nks cluster events` | event 배열 |
|
|
114
|
+
| `nks nodegroup list` | nodegroup 배열 |
|
|
115
|
+
| `nks addon-type list` | addon type 배열 |
|
|
116
|
+
| `nks addon list` | addon 배열 |
|
|
117
|
+
| `nks cluster addon list` | cluster addon 배열 |
|
|
118
|
+
|
|
119
|
+
NKS 단건 조회는 API 객체를 그대로 반환한다.
|
|
120
|
+
예를 들어 `nks cluster get`, `nks cluster event`, `nks nodegroup get`, `nks addon-type get`, `nks addon get`, `nks cluster addon get`, `nks cluster ipacl`, `nks nodegroup autoscale` 은 table 출력용 최소 컬럼을 만들고 `--json` 에서는 raw 객체를 보존한다.
|
|
121
|
+
NKS 쓰기 명령 중 생성·resize·설정 변경·노드 action·애드온 변경은 `{ uuid }` 응답을 반환한다.
|
|
122
|
+
삭제 명령은 성공 메시지만 stderr에 쓰고 stdout은 비운다.
|
|
123
|
+
`nks cluster kubeconfig` 는 kubeconfig 문자열을 stdout 또는 파일로 저장한다.
|
|
124
|
+
|
|
125
|
+
예: `nhncloud instance get <instance-id> --json`은 `.server.status`가 아니라 `.status`를 읽는다.
|
|
89
126
|
|
|
90
127
|
---
|
|
91
128
|
|
|
@@ -109,6 +146,12 @@ logncrash appkey 와 secret 은 콘솔 → Log & Crash Search → 프로젝트
|
|
|
109
146
|
| NCR 이미지 목록 (JSON) | `nhncloud ncr images <registry> --json` |
|
|
110
147
|
| NCR 태그 목록 조회 | `nhncloud ncr tags <registry> <repository>` |
|
|
111
148
|
| NCR 태그 목록 (JSON) | `nhncloud ncr tags <registry> <repository> --json` |
|
|
149
|
+
| NKS 지원 버전 조회 | `nhncloud nks supports --json` |
|
|
150
|
+
| NKS 클러스터 목록 조회 | `nhncloud nks cluster list --json` |
|
|
151
|
+
| NKS kubeconfig 저장 | `nhncloud nks cluster kubeconfig <cluster> --output ./kubeconfig` |
|
|
152
|
+
| NKS 노드 그룹 목록 조회 | `nhncloud nks nodegroup list <cluster> --json` |
|
|
153
|
+
| NKS 애드온 목록 조회 | `nhncloud nks addon list --k8s-version v1.30.1 --json` |
|
|
154
|
+
| NKS 클러스터 애드온 설치 | `nhncloud nks cluster addon install <cluster> --name coredns --version 1.0.0 --resolve-conflicts overwrite` |
|
|
112
155
|
|
|
113
156
|
## logncrash search 옵션
|
|
114
157
|
|
|
@@ -123,6 +166,18 @@ logncrash appkey 와 secret 은 콘솔 → Log & Crash Search → 프로젝트
|
|
|
123
166
|
|
|
124
167
|
전역 옵션: `--json` / `--quiet` / `--no-color`
|
|
125
168
|
|
|
169
|
+
`--query` 는 Log & Crash Search API 의 Lucene 쿼리 원문이다.
|
|
170
|
+
콘솔의 body 키워드 검색처럼 쓰고 싶으면 필드를 명시한다.
|
|
171
|
+
|
|
172
|
+
| 의도 | 쿼리 |
|
|
173
|
+
|------|------|
|
|
174
|
+
| body 단어 검색 | `body:request_received` |
|
|
175
|
+
| body 부분 문자열 검색 | `body:*request_received*` |
|
|
176
|
+
| logType 검색 | `logType:"ERROR"` |
|
|
177
|
+
|
|
178
|
+
전송 직후에는 인덱싱 지연으로 잠시 0건이 나올 수 있다.
|
|
179
|
+
반복 검색이나 넓은 wildcard 검색은 API rate limit 에 걸릴 수 있으므로 시간 범위를 좁혀 확인한다.
|
|
180
|
+
|
|
126
181
|
## 시간 입력 형식
|
|
127
182
|
|
|
128
183
|
- 상대시간: `1h` (1시간 전), `30m` (30분 전), `2d` (2일 전), `now` (현재)
|
|
@@ -705,3 +760,83 @@ nhncloud ncr tags <registry> <repository> --json | jq 'sort_by(.push_time) | las
|
|
|
705
760
|
| registry / repository 인수 공백·빈값 | 3 (PARAM_ERROR) |
|
|
706
761
|
| UAK 인증 실패 (401/403) | 2 (AUTH_ERROR) |
|
|
707
762
|
| NCR API 오류 | 1 (API_ERROR) |
|
|
763
|
+
|
|
764
|
+
## nks — NHN Kubernetes Service 관리
|
|
765
|
+
|
|
766
|
+
NKS는 `iaas` 자격증명으로 Keystone 토큰을 발급하고 `container-infra` API를 호출한다.
|
|
767
|
+
AI 에이전트는 조회 작업에 `--json`을 우선 사용한다.
|
|
768
|
+
지원 region은 `kr1`, `kr2`, `kr3` 이다.
|
|
769
|
+
|
|
770
|
+
### 조회 시나리오
|
|
771
|
+
|
|
772
|
+
| 의도 | 커맨드 |
|
|
773
|
+
|------|--------|
|
|
774
|
+
| 지원 Kubernetes version / event type 확인 | `nhncloud nks supports --json` |
|
|
775
|
+
| 클러스터 목록 조회 | `nhncloud nks cluster list --json` |
|
|
776
|
+
| 클러스터 상세 조회 | `nhncloud nks cluster get <cluster> --json` |
|
|
777
|
+
| 작업 이력 조회 | `nhncloud nks cluster events <cluster> --json` |
|
|
778
|
+
| 작업 이력 단건 조회 | `nhncloud nks cluster event <cluster> <event> --json` |
|
|
779
|
+
| API endpoint IP ACL 조회 | `nhncloud nks cluster ipacl <cluster> --json` |
|
|
780
|
+
| kubeconfig stdout 출력 | `nhncloud nks cluster kubeconfig <cluster>` |
|
|
781
|
+
| kubeconfig 파일 저장 | `nhncloud nks cluster kubeconfig <cluster> --output ./kubeconfig` |
|
|
782
|
+
| 노드 그룹 목록 조회 | `nhncloud nks nodegroup list <cluster> --json` |
|
|
783
|
+
| 노드 그룹 autoscale 조회 | `nhncloud nks nodegroup autoscale <cluster> <nodegroup> --json` |
|
|
784
|
+
| 애드온 타입 조회 | `nhncloud nks addon-type list --json` |
|
|
785
|
+
| 애드온 타입 단건 조회 | `nhncloud nks addon-type get <addon-type> --json` |
|
|
786
|
+
| 설치 가능 애드온 조회 | `nhncloud nks addon list --k8s-version v1.30.1 --json` |
|
|
787
|
+
| 설치 가능 애드온 단건 조회 | `nhncloud nks addon get <addon> --json` |
|
|
788
|
+
| 클러스터 설치 애드온 조회 | `nhncloud nks cluster addon list <cluster> --json` |
|
|
789
|
+
| 클러스터 설치 애드온 단건 조회 | `nhncloud nks cluster addon get <cluster> <addon> --json` |
|
|
790
|
+
|
|
791
|
+
### 쓰기 시나리오
|
|
792
|
+
|
|
793
|
+
복잡한 생성·변경 작업은 공식 API payload를 JSON 파일로 전달한다.
|
|
794
|
+
삭제·제거 명령은 비대화형 환경에서 `--yes` 가 필요하다.
|
|
795
|
+
payload 원문에는 appkey 같은 민감값이 들어갈 수 있으므로 로그에 출력하지 않는다.
|
|
796
|
+
|
|
797
|
+
```bash
|
|
798
|
+
# 생성
|
|
799
|
+
nhncloud nks cluster create --file ./cluster-create.json
|
|
800
|
+
nhncloud nks nodegroup create <cluster> --file ./nodegroup-create.json
|
|
801
|
+
|
|
802
|
+
# 클러스터 변경
|
|
803
|
+
nhncloud nks cluster resize <cluster> --nodegroup worker --node-count 3
|
|
804
|
+
nhncloud nks cluster set-ipacl <cluster> --file ./ipacl.json
|
|
805
|
+
nhncloud nks cluster renew-certificate <cluster> --term-of-validity 3
|
|
806
|
+
nhncloud nks cluster update-sgw <cluster> --ncr-sgw <uuid> --obs-sgw <uuid>
|
|
807
|
+
nhncloud nks cluster set-control-plane-log <cluster> --file ./control-plane-log.json
|
|
808
|
+
|
|
809
|
+
# 노드 그룹 변경
|
|
810
|
+
nhncloud nks nodegroup stop-node <cluster> worker --nodes node-1,node-2
|
|
811
|
+
nhncloud nks nodegroup start-node <cluster> worker --nodes node-1,node-2
|
|
812
|
+
nhncloud nks nodegroup set-autoscale <cluster> worker --file ./autoscale.json
|
|
813
|
+
nhncloud nks nodegroup set-metric-autoscale <cluster> worker --file ./metric-autoscale.json
|
|
814
|
+
nhncloud nks nodegroup upgrade <cluster> worker --version v1.30.1
|
|
815
|
+
nhncloud nks nodegroup set-userscript <cluster> worker --file ./userscript.sh
|
|
816
|
+
nhncloud nks nodegroup update-flavor <cluster> worker --flavor <flavor-uuid>
|
|
817
|
+
nhncloud nks nodegroup set-fip-auto-bind <cluster> worker --file ./fip-auto-bind.json
|
|
818
|
+
nhncloud nks nodegroup set-labels <cluster> worker --file ./labels.json
|
|
819
|
+
|
|
820
|
+
# 애드온 변경
|
|
821
|
+
nhncloud nks cluster addon install <cluster> \
|
|
822
|
+
--name coredns \
|
|
823
|
+
--version 1.0.0 \
|
|
824
|
+
--resolve-conflicts overwrite
|
|
825
|
+
|
|
826
|
+
nhncloud nks cluster addon update <cluster> coredns \
|
|
827
|
+
--version 1.0.1 \
|
|
828
|
+
--resolve-conflicts preserve
|
|
829
|
+
|
|
830
|
+
nhncloud nks cluster addon remove <cluster> coredns --yes
|
|
831
|
+
```
|
|
832
|
+
|
|
833
|
+
### nks 에러 코드
|
|
834
|
+
|
|
835
|
+
| 상황 | exit code |
|
|
836
|
+
|------|-----------|
|
|
837
|
+
| `iaas` 자격증명 누락·불완전 | 4 (CONFIG_ERROR) |
|
|
838
|
+
| Keystone 또는 NKS 인증 실패 (401/403) | 2 (AUTH_ERROR) |
|
|
839
|
+
| 지원하지 않는 NKS region | 3 (PARAM_ERROR) |
|
|
840
|
+
| payload JSON 파일 파싱 실패 | 3 (PARAM_ERROR) |
|
|
841
|
+
| 위험 명령에서 비대화형 `--yes` 누락 | 3 (PARAM_ERROR) |
|
|
842
|
+
| NKS API 오류 / 응답 형식 불일치 | 1 (API_ERROR) |
|