Compare commits
11 changed files with 23 additions and 552 deletions
|
|
@ -3,24 +3,13 @@
|
|||
# `default-deny` (stock NetworkPolicy, podSelector {}, both directions) is the
|
||||
# deny. `forgejo-allow` (CiliumNetworkPolicy) re-adds what this namespace uses:
|
||||
# ingress: the Cilium Gateway proxy (`reserved:ingress`) for
|
||||
# forgejo.siriusdevops.com -> forgejo:3000; the CI runners in
|
||||
# `ci-runners` on 3000 only (they register/poll over the PUBLIC URL,
|
||||
# so THAT traffic arrives as `reserved:ingress` — but their image
|
||||
# pushes go pod->pod to the internal ClusterIP
|
||||
# `forgejo.forgejo.svc.cluster.local:3000`
|
||||
# (`PUSH_REGISTRY` in each repo's `.forgejo/workflows/build.yml`,
|
||||
# docker daemon in the dind sidecar of the runner pod). Pod->pod is
|
||||
# not `reserved:ingress`, so `default-deny` dropped it and every
|
||||
# image build failed 2026-11-27 .. 2026-12-05 with
|
||||
# `Get "http://forgejo.forgejo.svc.cluster.local:3000/v2/": request
|
||||
# canceled ... Client.Timeout exceeded` — the cross-namespace rule IS
|
||||
# required; do not delete it as redundant. Node/health entities
|
||||
# cover kubelet probes; Prometheus in `monitoring` is allowed on
|
||||
# 9187 only (the
|
||||
# `cnpg-pg` PodMonitor scrapes the CNPG instance manager), and the
|
||||
# CNPG operator in `cnpg-system` on 8000 only — the instance
|
||||
# manager's HTTPS status endpoint the operator reads to derive the
|
||||
# system ID and drive failover (card t_4210edec).
|
||||
# forgejo.siriusdevops.com -> forgejo:3000. The CI runners live in
|
||||
# `ci-runners` and register/poll over the PUBLIC URL
|
||||
# (runner-amd64.yaml: `--instance https://forgejo.siriusdevops.com`),
|
||||
# so they arrive through the Gateway as `reserved:ingress` too and no
|
||||
# cross-namespace rule is needed. Node/health entities cover kubelet
|
||||
# probes; Prometheus in `monitoring` is allowed on 9187 only (the
|
||||
# `cnpg-pg` PodMonitor scrapes the CNPG instance manager).
|
||||
# egress: cluster DNS; its own pods (forgejo -> pg-rw:5432); `world` for
|
||||
# outbound HTTPS (Forgejo webhooks, avatar/mirror fetches, the
|
||||
# public-URL callbacks the runner flow needs); node IPs on 22, which
|
||||
|
|
@ -30,8 +19,7 @@
|
|||
# `kubectl exec` DB dumps.
|
||||
#
|
||||
# The CI runner pods themselves are NOT in this namespace (they moved to
|
||||
# `ci-runners` for `enforce: privileged`); `forgejo-allow` only grants them
|
||||
# forgejo:3000, which is the registry push path the builds depend on.
|
||||
# `ci-runners` for `enforce: privileged`) and are out of scope for this card.
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
|
|
@ -50,9 +38,8 @@ metadata:
|
|||
namespace: forgejo
|
||||
spec:
|
||||
description: >-
|
||||
forgejo: gateway + kubelet + Prometheus + ci-runners registry-push ingress;
|
||||
egress to own namespace, cluster DNS, the internet, SSH on node IPs and the
|
||||
API.
|
||||
forgejo: gateway + kubelet + Prometheus ingress; egress to own namespace,
|
||||
cluster DNS, the internet, SSH on node IPs and the API.
|
||||
endpointSelector: {}
|
||||
ingress:
|
||||
- fromEntities:
|
||||
|
|
@ -67,33 +54,6 @@ spec:
|
|||
- fromEndpoints:
|
||||
- matchLabels:
|
||||
io.kubernetes.pod.namespace: forgejo
|
||||
# CI runners (`ci-runners`) push images to the in-cluster registry at
|
||||
# forgejo.forgejo.svc.cluster.local:3000 (PUSH_REGISTRY in each repo's
|
||||
# build workflow; the docker daemon lives in the dind sidecar of the same
|
||||
# pod, so one namespace selector covers runner + sidecar). Registration and
|
||||
# polling use the public URL and arrive as `reserved:ingress`, but the push
|
||||
# is pod -> pod and default-deny drops it without this rule. Port-scoped on
|
||||
# purpose: the registry API only, nothing else in the namespace.
|
||||
- fromEndpoints:
|
||||
- matchLabels:
|
||||
io.kubernetes.pod.namespace: ci-runners
|
||||
toPorts:
|
||||
- ports:
|
||||
- port: "3000"
|
||||
protocol: TCP
|
||||
# The CNPG operator (`cnpg-system`) reads the instance manager's HTTPS
|
||||
# status endpoint to derive the system ID and drive switchover/promotion.
|
||||
# Without it the Cluster reports `Instance Status Extraction Error` and
|
||||
# Ready=False while the pods serve traffic, and automated failover is dead
|
||||
# (card t_4210edec). Scoped to 8000: not 5432, not the whole namespace.
|
||||
- fromEndpoints:
|
||||
- matchLabels:
|
||||
io.kubernetes.pod.namespace: cnpg-system
|
||||
app.kubernetes.io/name: cloudnative-pg
|
||||
toPorts:
|
||||
- ports:
|
||||
- port: "8000"
|
||||
protocol: TCP
|
||||
# Prometheus scrapes the CNPG `pg` instance manager on 9187.
|
||||
- fromEndpoints:
|
||||
- matchLabels:
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ instead of a host Docker container on the Pi.
|
|||
| `osint-camera-service` | same app image | public-camera discovery + snapshots (PVC `osint-camera-snapshots` 3 Gi, shared with the app) |
|
||||
| `osint-titiler` | `forgejo…/sirius/titiler:0.26.0` | SAR COG tile proxy, exposed same-origin at `/titiler` |
|
||||
| `osint-news-scraper` | `forgejo…/sirius/osint-news-scraper:amd64-58f71f5b4520` | Scrapy news scraper loop |
|
||||
| `osint-news-summarizer` | `forgejo…/sirius/osint-news-summarizer:amd64-fb5285df7f38` | "analyst" — Nous Portal briefs every 15 min + 23:00 recap |
|
||||
| `osint-news-summarizer` | `forgejo…/sirius/osint-news-summarizer:amd64-fe2b5df369d0` | "analyst" — Nous Portal briefs every 15 min + 23:00 recap |
|
||||
|
||||
Every workload is pinned to `kubernetes.io/hostname: siriussec` (Gateway/Envoy
|
||||
co-location + local-path PVs).
|
||||
|
|
@ -133,29 +133,11 @@ it can actually parse.
|
|||
|
||||
## Analyst model
|
||||
|
||||
`SUMMARY_MODEL=deepseek/deepseek-v4.1-flash-1017` (Nous Portal, 1M context,
|
||||
verified to honour `response_format: json_object`; the previous free
|
||||
`meituan/longcat-2.5:free` id was retired and 404'd every call). When picking a
|
||||
replacement, confirm it is in `GET /v1/models` — a stale id fails silently
|
||||
because `chat()` swallows non-200s and returns an empty string. It is set in
|
||||
`SUMMARY_MODEL=meituan/longcat-2.5:free` (free tier on the Nous Portal,
|
||||
1M context, verified to honour `response_format: json_object`). It is set in
|
||||
`configmap.yaml`; changing it in the UI (`PUT /api/settings`) only takes effect
|
||||
when the env var is empty, because `resolve_model()` prefers the env.
|
||||
|
||||
## Analyst resilience + map concurrency (PR #72)
|
||||
|
||||
`SUMMARY_MAP_CONCURRENCY` (16, in `configmap.yaml`) sets how many map calls are
|
||||
in flight. Each call is a ~20 s wall clock, so the phase is latency-bound: the
|
||||
746-batch recap measured **951 s** end-to-end at 16, where 8 is projected at
|
||||
~98 min. The code default is also 16; the env var is pinned so a default change
|
||||
upstream cannot silently stretch the 15-min interval past its window.
|
||||
|
||||
A non-retryable Nous rejection (400/404/422 — e.g. a retired model id) now
|
||||
raises `NousAPIError` and aborts the run with `rc=1` instead of being swallowed
|
||||
as an empty completion, so the failure shows up in the pod log on the *first*
|
||||
tick rather than as nine days of "idle" ticks. The per-run summary line is
|
||||
`summarize done kind=<interval|recap> summary_id=… model=… batches=… articles=…
|
||||
ticker=… map=… elapsed=…s`.
|
||||
|
||||
## Analyst grading (PR #53 + #54)
|
||||
|
||||
The map call scores every article **0-100** against a rubric in the same request
|
||||
|
|
|
|||
|
|
@ -1,332 +0,0 @@
|
|||
# Freshness exporter for the osint analyst (card t_22334588).
|
||||
#
|
||||
# The summarizer (deploy/osint-news-summarizer) wrote no article_summaries rows
|
||||
# from 2026-11-25 to 2026-12-04 while the scraper kept the articles table fresh
|
||||
# (61.5k rows, newest within minutes). Nothing paged: the container was Running
|
||||
# with restarts 0 and only INFO batch lines in the log, so "analyst wedged" and
|
||||
# "analyst idle" looked identical from every signal the cluster had.
|
||||
#
|
||||
# The app has no /metrics endpoint (POST /metrics -> 404 on osint-app), so this
|
||||
# is a tiny read-only exporter that answers the only question that matters:
|
||||
# *when* did each side last write a row? It reads two timestamps from
|
||||
# osint_data and serves them on :9187/metrics:
|
||||
#
|
||||
# osint_analyst_last_success_timestamp_seconds max(article_summaries.batch_timestamp)
|
||||
# osint_ingest_last_article_timestamp_seconds max(articles.timestamp)
|
||||
# osint_analyst_exporter_up 1 when the last DB read succeeded
|
||||
#
|
||||
# PromQL rules live in monitoring/controllers/home/osint-analyst.yaml
|
||||
# (OsintAnalystStale, OsintIngestAliveButNoBrief).
|
||||
#
|
||||
# Why the summarizer image: it is the only image in this namespace that already
|
||||
# ships psycopg2 and a python3, and it is pinned by tag (no floating base). The
|
||||
# script uses the stdlib HTTP server, so nothing is installed at runtime and no
|
||||
# new image build is needed. It tracks the summarizer's own pin (currently
|
||||
# amd64-fb5285df7f38) — bump BOTH together; two different tags for one image in
|
||||
# one namespace reads as drift in an audit, and the exporter only needs the
|
||||
# interpreter + psycopg2, which every summarizer build carries.
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: osint-analyst-exporter
|
||||
namespace: osint
|
||||
data:
|
||||
exporter.py: |
|
||||
#!/usr/bin/env python3
|
||||
"""Read-only freshness exporter for the osint analyst.
|
||||
|
||||
Serves /metrics on :9187. Two timestamps, nothing else:
|
||||
|
||||
osint_analyst_last_success_timestamp_seconds
|
||||
epoch of max(article_summaries.batch_timestamp) -- when the analyst
|
||||
last wrote a brief. 0 means the table is empty (stale by definition).
|
||||
osint_ingest_last_article_timestamp_seconds
|
||||
epoch of max(articles.timestamp) -- when the scraper last ingested.
|
||||
osint_analyst_exporter_up
|
||||
1 when the last database read succeeded, 0 otherwise.
|
||||
|
||||
On a database error the last good values are kept and `up` drops to 0, so
|
||||
the timestamps keep ageing and a broken exporter escalates through the same
|
||||
OsintAnalystStale alert instead of hiding behind missing series.
|
||||
"""
|
||||
import logging
|
||||
import os
|
||||
import threading
|
||||
import time
|
||||
from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer
|
||||
|
||||
import psycopg2
|
||||
|
||||
LOG = logging.getLogger("osint-analyst-exporter")
|
||||
logging.basicConfig(
|
||||
level=os.getenv("LOG_LEVEL", "INFO"),
|
||||
format="%(asctime)s %(levelname)s %(name)s: %(message)s",
|
||||
)
|
||||
|
||||
PORT = int(os.getenv("EXPORTER_PORT", "9187"))
|
||||
# One scrape interval (30 s) of cache: Prometheus + probes hitting the
|
||||
# endpoint together must not each open a database connection.
|
||||
CACHE_TTL = float(os.getenv("CACHE_TTL_SECONDS", "10"))
|
||||
|
||||
DB_CONFIG = {
|
||||
"host": os.getenv("DB_HOST", "osint-db"),
|
||||
"port": int(os.getenv("DB_PORT", "5432")),
|
||||
"dbname": os.getenv("DB_NAME", "osint_data"),
|
||||
"user": os.getenv("DB_USER", "osint"),
|
||||
"password": os.getenv("DB_PASSWORD", ""),
|
||||
"connect_timeout": 5,
|
||||
}
|
||||
|
||||
ANALYST_SQL = (
|
||||
"SELECT COALESCE(EXTRACT(EPOCH FROM max(batch_timestamp))::bigint, 0) "
|
||||
"FROM article_summaries"
|
||||
)
|
||||
INGEST_SQL = (
|
||||
"SELECT COALESCE(EXTRACT(EPOCH FROM max(timestamp))::bigint, 0) "
|
||||
"FROM articles"
|
||||
)
|
||||
|
||||
_lock = threading.Lock()
|
||||
_state = {"analyst": 0, "ingest": 0, "up": 0, "last_attempt": 0.0}
|
||||
|
||||
|
||||
def collect() -> tuple[int, int]:
|
||||
conn = psycopg2.connect(**DB_CONFIG)
|
||||
try:
|
||||
conn.autocommit = True
|
||||
with conn.cursor() as cur:
|
||||
cur.execute("SET statement_timeout = 5000")
|
||||
cur.execute(ANALYST_SQL)
|
||||
analyst = int(cur.fetchone()[0] or 0)
|
||||
cur.execute(INGEST_SQL)
|
||||
ingest = int(cur.fetchone()[0] or 0)
|
||||
finally:
|
||||
conn.close()
|
||||
return analyst, ingest
|
||||
|
||||
|
||||
def ensure_fresh() -> None:
|
||||
now = time.time()
|
||||
with _lock:
|
||||
if now - _state["last_attempt"] < CACHE_TTL:
|
||||
return
|
||||
_state["last_attempt"] = now
|
||||
try:
|
||||
analyst, ingest = collect()
|
||||
except Exception as exc: # noqa: BLE001 - never kill the endpoint
|
||||
with _lock:
|
||||
_state["up"] = 0
|
||||
LOG.warning("collect failed: %s", exc)
|
||||
return
|
||||
with _lock:
|
||||
_state.update(analyst=analyst, ingest=ingest, up=1)
|
||||
|
||||
|
||||
def render() -> str:
|
||||
with _lock:
|
||||
analyst = _state["analyst"]
|
||||
ingest = _state["ingest"]
|
||||
up = _state["up"]
|
||||
return (
|
||||
"# HELP osint_analyst_last_success_timestamp_seconds "
|
||||
"Epoch of the newest article_summaries.batch_timestamp (last brief "
|
||||
"written by the analyst); 0 = no row.\n"
|
||||
"# TYPE osint_analyst_last_success_timestamp_seconds gauge\n"
|
||||
f"osint_analyst_last_success_timestamp_seconds {analyst}\n"
|
||||
"# HELP osint_ingest_last_article_timestamp_seconds "
|
||||
"Epoch of the newest articles.timestamp (last row ingested by the "
|
||||
"scraper); 0 = no row.\n"
|
||||
"# TYPE osint_ingest_last_article_timestamp_seconds gauge\n"
|
||||
f"osint_ingest_last_article_timestamp_seconds {ingest}\n"
|
||||
"# HELP osint_analyst_exporter_up 1 when the last database read "
|
||||
"succeeded.\n"
|
||||
"# TYPE osint_analyst_exporter_up gauge\n"
|
||||
f"osint_analyst_exporter_up {up}\n"
|
||||
)
|
||||
|
||||
|
||||
class Handler(BaseHTTPRequestHandler):
|
||||
server_version = "osint-analyst-exporter/1.0"
|
||||
|
||||
def do_GET(self): # noqa: N802 - BaseHTTPRequestHandler API
|
||||
path = self.path.split("?", 1)[0]
|
||||
if path not in ("/metrics", "/healthz"):
|
||||
self.send_error(404)
|
||||
return
|
||||
ensure_fresh()
|
||||
body = render().encode()
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "text/plain; version=0.0.4; charset=utf-8")
|
||||
self.send_header("Content-Length", str(len(body)))
|
||||
self.end_headers()
|
||||
self.wfile.write(body)
|
||||
|
||||
def log_message(self, fmt, *args): # noqa: A003 - stdlib hook
|
||||
LOG.debug("%s - %s", self.address_string(), fmt % args)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
# Prime the cache so the first scrape has data, but never refuse to
|
||||
# start on a database blip.
|
||||
ensure_fresh()
|
||||
server = ThreadingHTTPServer(("0.0.0.0", PORT), Handler)
|
||||
LOG.info("listening on 0.0.0.0:%s (db=%s/%s)", PORT, DB_CONFIG["host"], DB_CONFIG["dbname"])
|
||||
server.serve_forever()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: osint-analyst-exporter
|
||||
namespace: osint
|
||||
labels:
|
||||
app: osint-analyst-exporter
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: osint-analyst-exporter
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: osint-analyst-exporter
|
||||
spec:
|
||||
imagePullSecrets:
|
||||
- name: forgejo-pull
|
||||
# Same placement policy as the other stateless amd64 loops here: prefer
|
||||
# linode (where osint-db runs) but do not strand if it is absent.
|
||||
nodeSelector:
|
||||
kubernetes.io/arch: amd64
|
||||
affinity:
|
||||
nodeAffinity:
|
||||
preferredDuringSchedulingIgnoredDuringExecution:
|
||||
- weight: 100
|
||||
preference:
|
||||
matchExpressions:
|
||||
- key: kubernetes.io/hostname
|
||||
operator: In
|
||||
values:
|
||||
- linode
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 1000
|
||||
runAsGroup: 1000
|
||||
seccompProfile:
|
||||
type: RuntimeDefault
|
||||
containers:
|
||||
- name: exporter
|
||||
# Pinned summarizer image: python3 + psycopg2, see header comment.
|
||||
# Kept equal to the summarizer pin in news-summarizer-deployment.yaml.
|
||||
image: forgejo.siriusdevops.com/sirius/osint-news-summarizer:amd64-fb5285df7f38
|
||||
imagePullPolicy: IfNotPresent
|
||||
command: ["python", "/opt/exporter/exporter.py"]
|
||||
env:
|
||||
- name: PYTHONDONTWRITEBYTECODE
|
||||
value: "1"
|
||||
- name: EXPORTER_PORT
|
||||
value: "9187"
|
||||
- name: DB_HOST
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: osint-env
|
||||
key: DB_HOST
|
||||
- name: DB_PORT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: osint-env
|
||||
key: DB_PORT
|
||||
- name: DB_NAME
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: osint-env
|
||||
key: DB_NAME
|
||||
- name: DB_USER
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: osint-env
|
||||
key: DB_USER
|
||||
- name: DB_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: osint-db
|
||||
key: password
|
||||
ports:
|
||||
- name: metrics
|
||||
containerPort: 9187
|
||||
protocol: TCP
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: metrics
|
||||
periodSeconds: 10
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /healthz
|
||||
port: metrics
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 30
|
||||
resources:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 64Mi
|
||||
limits:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: true
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
volumeMounts:
|
||||
- name: script
|
||||
mountPath: /opt/exporter
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: script
|
||||
configMap:
|
||||
name: osint-analyst-exporter
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: osint-analyst-exporter
|
||||
namespace: osint
|
||||
labels:
|
||||
app: osint-analyst-exporter
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: osint-analyst-exporter
|
||||
ports:
|
||||
- name: metrics
|
||||
port: 9187
|
||||
targetPort: metrics
|
||||
protocol: TCP
|
||||
---
|
||||
# Prometheus (monitoring ns) scrapes this; the ServiceMonitor selector is
|
||||
# namespace-wide (spec.serviceMonitorNamespaceSelector = {}), so the label is
|
||||
# what matters. Ingress from monitoring to :9187 is opened in networkpolicy.yaml.
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: ServiceMonitor
|
||||
metadata:
|
||||
name: osint-analyst-exporter
|
||||
namespace: osint
|
||||
labels:
|
||||
release: kube-prometheus-stack
|
||||
spec:
|
||||
namespaceSelector:
|
||||
matchNames:
|
||||
- osint
|
||||
selector:
|
||||
matchLabels:
|
||||
app: osint-analyst-exporter
|
||||
endpoints:
|
||||
- port: metrics
|
||||
path: /metrics
|
||||
interval: 30s
|
||||
scrapeTimeout: 10s
|
||||
|
|
@ -66,25 +66,14 @@ data:
|
|||
# never see https here: this flag is what puts `Secure` on the session cookie.
|
||||
ADMIN_COOKIE_SECURE: "1"
|
||||
|
||||
# ── news summarizer (analyst) — Nous Portal ─────────────────────────────
|
||||
# ── news summarizer (analyst) — Nous Portal, free tier model ────────────
|
||||
NOUS_BASE_URL: https://inference-api.nousresearch.com/v1
|
||||
# Meituan LongCat was retired from the portal (every call 404'd from 11/25
|
||||
# onward, silently producing no briefs). The :free ids now require a user
|
||||
# tag and 503 anyway; pin the cheapest model that answers normally and
|
||||
# honours response_format: json_object (~$0.03/$0.12 per Mtok).
|
||||
SUMMARY_MODEL: deepseek/deepseek-v4.1-flash-1017
|
||||
SUMMARY_MODEL: meituan/longcat-2.5:free
|
||||
# 4, not the upstream default 50: the map phase runs with a hard 60 s httpx
|
||||
# timeout (news/summerizer/nous_client.py, json_mode=False), so bigger
|
||||
# batches risk timing out and silently contributing nothing to the reduce
|
||||
# phase.
|
||||
# timeout (news/summerizer/nous_client.py, json_mode=False), and this free
|
||||
# model needs ~30 s for 8 articles, so bigger batches time out and silently
|
||||
# contribute nothing to the reduce phase.
|
||||
BATCH_SIZE: "4"
|
||||
# Map-phase fan-out (PR #72). Each map call is a ~20 s wall clock, so the
|
||||
# phase is latency-bound, not CPU-bound: the 746-batch recap measured 951 s
|
||||
# end-to-end at 16 in flight, where 8 is projected at ~98 min. 16 is also the
|
||||
# summarizer's DEFAULT_SUMMARY_MAP_CONCURRENCY; it is pinned here so a future
|
||||
# code default change cannot silently stretch the 15-min interval past its
|
||||
# window.
|
||||
SUMMARY_MAP_CONCURRENCY: "16"
|
||||
# Map-phase grading (PR #53): the map call scores every article 0-100 against
|
||||
# a rubric and only blocks >= SUMMARY_MIN_SCORE reach the brief. When nothing
|
||||
# clears the bar the top SUMMARY_FALLBACK_TOP are used so the HUD is not blank
|
||||
|
|
|
|||
|
|
@ -18,11 +18,6 @@ resources:
|
|||
- titiler-service.yaml
|
||||
- news-scraper-deployment.yaml
|
||||
- news-summarizer-deployment.yaml
|
||||
# Freshness exporter for the analyst (max(article_summaries.batch_timestamp)
|
||||
# and max(articles.timestamp) -> :9187/metrics) + its ServiceMonitor. The
|
||||
# summarizer has no /metrics and a wedged analyst is invisible otherwise
|
||||
# (card t_22334588).
|
||||
- analyst-exporter.yaml
|
||||
- httproute.yaml
|
||||
# Default-deny ingress+egress + the namespace allow list (audit F3 / t_fed52919).
|
||||
- networkpolicy.yaml
|
||||
|
|
|
|||
|
|
@ -21,9 +21,7 @@
|
|||
# * kube-apiserver egress — no workload here calls the API; the audit's
|
||||
# `SA token mounted` observation is a separate finding and denying the path
|
||||
# does not depend on removing the token.
|
||||
# * monitoring ingress — apart from the one port-scoped rule for the analyst
|
||||
# freshness exporter below (Prometheus -> osint-analyst-exporter:9187),
|
||||
# nothing in `monitoring` reaches this namespace.
|
||||
# * monitoring ingress — no PodMonitor/ServiceMonitor selects osint pods.
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
|
|
@ -58,16 +56,6 @@ spec:
|
|||
- fromEndpoints:
|
||||
- matchLabels:
|
||||
io.kubernetes.pod.namespace: osint
|
||||
# Prometheus (namespace `monitoring`) scrapes the analyst freshness exporter
|
||||
# on 9187 (apps/base/osint/analyst-exporter.yaml). Port-scoped: no other
|
||||
# monitoring -> osint traffic is opened.
|
||||
- fromEndpoints:
|
||||
- matchLabels:
|
||||
io.kubernetes.pod.namespace: monitoring
|
||||
toPorts:
|
||||
- ports:
|
||||
- port: "9187"
|
||||
protocol: TCP
|
||||
egress:
|
||||
- toEndpoints:
|
||||
- matchLabels:
|
||||
|
|
|
|||
|
|
@ -39,12 +39,7 @@ spec:
|
|||
kubernetes.io/arch: amd64
|
||||
containers:
|
||||
- name: news-summarizer
|
||||
# amd64-fb5285df7f38 = sirius/osint-dashboard@fb5285d (PR #72, merged):
|
||||
# the map phase runs concurrently (SUMMARY_MAP_CONCURRENCY) and a
|
||||
# non-retryable Nous rejection raises NousAPIError instead of being
|
||||
# swallowed, so a wedged analyst fails loudly instead of idling for
|
||||
# nine days on silent empty completions (card t_22334588 / t_2ae9f0c0).
|
||||
image: forgejo.siriusdevops.com/sirius/osint-news-summarizer:amd64-fb5285df7f38
|
||||
image: forgejo.siriusdevops.com/sirius/osint-news-summarizer:amd64-fe2b5df369d0
|
||||
imagePullPolicy: IfNotPresent
|
||||
# Loop: batch the last window, call Nous Portal, write summaries.
|
||||
command: ["python", "run_news_summarizer.py"]
|
||||
|
|
|
|||
|
|
@ -6,11 +6,8 @@
|
|||
# ingress: Cilium Gateway proxy (`reserved:ingress`) for
|
||||
# siriusgrowthsolutions.com -> site:80 / contact:8090 /
|
||||
# portal-gate:8080 / portal:8091 / blog:8092, node entities for
|
||||
# kubelet probes, Prometheus in `monitoring` on 9187 only (the
|
||||
# `cnpg-portal` PodMonitor scrapes the CNPG instance manager), and
|
||||
# the CNPG operator in `cnpg-system` on 8000 only — the instance
|
||||
# manager's HTTPS status endpoint the operator reads to derive the
|
||||
# system ID and drive failover (card t_4210edec).
|
||||
# kubelet probes, and Prometheus in `monitoring` on 9187 only (the
|
||||
# `cnpg-portal` PodMonitor scrapes the CNPG instance manager).
|
||||
# egress: cluster DNS; its own pods (blog/portal -> portal-1:5432,
|
||||
# portal-gate -> portal:8091); `world` for the Telegram Bot API
|
||||
# (contact + portal) and the leadgen crawlers; the node IPs on 3900
|
||||
|
|
@ -56,19 +53,6 @@ spec:
|
|||
- fromEndpoints:
|
||||
- matchLabels:
|
||||
io.kubernetes.pod.namespace: sirius-growth
|
||||
# The CNPG operator (`cnpg-system`) reads the instance manager's HTTPS
|
||||
# status endpoint to derive the system ID and drive switchover/promotion.
|
||||
# Without it the Cluster reports `Instance Status Extraction Error` and
|
||||
# Ready=False while the pods serve traffic, and automated failover is dead
|
||||
# (card t_4210edec). Scoped to 8000: not 5432, not the whole namespace.
|
||||
- fromEndpoints:
|
||||
- matchLabels:
|
||||
io.kubernetes.pod.namespace: cnpg-system
|
||||
app.kubernetes.io/name: cloudnative-pg
|
||||
toPorts:
|
||||
- ports:
|
||||
- port: "8000"
|
||||
protocol: TCP
|
||||
# Prometheus scrapes the CNPG `portal` instance manager on 9187.
|
||||
- fromEndpoints:
|
||||
- matchLabels:
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ spec:
|
|||
memory: 128Mi
|
||||
containers:
|
||||
- name: nginx
|
||||
image: forgejo.siriusdevops.com/sirius/siriusdevops-site:3ac9870aa7637cffb789edcc16b9512d7567886d
|
||||
image: forgejo.siriusdevops.com/sirius/siriusdevops-site:399c421f51a2fd74a87e810641226d58e4e22690
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- containerPort: 80
|
||||
|
|
|
|||
|
|
@ -15,9 +15,6 @@ resources:
|
|||
# Series come from a host textfile exporter (infrastructure/networking/rosenpass/),
|
||||
# so silently missing data is itself an alert.
|
||||
- rosenpass.yaml
|
||||
# Analyst freshness: OsintAnalystStale + OsintIngestAliveButNoBrief, built on
|
||||
# the osint-analyst-exporter timestamps (card t_22334588).
|
||||
- osint-analyst.yaml
|
||||
# Nightly consistent sqlite snapshot of Grafana's dashboards/alerts/users.
|
||||
- grafana-backup.yaml
|
||||
# Egress lockdown for that backup pod: DNS + the backup host only, so no
|
||||
|
|
|
|||
|
|
@ -1,87 +0,0 @@
|
|||
# osint analyst freshness -> Prometheus (card t_22334588)
|
||||
#
|
||||
# On 2026-11-25 the analyst (deploy/osint-news-summarizer) silently stopped
|
||||
# writing article_summaries and stayed dead for nine days. The scraper kept
|
||||
# ingesting normally (61.5k rows in articles, newest within minutes), the pod
|
||||
# stayed Running with restarts 0, and the log carried nothing but INFO batch
|
||||
# lines and 404s at INFO level -- so every signal the cluster already had said
|
||||
# "healthy". These two rules are built on the timestamps the exporter in
|
||||
# apps/base/osint/analyst-exporter.yaml reads straight out of Postgres
|
||||
# (SeriesMonitor osint-analyst-exporter, ns osint, :9187/metrics):
|
||||
#
|
||||
# osint_analyst_last_success_timestamp_seconds max(article_summaries.batch_timestamp)
|
||||
# osint_ingest_last_article_timestamp_seconds max(articles.timestamp)
|
||||
# osint_analyst_exporter_up 1 when the last DB read worked
|
||||
#
|
||||
# OsintAnalystStale is the general "no brief in over an hour" gate; the
|
||||
# summarizer loops every 15 min, so an hour of silence cannot be a slow batch.
|
||||
# OsintIngestAliveButNoBrief is the sharper one: a fresh article row plus a
|
||||
# summary table frozen for two hours names the exact failure -- ingest fine,
|
||||
# analyst dark -- without waiting for the read path or the API to be down.
|
||||
#
|
||||
# The absent() arm on OsintAnalystStale is deliberate: if the exporter, its
|
||||
# ServiceMonitor or its scrape disappears, the series vanishes and "no data"
|
||||
# would otherwise read as "no problem", which is the same invisible-failure
|
||||
# shape this card exists to kill. Routes through the default Alertmanager
|
||||
# receiver (Telegram @Siriusdevops_alert_bot).
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: PrometheusRule
|
||||
metadata:
|
||||
name: osint-analyst
|
||||
namespace: monitoring
|
||||
labels:
|
||||
release: kube-prometheus-stack
|
||||
spec:
|
||||
groups:
|
||||
- name: osint-analyst
|
||||
rules:
|
||||
- alert: OsintAnalystStale
|
||||
expr: |
|
||||
(
|
||||
time() - osint_analyst_last_success_timestamp_seconds > 3600
|
||||
)
|
||||
or
|
||||
absent(osint_analyst_last_success_timestamp_seconds)
|
||||
for: 30m
|
||||
labels:
|
||||
severity: warning
|
||||
annotations:
|
||||
summary: >-
|
||||
osint analyst has written no brief for over an hour
|
||||
description: >-
|
||||
The newest article_summaries.batch_timestamp is more than an hour
|
||||
old (the summarizer loops every 15 minutes), or the freshness
|
||||
series is missing entirely. The container can still be Running
|
||||
with restarts 0: a wedged analyst looks exactly like an idle one.
|
||||
Check `kubectl -n osint logs deploy/osint-news-summarizer --tail=50`
|
||||
for the interval rc, confirm the exporter target is UP in
|
||||
Prometheus (job osint-analyst-exporter), and test the analyst
|
||||
query directly:
|
||||
`kubectl -n osint exec deploy/osint-db -- psql -U osint -d osint_data -c "select max(batch_timestamp), count(*) from article_summaries"`.
|
||||
A silently dead model/API key is the usual cause.
|
||||
- alert: OsintIngestAliveButNoBrief
|
||||
expr: |
|
||||
(
|
||||
time() - osint_analyst_last_success_timestamp_seconds > 7200
|
||||
)
|
||||
and
|
||||
(
|
||||
time() - osint_ingest_last_article_timestamp_seconds < 7200
|
||||
)
|
||||
for: 10m
|
||||
labels:
|
||||
severity: warning
|
||||
annotations:
|
||||
summary: >-
|
||||
osint scraper is ingesting but the analyst has written no brief for 2h
|
||||
description: >-
|
||||
`articles` has a row younger than two hours while
|
||||
`article_summaries` has nothing newer than two hours. Ingest fine
|
||||
+ analyst dark is the shape of the 2026-11-25..12-04 outage, where
|
||||
the pipeline looked healthy for nine days because only the ingest
|
||||
side was moving. Confirm the scraper is genuinely alive
|
||||
(`kubectl -n osint logs deploy/osint-news-scraper --tail=20`) and
|
||||
then debug the analyst side: summarizer logs, NEWS_SUMMARIZE_*
|
||||
env, the resolved SUMMARY_MODEL and the Nous API key/inference
|
||||
endpoint (a dead model or a 404 on every map call writes zero
|
||||
rows while the loop keeps logging rc=0).
|
||||
Loading…
Reference in a new issue