unrip/scripts/dev/operator-dashboard-forward.sh
philipp fb547f24d9
All checks were successful
deploy / deploy (push) Successful in 48s
fix: scope inventory fetch by submission time window to prevent OOM
Instead of fetching up to 50k inventory snapshots (~442MB), scope the
query to only the time range of the current submission batch with a
15-minute buffer. For a typical 1-hour batch this drops from 50k rows
to ~300 rows, well within the 1280Mi pod memory limit.

The coalesced_at_idx on intent_inventory_snapshots covers the BETWEEN
clause so this remains efficient.

Proof: history-writer OOM kills from refreshQuoteOutcomes inventory fetch
Assumptions: 15min buffer covers the attribution window for all submissions
Still fake: heuristic gap outcomes may attribute trades imprecisely
2026-06-16 17:17:19 +02:00

18 lines
766 B
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
PLATFORM_REPO_DIR="${PLATFORM_REPO_DIR:-$ROOT_DIR/../unrip3}"
KUBECONFIG_PATH="${KUBECONFIG_PATH:-${KUBECONFIG:-$PLATFORM_REPO_DIR/.state/hetzner/kubeconfig.yaml}}"
NAMESPACE="${OPERATOR_DASHBOARD_FORWARD_NAMESPACE:-unrip}"
SERVICE_NAME="${OPERATOR_DASHBOARD_FORWARD_SERVICE:-operator-dashboard}"
FORWARD_PORT="${OPERATOR_DASHBOARD_FORWARD_PORT:-8090}"
SERVICE_PORT="${OPERATOR_DASHBOARD_FORWARD_SERVICE_PORT:-8090}"
FORWARD_ADDRESS="${OPERATOR_DASHBOARD_FORWARD_ADDRESS:-0.0.0.0}"
exec env KUBECONFIG="$KUBECONFIG_PATH" \
kubectl port-forward \
--address "$FORWARD_ADDRESS" \
-n "$NAMESPACE" \
"svc/${SERVICE_NAME}" \
"${FORWARD_PORT}:${SERVICE_PORT}"