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:
@@ -93,6 +93,13 @@ spec:
|
||||
destination:
|
||||
server: https://kubernetes.default.svc
|
||||
namespace: monitoring
|
||||
# StatefulSet volumeClaimTemplates는 immutable + K8s가 volumeMode 등 기본값을 자동 주입 →
|
||||
# 영구 OutOfSync 방지(vmstorage/vlstorage). VCT 변경은 어차피 적용 불가라 무시.
|
||||
ignoreDifferences:
|
||||
- group: apps
|
||||
kind: StatefulSet
|
||||
jsonPointers:
|
||||
- /spec/volumeClaimTemplates
|
||||
syncPolicy:
|
||||
automated:
|
||||
prune: true
|
||||
|
||||
@@ -16,5 +16,4 @@ config:
|
||||
headers:
|
||||
- "AccountID: {{.LogsAccountID}}"
|
||||
- "ProjectID: 0"
|
||||
unauthorized_user:
|
||||
url_prefix: "http://vmcluster-victoria-metrics-cluster-vmselect.monitoring.svc.cluster.local:8481/select/0/prometheus"
|
||||
# unauthorized_user 미설정: 미인증 요청은 401(account 0 무인증 접근 차단).
|
||||
|
||||
@@ -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 미경유)
|
||||
|
||||
@@ -51,6 +51,6 @@ config:
|
||||
# - src_paths: ["/api/v1/.*"]
|
||||
# url_prefix: "http://vmcluster-victoria-metrics-cluster-vmselect.monitoring.svc.cluster.local:8481/select/9000/prometheus"
|
||||
|
||||
# 인증 없는 내부 서비스(vmalert 등) — accountID 0으로 폴백
|
||||
unauthorized_user:
|
||||
url_prefix: "http://vmcluster-victoria-metrics-cluster-vmselect.monitoring.svc.cluster.local:8481/select/0/prometheus"
|
||||
# 주의: unauthorized_user를 두지 않는다. 두면 무토큰/무효토큰 요청이 해당 accountID로
|
||||
# 무인증 접근되어 격리가 약해진다(E2E에서 acct0 200 확인). vmalert는 vmselect에 직결하므로
|
||||
# vmauth 폴백이 불필요 → 모든 vmauth 접근은 유효 JWT를 요구(미인증=401).
|
||||
|
||||
Reference in New Issue
Block a user