Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Traefik-route-k8s renders rules without stripPrefix middleware #40

Open
natalian98 opened this issue Aug 29, 2023 · 3 comments
Open

Traefik-route-k8s renders rules without stripPrefix middleware #40

natalian98 opened this issue Aug 29, 2023 · 3 comments

Comments

@natalian98
Copy link

Bug Description

The traefik-route-k8s doesn't generate rules with the stripPrefix middleware, while the "ingress-per-app" does so.
Is this intentional? Is that middleware not needed with ingress-per-unit?

An example rule rendered by

  • route charm:
http:
  routers:
    juju-prometheus-k8s-0-test-router:
      entryPoints:
      - web
      rule: Host(`prometheus-k8s-operator-0.prometheus-k8s-operator-endpoints.test.svc.cluster.local`)
      service: juju-prometheus-k8s-0-test-service
    juju-prometheus-k8s-0-test-router-tls:
      entryPoints:
      - websecure
      rule: Host(`prometheus-k8s-operator-0.prometheus-k8s-operator-endpoints.test.svc.cluster.local`)
      service: juju-prometheus-k8s-0-test-service
      tls:
        domains:
        - main: 10.64.140.43
          sans:
          - '*.10.64.140.43'
  services:
    juju-prometheus-k8s-0-test-service:
      loadBalancer:
        servers:
        - url: http://prometheus-k8s-operator-0.prometheus-k8s-operator-endpoints.test.svc.cluster.local:8080
  • ingress-per-app:
http:
  middlewares:
    juju-sidecar-noprefix-test-identity-platform-login-ui-operator:
      stripPrefix:
        forceSlash: false
        prefixes:
        - /test-identity-platform-login-ui-operator
  routers:
    juju-test-identity-platform-login-ui-operator-router:
      entryPoints:
      - web
      middlewares:
      - juju-sidecar-noprefix-test-identity-platform-login-ui-operator
      rule: PathPrefix(`/test-identity-platform-login-ui-operator`)
      service: juju-test-identity-platform-login-ui-operator-service
    juju-test-identity-platform-login-ui-operator-router-tls:
      entryPoints:
      - websecure
      rule: PathPrefix(`/test-identity-platform-login-ui-operator`)
      service: juju-test-identity-platform-login-ui-operator-service
      tls:
        domains:
        - main: 10.64.140.43
          sans:
          - '*.10.64.140.43'
  services:
    juju-test-identity-platform-login-ui-operator-service:
      loadBalancer:
        servers:
        - url: http://identity-platform-login-ui-operator-0.identity-platform-login-ui-operator-endpoints.test.svc.cluster.local:8080

To Reproduce

  1. juju deploy traefik-route-k8s root_url=...
  2. juju deploy traefik-k8s
  3. juju deploy prometheus-k8s
  4. juju relate traefik-route-k8s prometheus-k8s
  5. juju relate traefik-route-k8s traefik-k8s

Environment

n/a

Relevant log output

n/a

Additional context

No response

@simskij
Copy link
Member

simskij commented Aug 29, 2023

The middleware is not strictly needed in any routing mode. However, it often makes a lot of sense to have it to simplify reverse proxying. I just think no one has asked for this middleware to be available in the route charm, so no time has been invested in adding it.

@sed-i
Copy link
Contributor

sed-i commented Aug 29, 2023

Related (for future reference): canonical/grafana-k8s-operator#246

@PietroPasotti
Copy link
Contributor

@natalian98 can you try out #47 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants