@bifos/nhncloud-cli 0.6.0 → 0.7.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.
@@ -0,0 +1,91 @@
1
+ # Troubleshooting Reference
2
+
3
+ 실패 시 exit code, 인증 모델, profile/region, JSON shape를 먼저 확인한다.
4
+
5
+ ## 빠른 진단 순서
6
+
7
+ 1. 명령에 `--profile <name>`을 명시했는지 확인한다.
8
+ 2. IaaS/NKS/NCR 명령이면 `--region <region>`이 의도와 맞는지 확인한다.
9
+ 3. 조회 명령을 `--json`으로 다시 실행해 stdout shape를 확인한다.
10
+ 4. `nhncloud commands --json`으로 실제 command path와 option 이름을 확인한다.
11
+ 5. exit code를 확인한다.
12
+ 6. 서비스별 인증 모델을 대조한다.
13
+
14
+ ## 인증 모델
15
+
16
+ | 서비스 | 비밀 | 인증 방식 |
17
+ |--------|------|-----------|
18
+ | Log & Crash 검색/export | appkey + secret | `X-LNCS-SECRET` |
19
+ | Log & Crash send | appkey | body `projectName=appkey`, 인증 헤더 없음 |
20
+ | Deploy | UAK id + secret | OAuth Bearer token |
21
+ | Instance/network/volume/floatingip | tenantId + username + API password | Keystone `X-Auth-Token` |
22
+ | NKS | tenantId + username + API password | Keystone `X-Auth-Token` + container-infra API version |
23
+ | NCR registry | UAK id + secret + NCR appkey | `X-TC-AUTHENTICATION-*` |
24
+ | NCR images/tags | UAK id + secret | HTTP Basic Auth to Harbor REST |
25
+
26
+ ## Exit code
27
+
28
+ | exit code | 의미 | 대표 원인 |
29
+ |-----------|------|-----------|
30
+ | 1 | API 오류 | 4xx/5xx, 봉투 실패, wait timeout |
31
+ | 2 | 인증 실패 | UAK/secret/password 오류, 권한 부족 |
32
+ | 3 | 입력 오류 | 필수 옵션 누락, region 미지원, 시간 범위 초과, `--yes` 누락 |
33
+ | 4 | config 오류 | profile 없음, 자격증명 블록 누락 |
34
+
35
+ ## Profile 누락
36
+
37
+ profile은 다음 순서로 해석된다.
38
+
39
+ 1. `--profile <name>`
40
+ 2. `NHNCLOUD_PROFILE`
41
+ 3. `~/.nhncloud/config.json`의 `defaultProfile`
42
+ 4. `default`
43
+
44
+ 자동화에서 의도와 다른 profile이 쓰이면 `--profile`을 명시한다.
45
+
46
+ ## Region mismatch
47
+
48
+ IaaS/NKS/NCR은 region별 endpoint를 사용한다.
49
+ 리소스가 보이지 않으면 같은 profile에서 다른 region을 조회했을 수 있다.
50
+
51
+ ```bash
52
+ nhncloud instance list --region kr1 --json
53
+ nhncloud instance list --region kr2 --json
54
+ nhncloud nks cluster list --region kr1 --json
55
+ nhncloud ncr list --region kr2 --json
56
+ ```
57
+
58
+ ## JSON shape 혼동
59
+
60
+ CLI는 API wrapper를 일관되게 언랩한다.
61
+ 예를 들어 `instance get --json`은 `.server.status`가 아니라 `.status`다.
62
+ 목록과 단건의 shape가 다를 수 있으므로 jq path를 쓰기 전에 `--json` 원문을 확인한다.
63
+
64
+ ```bash
65
+ nhncloud instance get <instance-id> --json | jq keys
66
+ nhncloud ncr list --json | jq '.[0] | keys'
67
+ ```
68
+
69
+ ## Log & Crash 검색 제한
70
+
71
+ - `--from`은 최근 90일 이내여야 한다.
72
+ - `--to - --from` 범위는 31일 이하여야 한다.
73
+ - scrollKey는 1분 만료다.
74
+ - export가 중간 실패하면 검색 범위를 좁히거나 `--size`를 키운다.
75
+
76
+ ## 쓰기 명령 confirm
77
+
78
+ 삭제, 제거, 비용 발생 가능 명령은 비대화형 환경에서 `--yes`가 필요할 수 있다.
79
+
80
+ ```bash
81
+ nhncloud instance delete <instance-id> --yes
82
+ nhncloud floatingip delete <floatingip-id> --yes
83
+ nhncloud nks cluster delete <cluster> --yes
84
+ nhncloud nks cluster addon remove <cluster> <addon> --yes
85
+ ```
86
+
87
+ ## stdout/stderr 분리
88
+
89
+ 데이터는 stdout에 출력된다.
90
+ 진행 상황, 저장 완료, 성공 메시지, 에러는 stderr에 출력된다.
91
+ 스크립트에서 stdout만 파싱하고 stderr는 로그로 분리한다.