Skip to content

Replace hardcoded .localhost Ingress with Traefik IngressRoute HostRegexp in all templates #8

Description

@terchris

Problem

All templates in templates/*/manifests/ingress.yaml use a standard Kubernetes Ingress with a hardcoded .localhost host:

apiVersion: networking.k8s.io/v1
kind: Ingress
spec:
  rules:
    - host: {{REPO_NAME}}.localhost

This means apps deployed via ArgoCD are only accessible via *.localhost. They are not reachable through Cloudflare tunnel (*.urbalurba.no) or Tailscale (*.dog-pence.ts.net).

Root Cause

The UIS infrastructure uses Traefik IngressRoutes with HostRegexp wildcards for all its built-in services:

argocd-server:        HostRegexp(`argocd\..+`)
rabbitmq-management:  HostRegexp(`rabbitmq\..+`)

The HostRegexp pattern matches any domain suffix.localhost, .urbalurba.no, .dog-pence.ts.net, etc. But the app templates use standard Kubernetes Ingress with a hardcoded .localhost suffix, which only matches one domain.

Affected Templates

All 7 templates that have manifests/ingress.yaml:

  • csharp-basic-webserver
  • designsystemet-basic-react-app
  • golang-basic-webserver
  • java-basic-webserver
  • php-basic-webserver
  • python-basic-webserver
  • typescript-basic-webserver

Proposed Fix

Replace manifests/ingress.yaml in each template with a Traefik IngressRoute using HostRegexp:

apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
  name: {{REPO_NAME}}-ingressroute
  namespace: {{REPO_NAME}}
spec:
  entryPoints:
    - web
  routes:
    - match: HostRegexp(`{{REPO_NAME}}\..+`)
      kind: Rule
      services:
        - name: {{REPO_NAME}}-service
          port: 80

Update kustomization.yaml in each template to reference the new file if the filename changes.

Result After Fix

Apps generated from the templates will automatically work across all access methods:

  • http://<app>.localhost (local development)
  • https://<app>.urbalurba.no (Cloudflare tunnel)
  • https://<app>.dog-pence.ts.net (Tailscale)

Context

Found during ArgoCD CLI testing (PLAN-012/ArgoCD). The urb-dev-typescript-hello-world app returned HTTP 200 on *.localhost but was not reachable via the Cloudflare tunnel at *.urbalurba.no because Traefik had no matching host rule for that domain.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions