feat(tenants): declare the tech-log objects inside platform namespaces
The tech-log tenant needs objects inside platform namespaces: its database and role, ingress to Postgres and AIStor, blackbox probes, alert rules, a dashboard and two observability NetworkPolicies. They were only ever applied with kubectl and no repository holds them, so a deleted object cannot be recreated and a platform re-apply can drop tech-log access without anyone noticing. Declare them in services/tenants/techlog, copied from each object's last-applied configuration. The dashboard follows the repository's dashboard pattern (JSON file + configMapGenerator, same name, same labels). The hyeonworks-prod Namespace moves here as the tenant boundary and gets PSA enforce=baseline, warn/audit=restricted. Rejected: enforce=restricted now. A server dry-run shows all three tech-log pods would violate it; baseline has zero violations. Risk: the render matches the live objects exactly except the added PSA labels. The pg_hba rules and the Secret stay out of this root (Cluster owner and Git policy). Verification (desktop): - render-tenants-and-policies.sh passes. - kubectl diff of the render shows only the Namespace PSA labels. - kubectl label --dry-run=server enforce=baseline: no warnings.
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
# tech-log 테넌트 — 플랫폼 쪽 객체
|
||||
|
||||
tech-log(hyeonworks.com 운영)가 플랫폼을 쓰려면 플랫폼 namespace 안에 허용 객체가 있어야 한다.
|
||||
이 빌드 루트가 그 객체를 소유한다. 앱 자체(Deployment·Service·Ingress·ServiceMonitor·앱
|
||||
namespace 안의 NetworkPolicy)는 tech-log 저장소의 `deploy/`가 소유한다.
|
||||
|
||||
2026-11-11 점검(`docs/reviews/2026-11-11-k3s-maturity-review.md` 4.3절) 전까지 이 객체들은
|
||||
`kubectl apply`로만 들어가 있었고 어느 저장소에도 없었다. 처음 내용은 라이브 객체의
|
||||
`last-applied-configuration`을 그대로 옮겼다. 라이브와 다른 것은 `hyeonworks-prod`의 PSA 라벨뿐이다.
|
||||
|
||||
| 파일 | 객체 |
|
||||
| --- | --- |
|
||||
| `namespace.yaml` | Namespace `hyeonworks-prod`: 관측 대상 라벨, PSA `enforce=baseline`·`warn=restricted`·`audit=restricted` |
|
||||
| `platform-data.yaml` | `techlog` Database와 DatabaseRole(로그인만, 연결 30), Postgres로 들어오는 ingress |
|
||||
| `object-storage.yaml` | AIStor 9000으로 들어오는 ingress |
|
||||
| `observability-probes.yaml` | blackbox Probe 둘(공개 HTTPS, 내부 readiness) |
|
||||
| `observability-rules.yaml` | PrometheusRule `techlog` 일곱 개 |
|
||||
| `dashboards/techlog-operations.json` | Grafana 대시보드(`grafana-dashboard-techlog` ConfigMap으로 생성) |
|
||||
| `observability-network-policies.yaml` | blackbox → readiness, Prometheus → management scrape egress |
|
||||
|
||||
## 여기에 없는 것
|
||||
|
||||
- `platform-data/platform-postgres`의 `pg_hba` techlog 두 줄: Cluster 객체는
|
||||
`services/platform-postgres`가 소유한다.
|
||||
- Secret: `platform-data/techlog-db-credentials`(`kubernetes.io/basic-auth`, `username`은 정확히
|
||||
`techlog`)는 DatabaseRole이 참조한다. 앱 쪽 `hyeonworks-prod/hyeonworks-secrets`는 tech-log가
|
||||
소유한다. 둘 다 Git에 두지 않는다.
|
||||
|
||||
## PSA
|
||||
|
||||
`enforce=baseline`은 2026-11-12에 서버 dry-run(`kubectl label --dry-run=server`)으로 위반 0을
|
||||
확인하고 붙였다. `restricted`로 강제하면 지금 파드 셋(redis, backend, frontend)이 모두 걸린다
|
||||
(`allowPrivilegeEscalation`, capabilities, `runAsNonRoot`, seccomp). tech-log 쪽 securityContext가
|
||||
고쳐진 뒤 같은 dry-run이 경고 없이 통과하면 `enforce`를 `restricted`로 올린다.
|
||||
|
||||
## 렌더·적용
|
||||
|
||||
```sh
|
||||
bash scripts/validate/render-tenants-and-policies.sh
|
||||
kubectl kustomize services/tenants/techlog | kubectl diff -f -
|
||||
kubectl apply -k services/tenants/techlog
|
||||
```
|
||||
|
||||
새로 설치할 때는 이 루트를 tech-log `deploy/`보다 먼저 적용한다(namespace를 여기서 만든다).
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,23 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
# tech-log(hyeonworks.com) 테넌트의 플랫폼 쪽 객체. 앱 쪽 매니페스트는 tech-log repo가 소유한다.
|
||||
resources:
|
||||
- namespace.yaml
|
||||
- platform-data.yaml
|
||||
- object-storage.yaml
|
||||
- observability-probes.yaml
|
||||
- observability-rules.yaml
|
||||
- observability-network-policies.yaml
|
||||
|
||||
generatorOptions:
|
||||
disableNameSuffixHash: true
|
||||
labels:
|
||||
app.kubernetes.io/part-of: techlog
|
||||
grafana_dashboard: "1"
|
||||
|
||||
configMapGenerator:
|
||||
- name: grafana-dashboard-techlog
|
||||
namespace: observability
|
||||
files:
|
||||
- dashboards/techlog-operations.json
|
||||
@@ -0,0 +1,12 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: hyeonworks-prod
|
||||
labels:
|
||||
observability.hyeonworks.com/enabled: 'true'
|
||||
pod-security.kubernetes.io/enforce: baseline
|
||||
pod-security.kubernetes.io/enforce-version: latest
|
||||
pod-security.kubernetes.io/warn: restricted
|
||||
pod-security.kubernetes.io/warn-version: latest
|
||||
pod-security.kubernetes.io/audit: restricted
|
||||
pod-security.kubernetes.io/audit-version: latest
|
||||
@@ -0,0 +1,22 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: allow-techlog-backend
|
||||
namespace: object-storage
|
||||
spec:
|
||||
ingress:
|
||||
- from:
|
||||
- namespaceSelector:
|
||||
matchLabels:
|
||||
kubernetes.io/metadata.name: hyeonworks-prod
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app: techlog-backend
|
||||
ports:
|
||||
- port: 9000
|
||||
protocol: TCP
|
||||
podSelector:
|
||||
matchLabels:
|
||||
aistor.min.io/objectStore: minio-aistor
|
||||
policyTypes:
|
||||
- Ingress
|
||||
@@ -0,0 +1,45 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: blackbox-allow-techlog-health
|
||||
namespace: observability
|
||||
spec:
|
||||
egress:
|
||||
- ports:
|
||||
- port: 9001
|
||||
protocol: TCP
|
||||
to:
|
||||
- namespaceSelector:
|
||||
matchLabels:
|
||||
kubernetes.io/metadata.name: hyeonworks-prod
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app: techlog-backend
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: prometheus-blackbox-exporter
|
||||
policyTypes:
|
||||
- Egress
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: observability-allow-techlog-scrape
|
||||
namespace: observability
|
||||
spec:
|
||||
egress:
|
||||
- ports:
|
||||
- port: 9001
|
||||
protocol: TCP
|
||||
to:
|
||||
- namespaceSelector:
|
||||
matchLabels:
|
||||
kubernetes.io/metadata.name: hyeonworks-prod
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app: techlog-backend
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: prometheus
|
||||
policyTypes:
|
||||
- Egress
|
||||
@@ -0,0 +1,46 @@
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: Probe
|
||||
metadata:
|
||||
labels:
|
||||
observability.hyeonworks.com/instance: home
|
||||
name: techlog-edge
|
||||
namespace: observability
|
||||
spec:
|
||||
interval: 30s
|
||||
jobName: techlog-edge
|
||||
module: http_2xx
|
||||
prober:
|
||||
path: /probe
|
||||
scheme: http
|
||||
url: blackbox-exporter.observability.svc.cluster.local:9115
|
||||
scrapeTimeout: 15s
|
||||
targets:
|
||||
staticConfig:
|
||||
labels:
|
||||
application: techlog
|
||||
static:
|
||||
- https://hyeonworks.com/
|
||||
- https://hyeonworks.com/api/healthcheck
|
||||
---
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: Probe
|
||||
metadata:
|
||||
labels:
|
||||
observability.hyeonworks.com/instance: home
|
||||
name: techlog-readiness
|
||||
namespace: observability
|
||||
spec:
|
||||
interval: 30s
|
||||
jobName: techlog-readiness
|
||||
module: http_2xx
|
||||
prober:
|
||||
path: /probe
|
||||
scheme: http
|
||||
url: blackbox-exporter.observability.svc.cluster.local:9115
|
||||
scrapeTimeout: 15s
|
||||
targets:
|
||||
staticConfig:
|
||||
labels:
|
||||
application: techlog
|
||||
static:
|
||||
- http://techlog-management.hyeonworks-prod.svc.cluster.local:9001/actuator/health/readiness
|
||||
@@ -0,0 +1,67 @@
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: PrometheusRule
|
||||
metadata:
|
||||
labels:
|
||||
observability.hyeonworks.com/instance: home
|
||||
name: techlog
|
||||
namespace: observability
|
||||
spec:
|
||||
groups:
|
||||
- name: techlog
|
||||
rules:
|
||||
- alert: TechLogMetricsDown
|
||||
annotations:
|
||||
summary: TechLog metrics target is unreachable
|
||||
expr: up{namespace="hyeonworks-prod",service="techlog-management"} == 0
|
||||
for: 5m
|
||||
labels:
|
||||
application: techlog
|
||||
severity: warning
|
||||
- alert: TechLogReadinessDown
|
||||
annotations:
|
||||
summary: TechLog dependency readiness is DOWN
|
||||
expr: probe_success{job="techlog-readiness"} == 0
|
||||
for: 3m
|
||||
labels:
|
||||
application: techlog
|
||||
severity: critical
|
||||
- alert: TechLogHTTPSDown
|
||||
annotations:
|
||||
summary: TechLog HTTPS or API health is failing
|
||||
expr: probe_success{job="techlog-edge"} == 0
|
||||
for: 3m
|
||||
labels:
|
||||
application: techlog
|
||||
severity: critical
|
||||
- alert: TechLogHTTP5xx
|
||||
annotations:
|
||||
summary: TechLog HTTP 5xx exceeds 5%
|
||||
expr: (sum(rate(http_server_requests_seconds_count{namespace="hyeonworks-prod",status=~"5.."}[5m])) / clamp_min(sum(rate(http_server_requests_seconds_count{namespace="hyeonworks-prod"}[5m])),0.001)) > 0.05 and sum(increase(http_server_requests_seconds_count{namespace="hyeonworks-prod"}[5m])) > 20
|
||||
for: 5m
|
||||
labels:
|
||||
application: techlog
|
||||
severity: warning
|
||||
- alert: TechLogLatencyHigh
|
||||
annotations:
|
||||
summary: TechLog p99 latency exceeds 2 seconds
|
||||
expr: histogram_quantile(0.99,sum by(le)(rate(http_server_requests_seconds_bucket{namespace="hyeonworks-prod",uri!~"/actuator.*"}[5m]))) > 2
|
||||
for: 10m
|
||||
labels:
|
||||
application: techlog
|
||||
severity: warning
|
||||
- alert: TechLogHeapPressure
|
||||
annotations:
|
||||
summary: TechLog heap usage exceeds 85%
|
||||
expr: sum(jvm_memory_used_bytes{namespace="hyeonworks-prod",area="heap"}) / sum(jvm_memory_max_bytes{namespace="hyeonworks-prod",area="heap"}) > 0.85
|
||||
for: 10m
|
||||
labels:
|
||||
application: techlog
|
||||
severity: warning
|
||||
- alert: TechLogDatabasePoolWaiting
|
||||
annotations:
|
||||
summary: TechLog database connections are queued
|
||||
expr: hikaricp_connections_pending{namespace="hyeonworks-prod"} > 0
|
||||
for: 5m
|
||||
labels:
|
||||
application: techlog
|
||||
severity: warning
|
||||
@@ -0,0 +1,55 @@
|
||||
apiVersion: postgresql.cnpg.io/v1
|
||||
kind: Database
|
||||
metadata:
|
||||
name: platform-postgres-techlog
|
||||
namespace: platform-data
|
||||
spec:
|
||||
cluster:
|
||||
name: platform-postgres
|
||||
databaseReclaimPolicy: retain
|
||||
ensure: present
|
||||
name: techlog
|
||||
owner: techlog
|
||||
---
|
||||
apiVersion: postgresql.cnpg.io/v1
|
||||
kind: DatabaseRole
|
||||
metadata:
|
||||
name: platform-postgres-techlog
|
||||
namespace: platform-data
|
||||
spec:
|
||||
bypassrls: false
|
||||
cluster:
|
||||
name: platform-postgres
|
||||
connectionLimit: 30
|
||||
createdb: false
|
||||
createrole: false
|
||||
databaseRoleReclaimPolicy: retain
|
||||
login: true
|
||||
name: techlog
|
||||
passwordSecret:
|
||||
name: techlog-db-credentials
|
||||
replication: false
|
||||
superuser: false
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: allow-techlog-backend
|
||||
namespace: platform-data
|
||||
spec:
|
||||
ingress:
|
||||
- from:
|
||||
- namespaceSelector:
|
||||
matchLabels:
|
||||
kubernetes.io/metadata.name: hyeonworks-prod
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app: techlog-backend
|
||||
ports:
|
||||
- port: 5432
|
||||
protocol: TCP
|
||||
podSelector:
|
||||
matchLabels:
|
||||
cnpg.io/cluster: platform-postgres
|
||||
policyTypes:
|
||||
- Ingress
|
||||
Reference in New Issue
Block a user