{{- if and .Values.ingress.enabled .Values.ingress.host }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: {{ include "mt5.fullname" . }}
  labels:
    {{- include "mt5.labels" . | nindent 4 }}
  {{- with .Values.ingress.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
spec:
  {{- if .Values.ingress.className }}
  ingressClassName: {{ .Values.ingress.className }}
  {{- end }}
  {{- with .Values.ingress.tls }}
  tls:
    {{- toYaml . | nindent 4 }}
  {{- end }}
  rules:
    - host: {{ .Values.ingress.host | quote }}
      http:
        paths:
          # Nur Web-UI (KasmVNC, inkl. WebSocket) – RPyC bleibt clusterintern
          - path: /
            pathType: Prefix
            backend:
              service:
                name: {{ include "mt5.fullname" . }}
                port:
                  name: web
{{- end }}
