talevy
March 15, 2023, 4:22pm
1
Hi,
I'm trying to test my local plugin , and I get an error:
{“entryPointName”:“web”,“level”:“error”,“msg”:“plugin: unknown plugin type: requestid”,“routerName”:“backend-router@file”,“time”:“2023-03-15T16:08:10Z”}
Metadata:
Traefik version: 2.9.5
plugin name: requested
location: plugins-local/src/github.com/traefik/requestid
.traefik.yaml:
displayName: Request ID
type: middleware
import: github.com/traefik/requestid
summary: Adds a header to incoming requests
testData: {}
middleware config:
http:
middlewares:
requestid:
plugin:
requestid: {}
experimental:
localPlugins:
requestid:
moduleName: github.com/traefik/requestid
ldez
March 16, 2023, 1:04am
2
Hello,
I think you have mixed static configuration and dynamic configuration.
And your module name should not contain github.com/traefik/
Take a look at the documentation:
talevy
March 16, 2023, 8:02am
3
can you please help me focus on what should I change,
my configuration looks exactly like described in the local mode example that you mentioned
ldez
March 16, 2023, 8:19am
4
The dynamic configuration and the static configuration must be defined in separated files:
# Static configuration (traefik.yml)
experimental:
localPlugins:
example:
moduleName: <your module name>
# dynamic configuration (related to the path of the file provider)
http:
routers:
my-router:
rule: host(`demo.localhost`)
service: service-foo
entryPoints:
- web
middlewares:
- my-plugin
services:
service-foo:
loadBalancer:
servers:
- url: http://127.0.0.1:5000
middlewares:
my-plugin:
plugin:
example:
<the configuration of your plugin>
talevy
March 16, 2023, 8:54am
5
the configuration is correct, is it just the place I've put it?
I use the traefik helm chart to deploy it, can you relate me to the appropriate place for the experimental ?
# Default values for Traefik
image:
repository: traefik
# defaults to appVersion
tag: ""
pullPolicy: IfNotPresent
#
# Configure integration with Traefik Hub
#
hub:
## Enabling Hub will:
# * enable Traefik Hub integration on Traefik
# * add `traefikhub-tunl` endpoint
# * enable Prometheus metrics with addRoutersLabels
# * enable allowExternalNameServices on KubernetesIngress provider
# * enable allowCrossNamespace on KubernetesCRD provider
# * add an internal (ClusterIP) Service, dedicated for Traefik Hub
enabled: false
## Default port can be changed
This file has been truncated. show original
In the docs they uses Traefik Labs · GitHub also
Thank you for your help !
ldez
March 16, 2023, 9:07am
6
experimental
is not a subset of http
: the http
configuration is a part of the dynamic configuration, and experimental
is a part of the static configuration.
additionalArguments:
- "--experimental.localPlugins.example.moduleName=<your module name>"
The documentation uses a module name with github.com/traefik/
because it's our own plugin.
I wrote the documentation, I wrote the demo plugin, and I also wrote the plugin system
talevy
March 16, 2023, 9:52am
7
hahaha, the best person to ask! (:
I thought the URL prefix in github is mandatory (traefik in path or anything else does not matter I guess )
deployment parameter
plugins file:
http:
middlewares:
requestid:
plugin:
requestid: {}
error:
ldez
March 16, 2023, 9:55am
8
please stop using our base module name (github.com/traefik/
), it will work but it's a bad practice.
Can you provide all your Traefik configurations?
talevy
March 16, 2023, 10:02am
9
traefik --entrypoints.metrics.address=:9100/tcp
--entrypoints.traefik.address=:9000/tcp
--entrypoints.web.address=:8000/tcp
--entrypoints.websecure.address=:8443/tcp
--api.dashboard=true --ping=true
--metrics.prometheus=true
--metrics.prometheus.entrypoint=metrics
--entrypoints.websecure.http.tls=true
--log.format=json --log.level=DEBUG
--providers.file.directory=/etc/traefik
--providers.file.watch=false
--api.insecure=true
--experimental.localPlugins.requestid.moduleName=github.com/traefik/requestid
ldez
March 16, 2023, 10:02am
10
can you also provide the logs?
talevy
March 16, 2023, 10:37am
11
I looked into the logs and found the last issue
.traefik.yml (file extension typo)
It works, thank you!!!
1 Like
system
Closed
March 19, 2023, 10:38am
12
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.