## Global image settings
image:
  registry: registry.celestium.life/stonks-oracle
  pullPolicy: Always
  tag: latest

## Service deployments — replicas and resource overrides
services:
  scheduler:
    replicas: 1
    image: scheduler
    command: "python -m services.scheduler.app"
    tier: orchestration
    secrets: [stonks-core-secrets]
    resources:
      requests: { cpu: 50m, memory: 64Mi }
      limits: { cpu: 200m, memory: 128Mi }

  symbolRegistry:
    replicas: 1
    image: symbol-registry
    command: "uvicorn services.symbol_registry.app:app --host 0.0.0.0 --port 8000"
    tier: api
    port: 8000
    secrets: [stonks-core-secrets]
    resources:
      requests: { cpu: 100m, memory: 128Mi }
      limits: { cpu: 500m, memory: 256Mi }
    probes:
      readiness: { path: /docs, port: 8000, initialDelay: 5, period: 10 }
      liveness: { path: /docs, port: 8000, initialDelay: 10, period: 30 }

  ingestion:
    replicas: 2
    image: ingestion
    command: "python -m services.ingestion.worker"
    tier: ingestion
    secrets: [stonks-core-secrets, stonks-market-secrets, stonks-broker-secrets]
    resources:
      requests: { cpu: 100m, memory: 128Mi }
      limits: { cpu: 500m, memory: 256Mi }

  parser:
    replicas: 2
    image: parser
    command: "python -m services.parser.worker"
    tier: processing
    secrets: [stonks-core-secrets]
    resources:
      requests: { cpu: 100m, memory: 128Mi }
      limits: { cpu: 500m, memory: 256Mi }

  extractor:
    replicas: 1
    image: extractor
    command: "python -m services.extractor.main"
    tier: processing
    secrets: [stonks-core-secrets]
    resources:
      requests: { cpu: 200m, memory: 256Mi }
      limits: { cpu: "1", memory: 512Mi }

  aggregation:
    replicas: 4
    image: aggregation
    command: "python -m services.aggregation.main"
    tier: processing
    secrets: [stonks-core-secrets]
    resources:
      requests: { cpu: 100m, memory: 128Mi }
      limits: { cpu: 500m, memory: 256Mi }

  recommendation:
    replicas: 1
    image: recommendation
    command: "python -m services.recommendation.main"
    tier: processing
    secrets: [stonks-core-secrets]
    resources:
      requests: { cpu: 100m, memory: 128Mi }
      limits: { cpu: 500m, memory: 256Mi }

  tradingEngine:
    replicas: 1
    image: trading-engine
    command: "uvicorn services.trading.app:app --host 0.0.0.0 --port 8000"
    tier: trading
    port: 8000
    secrets: [stonks-core-secrets, stonks-broker-secrets, stonks-gmail-secrets]
    resources:
      requests: { cpu: 100m, memory: 256Mi }
      limits: { cpu: 500m, memory: 512Mi }
    probes:
      readiness: { path: /ready, port: 8000, initialDelay: 5, period: 10 }
      liveness: { path: /health, port: 8000, initialDelay: 10, period: 30 }

  riskEngine:
    replicas: 1
    image: risk
    command: "uvicorn services.risk.app:app --host 0.0.0.0 --port 8000"
    tier: trading
    port: 8000
    secrets: [stonks-core-secrets, stonks-broker-secrets]
    resources:
      requests: { cpu: 100m, memory: 128Mi }
      limits: { cpu: 500m, memory: 256Mi }

  brokerAdapter:
    replicas: 1
    image: broker-adapter
    command: "python -m services.adapters.broker_service"
    tier: trading
    secrets: [stonks-core-secrets, stonks-broker-secrets]
    resources:
      requests: { cpu: 50m, memory: 64Mi }
      limits: { cpu: 200m, memory: 128Mi }

  lakePublisher:
    replicas: 1
    image: lake-publisher
    command: "python -m services.lake_publisher.jobs"
    tier: analytics
    secrets: [stonks-core-secrets]
    resources:
      requests: { cpu: 100m, memory: 128Mi }
      limits: { cpu: 500m, memory: 256Mi }

  queryApi:
    replicas: 1
    image: query-api
    command: "uvicorn services.api.app:app --host 0.0.0.0 --port 8000"
    tier: api
    port: 8000
    secrets: [stonks-core-secrets]
    resources:
      requests: { cpu: 100m, memory: 128Mi }
      limits: { cpu: 500m, memory: 256Mi }
    probes:
      readiness: { path: /docs, port: 8000, initialDelay: 5, period: 10 }

  dashboard:
    replicas: 1
    image: dashboard
    tier: frontend
    port: 8080
    resources:
      requests: { cpu: 50m, memory: 64Mi }
      limits: { cpu: 200m, memory: 128Mi }
    probes:
      readiness: { path: /, port: 8080, initialDelay: 3, period: 10 }
      liveness: { path: /, port: 8080, initialDelay: 5, period: 30 }

## ConfigMap data
config:
  POSTGRES_HOST: "postgresql-rw.postgresql-service.svc.cluster.local"
  POSTGRES_PORT: "5432"
  POSTGRES_DB: "stonks"
  POSTGRES_USER: "stonks"
  REDIS_HOST: "redis-master.redis-service.svc.cluster.local"
  REDIS_PORT: "6379"
  REDIS_DB: "0"
  MINIO_ENDPOINT: "minio.minio-service.svc.cluster.local:80"
  MINIO_SECURE: "false"
  OLLAMA_BASE_URL: "http://10.1.1.12:2701"
  OLLAMA_MODEL: "qwen3.5:9b-fast"
  OLLAMA_TIMEOUT: "240"
  OLLAMA_MAX_RETRIES: "2"
  OLLAMA_RETRY_BASE_DELAY: "1.0"
  OLLAMA_RETRY_MAX_DELAY: "10.0"
  OLLAMA_RETRY_BACKOFF_MULTIPLIER: "2.0"
  TRINO_HOST: "trino.stonks-oracle.svc.cluster.local"
  TRINO_PORT: "8080"
  TRINO_CATALOG: "lakehouse"
  TRINO_SCHEMA: "stonks"
  TRINO_ICEBERG_CATALOG: "iceberg"
  BROKER_MODE: "paper"
  BROKER_PROVIDER: "alpaca"
  MARKET_DATA_BASE_URL: "https://api.polygon.io"
  MARKET_DATA_PROVIDER: "polygon"
  RETENTION_RAW_MARKET_DAYS: "90"
  RETENTION_RAW_NEWS_DAYS: "180"
  RETENTION_RAW_FILINGS_DAYS: "365"
  RETENTION_NORMALIZED_DAYS: "180"
  RETENTION_LLM_PROMPTS_DAYS: "365"
  RETENTION_LLM_RESULTS_DAYS: "365"
  RETENTION_LAKEHOUSE_DAYS: "730"
  RETENTION_AUDIT_DAYS: "730"
  RETENTION_CLEANUP_INTERVAL_HOURS: "24"
  RETENTION_BATCH_SIZE: "1000"
  LOG_LEVEL: "INFO"
  JSON_LOGS: "true"
  DEPLOY_STAGE: ""
  ALERT_SOURCE_FAILURE_THRESHOLD: "3"
  ALERT_SOURCE_FAILURE_WINDOW_HOURS: "6"
  ALERT_SCHEMA_FAILURE_RATE_THRESHOLD: "0.3"
  ALERT_SCHEMA_FAILURE_WINDOW_HOURS: "1"
  ALERT_LAKE_LAG_THRESHOLD_MINUTES: "60"
  ALERT_BROKER_ERROR_THRESHOLD: "3"
  ALERT_BROKER_ERROR_WINDOW_HOURS: "1"
  ALERT_CHECK_INTERVAL_SECONDS: "120"
  TRADING_ENABLED: "true"
  TRADING_RISK_TIER: "moderate"
  TRADING_ABSOLUTE_POSITION_CAP: "10000.0"
  TRADING_MAX_OPEN_POSITIONS: "10"

## Secrets
secrets:
  core:
    POSTGRES_PASSWORD: ""
    MINIO_ACCESS_KEY: ""
    MINIO_SECRET_KEY: ""
    REDIS_PASSWORD: ""
  broker:
    BROKER_API_KEY: ""
    BROKER_API_SECRET: ""
    BROKER_BASE_URL: "https://paper-api.alpaca.markets"
  market:
    MARKET_DATA_API_KEY: ""
  gmail:
    GMAIL_SENDER: "celes@celestium.life"
    GMAIL_RECIPIENT: "celes@celestium.life"
    GMAIL_APP_PASSWORD: ""
  dashboard:
    SUPERSET_SECRET_KEY: ""
    SUPERSET_ADMIN_PASSWORD: ""

## Ingress
ingress:
  enabled: true
  className: traefik
  clusterIssuer: ca-issuer
  hosts:
    queryApi: stonks-api.celestium.life
    symbolRegistry: stonks-registry.celestium.life
    dashboard: stonks.celestium.life
    superset: stonks-dash.celestium.life
    trino: stonks-trino.celestium.life
    tradingEngine: stonks-trading.celestium.life

## Analytics stack
trino:
  enabled: true
  resources:
    requests: { cpu: 500m, memory: 1Gi }
    limits: { cpu: "2", memory: 4Gi }

hiveMetastore:
  enabled: true
  storageSize: 1Gi
  resources:
    requests: { cpu: 200m, memory: 512Mi }
    limits: { cpu: "1", memory: 1Gi }

superset:
  enabled: true
  storageSize: 2Gi
  resources:
    requests: { cpu: 200m, memory: 512Mi }
    limits: { cpu: "1", memory: 2Gi }

## Network policies
networkPolicies:
  enabled: true
