darkweak / souin

An HTTP cache system, RFC compliant, compatible with @tyktechnologies, @traefik, @caddyserver, @go-chi, @bnkamalesh, @beego, @devfeel, @labstack, @gofiber, @go-goyave, @go-kratos, @gin-gonic, @roadrunner-server, @zalando, @zeromicro, @nginx and @apache
https://docs.souin.io
MIT License
719 stars 56 forks source link

[k8s Træfik plugin] invalid middleware type #575

Closed peltho closed 2 weeks ago

peltho commented 2 weeks ago

I'm trying to use your plugin on a Kubernetes environment. To do so, I implemented one middleware (for Træfik dynamic config) this way:

apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
  name: souin
spec:
  plugin:
    souin:
      api:
        prometheus: {}
        souin: {}
      default_cache:
        ttl: 5s
      log_level: debug

Then I updated my Træfik static config:

experimental:
  plugins:
     souin:
       moduleName: github.com/darkweak/souin
       version: v1.7.5

Until now everything's ok on Træfik UI, but at the time I reference the middleware for a given service (in its IngressRoute) it fails:

kind: IngressRoute
apiVersion: traefik.io/v1alpha1
metadata:
  name: my-service-ingressroute
  namespace: default
spec:
  entryPoints:
  - websecure
  routes:
  - match: Host(`foo.com`) && !Path("/")
    kind: Rule
    middlewares:
    - name: souin #                    <-- here is the reference
    services:
    - name: my-service
      port: 8080
  tls:
    certResolver: letsencrypt
image

Am I doing something wrong?

peltho commented 2 weeks ago

Somehow after having restarted the whole cluster (for another unrelated issue) it seems to work correctly 🤷🏻‍♂️