# services/logging/opensearch-dashboards-helmrelease.yaml
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
  name: opensearch-dashboards
  namespace: logging
spec:
  interval: 15m
  timeout: 10m
  chart:
    spec:
      chart: opensearch-dashboards
      version: "~2.32.0"
      sourceRef:
        kind: HelmRepository
        name: opensearch
        namespace: flux-system
  values:
    fullnameOverride: opensearch-dashboards
    opensearchHosts: "http://opensearch-master.logging.svc.cluster.local:9200"
    replicaCount: 1
    config:
      opensearch_dashboards.yml: |
        server.host: 0.0.0.0
        opensearch.hosts: ["http://opensearch-master.logging.svc.cluster.local:9200"]
        opensearch_security.enabled: false
        uiSettings:
          overrides:
            "theme:darkMode": true
    extraEnvs:
      - name: NODE_OPTIONS
        value: "--max-old-space-size=768"
    resources:
      requests:
        cpu: "200m"
        memory: "768Mi"
      limits:
        cpu: "200m"
        memory: "1Gi"
    affinity:
      nodeAffinity:
        requiredDuringSchedulingIgnoredDuringExecution:
          nodeSelectorTerms:
            - matchExpressions:
                - key: jetson
                  operator: In
                  values:
                    - "true"
            - matchExpressions:
                - key: hardware
                  operator: In
                  values:
                    - rpi5
        preferredDuringSchedulingIgnoredDuringExecution:
          - weight: 100
            preference:
              matchExpressions:
                - key: jetson
                  operator: In
                  values:
                    - "true"
