apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: photum-ingress
  namespace: photum
  annotations:
    # Emite o certificado SSL automaticamente
    cert-manager.io/cluster-issuer: letsencrypt-prod
    # Define o Traefik como controlador
    kubernetes.io/ingress.class: traefik
    # Comando para o External-DNS criar o registro no Cloudflare
    external-dns.alpha.kubernetes.io/hostname: api-dev.photum.app.br
spec:
  tls:
    - hosts:
        - api-dev.photum.app.br
        # O certificado será armazenado neste secret
      secretName: photum-tls-cert
  rules:
    - host: api-dev.photum.app.br
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: photum-service
                port:
                  number: 80
