# Expose Hermes Agent Web Dashboard at bot.junv.cc with OAuth2 SSO
# Dashboard runs on 192.168.1.10:9119 (outside k3s)
#
# Deploy: kubectl apply -f home-apps/hermes-dashboard.yaml
# Check:  kubectl get ingress,svc,endpointslices -n home-apps hermes-dashboard
#
---
# Service without selector (points to external hermes-dashboard.service on the node)
apiVersion: v1
kind: Service
metadata:
  name: hermes-dashboard
  namespace: home-apps
spec:
  ports:
  - name: http
    port: 80
    targetPort: 9119
    protocol: TCP
---
# Endpoints pointing to the dashboard process on server-3
apiVersion: v1
kind: Endpoints
metadata:
  name: hermes-dashboard
  namespace: home-apps
subsets:
  - addresses:
      - ip: 192.168.1.10
    ports:
      - name: http
        port: 9119
        protocol: TCP
---
# Ingress with OAuth2 SSO protection
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: hermes-dashboard-ingress
  namespace: home-apps
  annotations:
    cert-manager.io/cluster-issuer: "letsencrypt-prod"
    nginx.ingress.kubernetes.io/auth-url: "https://pass.junv.cc/oauth2/auth"
    nginx.ingress.kubernetes.io/auth-signin: "https://pass.junv.cc/oauth2/start?rd=https://$host$escaped_request_uri"
spec:
  ingressClassName: nginx
  tls:
  - hosts:
    - bot.junv.cc
    secretName: hermes-dashboard-tls
  rules:
  - host: bot.junv.cc
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: hermes-dashboard
            port:
              number: 80
