nixos/traefik: refactor, add plugins option, add documentation - #437073
nixos/traefik: refactor, add plugins option, add documentation#437073SigmaSquadron wants to merge 8 commits into
plugins option, add documentation#437073Conversation
a44583e to
be1c037
Compare
8ce89b1 to
a0b82bd
Compare
039eccc to
f153a03
Compare
f153a03 to
80a6927
Compare
This comment was marked as resolved.
This comment was marked as resolved.
| ::: {.note} | ||
| Using this option has precedence over {option}`services.traefik.dynamic.settings` | ||
| ::: |
There was a problem hiding this comment.
This note holds true for the static settings, but this one should be is mutually exclusive, not has precedence over.
| Due to [a limitation in Traefik](https://github.com/traefik/traefik/issues/10890); any syntax error in a dynamic configuration will cause the _**entire file provider**_ to be ignored. | ||
| This may cause interuption in service, which may include access to the traefik dashboard, if enabled and configured to use [traefik-ception](https://doc.traefik.io/traefik/operations/dashboard/#secure-mode). |
There was a problem hiding this comment.
It doesn't look like anything official has happened yet, but schemastore.org seems to have a schema for the static and dynamic file provider: https://www.schemastore.org/traefik-v3.json https://www.schemastore.org/traefik-v3-file-provider.json
I don't know that I would rely on that since it's out of tree (and thus not possible to change based on cfg.package), but since at the very least a base is there it might be worth trying to get traefik to adopt the schema and keep it updated as options change.
|
@TheRealGramdalf @jackrosenberg: I have an idea below for a redesign of the dynamic configuration loader. If we can define multiple files, then it'd be a good idea to just have TODO
Dynamic config refactor
|
|
I will have time for this in the weekend, will take a look then! |
|
Again I'll have to follow up on this when I'm at my laptop, but I'd really prefer not to force Couple other things for the todo list:
Other random thought:
|
No, no. We're not limiting anything. I'm saying that if we have an option that can accept an infinite number of files and settings that will be transpiled into a config file by Nix, we don't need separate options to configure a random separate configuration file that is not as extensible. If a user has a single non-declarative file they want to add to the config, they simply use This has the benefit of working with mixed setups, so you can set the directory to a directory full of config files, add a new
I would welcome contributions on this front. NixOS tests are not my strong suit.
The only thing to consider is that if you're using
I'm not sure what you mean by that. |
272b8d6 to
1317b04
Compare
|
Could this be split into multiple, smaller PRs? For example the plugin capability should be mostly standalone from what I can tell. |
| export tmpdir=$(mktemp -d) | ||
| mv $out/${moduleName}@v${version}/* $out/${moduleName}@v${version}/.* $tmpdir | ||
| rm -rf $out/${provider} | ||
| mkdir -p "$out/src/${moduleName}" | ||
| mv -t "$out/src/${moduleName}" $tmpdir/* $tmpdir/.* |
There was a problem hiding this comment.
I'm not sure if this changed or each plugin may be different, but this postFetch failed for me as the zip file did not have the expected structure. I was using https://plugins.traefik.io/plugins/66b63d12d29fd1c421b503f5/oidc-authentication
This fixed it:
| export tmpdir=$(mktemp -d) | |
| mv $out/${moduleName}@v${version}/* $out/${moduleName}@v${version}/.* $tmpdir | |
| rm -rf $out/${provider} | |
| mkdir -p "$out/src/${moduleName}" | |
| mv -t "$out/src/${moduleName}" $tmpdir/* $tmpdir/.* | |
| mkdir -p "$out/src/${provider}/${owner}" | |
| mv $out/${owner}-${plugin}-* "$out/src/${moduleName}" |
1317b04 to
3db58c9
Compare
This function takes in the provider, owner and plugin name, and outputs a correctly-formatted derivation with the Traefik plugin, which can be `symlinkJoin`ed in the `/var/lib/traefik/plugins-local` folder. Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
…refactor traefik module Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net> Co-authored-by: Jack Rosenberg <github@jackr.eu>
Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
Co-authored-by: Fernando Rodrigues <alpha@sigmasquadron.net>
Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
Signed-off-by: Fernando Rodrigues <alpha@sigmasquadron.net>
3db58c9 to
5f0856c
Compare
|
I've split the refactor and other non-plugin commits into #482512 |

wip-traefik-plugins->masterCloses #436807
Things done
passthru.tests.nixpkgs-reviewon this PR. See nixpkgs-review usage../result/bin/.Add a 👍 reaction to pull requests you find important.