-
Notifications
You must be signed in to change notification settings - Fork 3
/
config.yaml
68 lines (52 loc) · 2.66 KB
/
config.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Copyright 2022 pietro
# See LICENSE file for licensing details.
options:
rule:
default:
description: >
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 the `cos` 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`)
type: string
root_url:
default:
description: >
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 called `prometheus/0` in the `cos` 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"
type: string