Skip to content

An init container to make traefik local plugins easier to use

License

Notifications You must be signed in to change notification settings

colearendt/traefik-plugin-init

Repository files navigation

Traefik Plugin Init

This repository provides a simple container that:

  • Can be used as an initContainer in Kubernetes
  • Avoids having to build custom traefik docker images to use traefik plugins
    • (Specifically, local plugins, which do not require traefik pilot)
  • Can be used with the traefik helm chart
  • Allows multple plugins for a single traefik installation
  • Allows specifying GitHub references per plugin (i.e. branch, tag, ref, etc.)

Please see the ./examples directory for illustrations of how to use

What does it do

On startup, the container loops through GitHub repositories and clones them into the container. By mounting a shared volume between this container and the traefik container, this will make the plugin sources available to traefik.

Configuration

Recommended configuration is with environment variables:

  • TRAEFIK_PLUGIN_PATH: the path repositories will be cloned within
  • TRAEFIK_PLUGIN_PREFIX: the environment variable prefix to use to define GitHub repositories
  • TRAEFIK_PLUGIN_REPO_1, TRAEFIK_PLUGIN_REPO_2, etc.: if TRAEFIK_PLUGIN_PREFIX = TRAEFIK_PLUGIN_REPO_, then these would house your GitHub references

Git URL examples:

  • https://github.com/XciD/traefik-plugin-rewrite-headers (will reference the default branch at container startup)
  • https://github.com/XciD/traefik-plugin-rewrite-headers@main (chooses a branch or tag ref)
  • NOTE: BROKEN: https://github.com/XciD/traefik-plugin-rewrite-headers@e66f2dc (chooses a sha)

NOTE: in production, it is recommended to pin plugins to an immutable reference (usually a tag). Otherwise, restarting traefik pods can change plugin versions

Shortcomings

  • Tested only interactively against https://github.com . Semantics may be different for other git repository providers
  • SHA refs are currently broken
  • Need to test properly

About

An init container to make traefik local plugins easier to use

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages