apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ecommerce-admin-panel
  namespace: ecommerce
  labels:
    app: ecommerce-admin-panel
  annotations:
    # Required for SPA: rewrite all paths to / so React Router handles routing
    nginx.ingress.kubernetes.io/rewrite-target: /
    # Enable gzip at the ingress level
    nginx.ingress.kubernetes.io/enable-gzip: "true"
    # Optional: enable HTTPS redirect (uncomment when TLS is configured)
    # nginx.ingress.kubernetes.io/ssl-redirect: "true"
spec:
  ingressClassName: nginx
  rules:
    - host: admin.yourdomain.com   # Replace with your actual domain
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: ecommerce-admin-panel
                port:
                  number: 80
  # TLS (uncomment and configure when you have a TLS certificate / cert-manager)
  # tls:
  #   - hosts:
  #       - admin.yourdomain.com
  #     secretName: ecommerce-admin-panel-tls
