traefik-route-k8s
- Canonical Observability
Channel | Revision | Published | Runs on |
---|---|---|---|
latest/stable | 23 | 04 Jun 2024 | |
latest/candidate | 23 | 22 May 2024 | |
latest/beta | 23 | 24 Apr 2024 | |
latest/edge | 27 | 19 Sep 2024 |
juju deploy traefik-route-k8s
Deploy universal operators easily with Juju, the Universal Operator Lifecycle Manager.
Platform:
-
root_url | string
The url to advertise to the unit in need of ingress. The value of the field is going to be processed in exactly the same way as the
rule
field. The assumption is that the url is going to match the rule; however, we have no way to validate and/or enforce this condition; so beware! For example, given a downstream unit calledprometheus/0
in thecos
model, the following configuration is valid:rule="Host(
{{juju_unit}}.{{juju_model}}.foo.bar
)" root_url="http://{{juju_unit}}.{{juju_model}}.foo.bar/baz"while the following configuration is not:
rule="Host(
{{juju_model}}-{{juju_unit}}.foo.bar
) || HostRegexp({subdomain:[a-z]+}.foo.bar
) || Host(doobadooba.com
)" root_url="ka-ching.com"The reason why this is not valid is that the url does not match the rule: so the url advertised to the unit will not in fact be routed correctly by Traefik. Note that Traefik will still work 'correctly', i.e. the application will be reachable at (for example)
http://doobadooba.com
. Examples of 'good' root_url values for this case would be:root_url="{{juju_model}}-{{juju_unit}}.foo.bar/baz" root_url="baz.foo.bar" root_url="doobadooba.com/choo"
-
rule | string
A Traefik routing rule, see https://doc.traefik.io/traefik/routing/routers/ for an overview. The value of the field is going to be processed as a Jinja2 template, with the following globals available:
- {{juju_model}} resolves to the model name of the downstream proxied application.
- {{juju_application}} resolves to the application name of the downstream proxied application.
- {{juju_unit}} resolves to the unit name of the downstream proxied unit; to avoid issues when used together with the Host directive or similar, the slash character between application name and unit index is replaced by a dash.
For example, given a downstream unit called
prometheus/0
in thecos
model, the following:Host(
foo.bar/{{juju_unit}}-{{juju_model}}
)would evaluate to:
Host(
foo.bar/cos-prometheus-0
)If the host is omitted, but the root_url is provided, the charm will extract the hostname from the url and generate a Host rule for you. root_url=
http://{{juju_unit}}.bar.baz:80/qux
--> rule=Host({{juju_unit}}.bar.baz
)