{"action":"created","issue":{"url":"https://api.github.com/repos/zalando/skipper/issues/664","repository_url":"https://api.github.com/repos/zalando/skipper","labels_url":"https://api.github.com/repos/zalando/skipper/issues/664/labels{/name}","comments_url":"https://api.github.com/repos/zalando/skipper/issues/664/comments","events_url":"https://api.github.com/repos/zalando/skipper/issues/664/events","html_url":"https://github.com/zalando/skipper/issues/664","id":329083922,"node_id":"MDU6SXNzdWUzMjkwODM5MjI=","number":664,"title":"Error loading an opentracing plugin","user":{"login":"jchanam","id":6512096,"node_id":"MDQ6VXNlcjY1MTIwOTY=","avatar_url":"https://avatars2.githubusercontent.com/u/6512096?v=4","gravatar_id":"","url":"https://api.github.com/users/jchanam","html_url":"https://github.com/jchanam","followers_url":"https://api.github.com/users/jchanam/followers","following_url":"https://api.github.com/users/jchanam/following{/other_user}","gists_url":"https://api.github.com/users/jchanam/gists{/gist_id}","starred_url":"https://api.github.com/users/jchanam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jchanam/subscriptions","organizations_url":"https://api.github.com/users/jchanam/orgs","repos_url":"https://api.github.com/users/jchanam/repos","events_url":"https://api.github.com/users/jchanam/events{/privacy}","received_events_url":"https://api.github.com/users/jchanam/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-06-04T14:38:04Z","updated_at":"2018-06-04T15:22:36Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"### ;TL;DR\r\nThe plugins are only read if skipper is launched from the plugins folder.\r\n\r\n### Issue explanation\r\nHi!\r\n\r\nI'm trying to load the jaeger plugin to use opentracing.\r\n\r\nI've created an image both with skipper apps (skipper/eskip) and the plugins (.so files) on `/plugins` folder.\r\n\r\nHaving done this, when I run skipper it gives me some errors while trying to read the plugin file (`tracing_jaeger.so`).\r\n\r\n### Running from any path:\r\n```\r\n#> skipper --plugindir=/plugins --opentracing \"tracing_jaeger sampler-type=const\"\r\n[APP]INFO[0000] found plugin tracing_basic at /plugins/tracing_basic.so \r\n[APP]INFO[0000] found plugin tracing_instana at /plugins/tracing_instana.so \r\n[APP]INFO[0000] found plugin tracing_jaeger at /plugins/tracing_jaeger.so \r\n[APP]INFO[0000] found plugin tracing_lightstep at /plugins/tracing_lightstep.so \r\n[APP]INFO[0000] attempting to load plugin from /plugins/tracing_instana.so \r\n[APP]INFO[0000] attempting to load plugin from /plugins/tracing_jaeger.so \r\n[APP]INFO[0000] attempting to load plugin from /plugins/tracing_lightstep.so \r\n[APP]INFO[0000] attempting to load plugin from /plugins/tracing_basic.so \r\n[APP]WARN[0000] no route source specified                    \r\n[APP]INFO[0000] Expose metrics in codahale format            \r\n[APP]INFO[0000] support listener on :9911                    \r\n[APP]FATA[0000] open module tracing_jaeger.so: plugin.Open(\"tracing_jaeger.so\"): realpath failed \r\n```\r\n\r\n### Running from /plugins path (the same behaviour is given with or without --plugindir option set):\r\n```\r\n#> skipper --opentracing \"tracing_jaeger sampler-type=const\"\r\n[APP]WARN[0000] no route source specified                    \r\n[APP]INFO[0000] Expose metrics in codahale format            \r\n[APP]INFO[0000] support listener on :9911                    \r\n[APP]FATA[0000] module tracing_jaeger's InitTracer function has wrong signature\r\n\r\n#> skipper --plugindir=/plugins --opentracing \"tracing_jaeger sampler-type=const\"\r\n[APP]INFO[0000] found plugin tracing_basic at /plugins/tracing_basic.so \r\n[APP]INFO[0000] found plugin tracing_instana at /plugins/tracing_instana.so \r\n[APP]INFO[0000] found plugin tracing_jaeger at /plugins/tracing_jaeger.so \r\n[APP]INFO[0000] found plugin tracing_lightstep at /plugins/tracing_lightstep.so \r\n[APP]INFO[0000] attempting to load plugin from /plugins/tracing_basic.so \r\n[APP]INFO[0000] attempting to load plugin from /plugins/tracing_instana.so \r\n[APP]INFO[0000] attempting to load plugin from /plugins/tracing_jaeger.so \r\n[APP]INFO[0000] attempting to load plugin from /plugins/tracing_lightstep.so \r\n[APP]WARN[0000] no route source specified                    \r\n[APP]INFO[0000] Expose metrics in codahale format            \r\n[APP]INFO[0000] support listener on :9911                    \r\n[APP]FATA[0000] module tracing_jaeger's InitTracer function has wrong signature \r\n```\r\n\r\nI think this has something to be with the management of the plugindir management.\r\n\r\nI've seen that a PluginDirs (type `[]string`) is used: https://github.com/zalando/skipper/blob/7102c46b0d1c3557968d5ac1608f2702c331dc9b/skipper.go#L373\r\nAnd that it has a default value `./plugins`\r\nhttps://github.com/zalando/skipper/blob/7102c46b0d1c3557968d5ac1608f2702c331dc9b/cmd/skipper/main.go#L433\r\nhttps://github.com/zalando/skipper/blob/7102c46b0d1c3557968d5ac1608f2702c331dc9b/skipper.go#L44\r\nand that also it is filled with the value given if the flag `--pluginDir` is used: https://github.com/zalando/skipper/blob/7102c46b0d1c3557968d5ac1608f2702c331dc9b/skipper.go#L796\r\n\r\nLater, that array is passed (if `opentracing` flag is set) to load the plugins: https://github.com/zalando/skipper/blob/7102c46b0d1c3557968d5ac1608f2702c331dc9b/tracing/tracing.go#L61-L69\r\n\r\nAs I see there, it should try every path to try to get the plugin, and in a case of success, return the plugin.\r\n\r\nWhat I feel is that it's ignoring the path given and It's only able to read the plugins when skipper is run from the same directory as the plugins are.\r\n\r\nCould you please help me with this? If there's a bug, I don't see it, but if you give me some advice, I'll be happy to fix it and send a PR.\r\n"},"comment":{"url":"https://api.github.com/repos/zalando/skipper/issues/comments/394394245","html_url":"https://github.com/zalando/skipper/issues/664#issuecomment-394394245","issue_url":"https://api.github.com/repos/zalando/skipper/issues/664","id":394394245,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NDM5NDI0NQ==","user":{"login":"jchanam","id":6512096,"node_id":"MDQ6VXNlcjY1MTIwOTY=","avatar_url":"https://avatars2.githubusercontent.com/u/6512096?v=4","gravatar_id":"","url":"https://api.github.com/users/jchanam","html_url":"https://github.com/jchanam","followers_url":"https://api.github.com/users/jchanam/followers","following_url":"https://api.github.com/users/jchanam/following{/other_user}","gists_url":"https://api.github.com/users/jchanam/gists{/gist_id}","starred_url":"https://api.github.com/users/jchanam/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jchanam/subscriptions","organizations_url":"https://api.github.com/users/jchanam/orgs","repos_url":"https://api.github.com/users/jchanam/repos","events_url":"https://api.github.com/users/jchanam/events{/privacy}","received_events_url":"https://api.github.com/users/jchanam/received_events","type":"User","site_admin":false},"created_at":"2018-06-04T15:22:36Z","updated_at":"2018-06-04T15:22:36Z","author_association":"CONTRIBUTOR","body":"Hi @szuecs,\r\n\r\nthat's exactly what I've done. I'm doing `go get` for both `github.com/zalando/skipper` and `github.com/skipper-plugins/opentracing`.\r\n\r\nThen, I go in each folder and run the following:\r\nSkipper: `GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -o built/skipper github.com/zalando/skipper/cmd/skipper`\r\nEskip: `GOOS=linux GOARCH=amd64 CGO_ENABLED=1 go build -o built/eskip github.com/zalando/skipper/cmd/eskip`\r\nOpentracing: `GOOS=linux GOARCH=amd64 CGO_ENABLED=1 make`\r\n\r\nThen, I join all of them in a second container (to reduce size):\r\n```\r\n# Final image.\r\n# IMPORTANT: This version should match with the version used on the golang image\r\nFROM frolvlad/alpine-glibc:alpine-3.5_glibc-2.24\r\nRUN apk --no-cache add ca-certificates && update-ca-certificates\r\nRUN mkdir -p /usr/bin\r\nCOPY --from=build-stage /go/src/github.com/zalando/skipper/built/skipper /usr/bin/skipper\r\nCOPY --from=build-stage /go/src/github.com/zalando/skipper/built/eskip /usr/bin/eskip\r\nCOPY --from=build-stage /go/src/github.com/skipper-plugins/opentracing/build/*.so /plugins/\r\n\r\nENV PATH $PATH:/usr/bin\r\n\r\nCMD [\"/usr/bin/skipper\", \"-plugindir\", \"/plugins\"]\r\nEXPOSE 9090 9911\r\n```"}}
{"actor":{"display_login":"jchanam"}}