improvements: ApplicationSet ignoreDifferences(SS VCT) + vmauth drop unauthorized_user

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
wbsong111
2026-06-25 15:16:21 +09:00
parent 14fb0d214a
commit 7ddb1f062d
5 changed files with 40 additions and 25 deletions
@@ -36,8 +36,7 @@ config:
headers:
- "AccountID: {{.LogsAccountID}}"
- "ProjectID: 0"
unauthorized_user:
url_prefix: "http://...vmselect:8481/select/0/prometheus"
# unauthorized_user 미설정 — 미인증 요청은 401 (account 0 무인증 접근 차단)
```
> **vm vs vl 격리 메커니즘이 다르다**: VictoriaMetrics는 accountID를 **URL 경로**(`/select/{N}/`)로, VictoriaLogs는 **HTTP 헤더**(`AccountID`/`ProjectID`)로 받는다. 동일한 토큰의 `vm_access`가 두 차원(`metrics_account_id`/`logs_account_id`)을 함께 담고, vmauth가 `src_paths`별로 경로 치환 vs 헤더 주입을 다르게 적용한다. 즉 **테넌트별 계정을 나눌 필요 없이 단일 vmauth 항목**으로 둘 다 격리된다.
@@ -59,9 +58,9 @@ JWT payload 예시:
{ "exp": 1771953418, "vm_access": { "metrics_account_id": 1, "logs_account_id": 1 } }
```
### 2.3 unauthorized_user
### 2.3 unauthorized_user — 사용 안 함
토큰 없이 들어오는 내부 서비스(vmalert)는 `unauthorized_user` 정책으로 accountID 0에 폴백된다.
`unauthorized_user`를 두면 **토큰 없음/무효 토큰 요청이 해당 accountID로 무인증 접근**되어 격리가 약해진다(E2E에서 acct0 200 확인). 내부 서비스(vmalert)는 vmselect multitenant에 **직결**하므로 vmauth 폴백이 불필요 → **설정하지 않는다.** 모든 vmauth 접근은 유효 JWT를 요구하며, 미인증은 **401**.
## 3. Keycloak 설정 (paasup realm)
@@ -201,7 +200,8 @@ curl -s -H "Authorization: Bearer $TOKEN" \
```
클라이언트 ──Bearer JWT──▶ vmauth:8427 ──(vm_access.accountID)──▶ vmselect:8481 /select/{N}/prometheus
└──────────────────────▶ vlselect:9471 (로그)
vmalert(내부) ──(토큰 없음)──▶ vmauth ──unauthorized_user──▶ vmselect /select/0/prometheus
vmalert(내부) ──직결──▶ vmselect /select/multitenant/prometheus (vmauth 미경유)
미인증/무효토큰 ──▶ vmauth ──▶ 401 (unauthorized_user 없음)
```
> 쓰기 경로는 별도: vmagent ──remote_write──▶ vminsert:8480 (vmauth 미경유)