-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ingress support #117
Add ingress support #117
Conversation
Neither ingress-per-unit nor ingress-per-app do precisely what Grafana needs in order to keep sqlite in a reasonable state, but the TraefikRoute libraries, as long as we ignore the work done by the actual `traefik-route-k8s` charm entirely, provide an interface via which we can send "raw" Traefik config snippets to ingress. `web-external-url` was already an available config option used by the load tests, so it is reasonably exercised and tested already, and matches the existing expected semantics for ingress on other charms. If a relation is established to Traefik without `web-external-url` being set, the Grafana leader will configure Traefik with a route which points to `{model}-{app.name}` publicly, which will use the `{app}-{unit_num}-{endpoints}` binding Juju gives us in order to forward external traffic to the leader. If `web-external-url` is set, use that, with the same internal endpoints as above. On leadership election, rewrite the route so it points at the correct leader. Similarly, if a config change sets `web-external-url`, use that. Since `TraefikRouteRequirer` has a non-optional `Relation` as part of the constructor, _also_ configure ingress if a relation is established during the middle of a charm lifecycle after setting a private variable in the library.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change introduces a few crutches that should ideally be streamlined.
It's not pleasant to look at, but not blocking either.
Not here. For For the specific Grafana use case, it's inverted, and Grafana "knows" the ingress address as either |
Neither ingress-per-unit nor ingress-per-app do precisely what
Grafana needs in order to keep sqlite in a reasonable state, but
the TraefikRoute libraries, as long as we ignore the work done by
the actual
traefik-route-k8s
charm entirely, provide an interfacevia which we can send "raw" Traefik config snippets to ingress.
web-external-url
was already an available config option used bythe load tests, so it is reasonably exercised and tested already,
and matches the existing expected semantics for ingress on other
charms.
Issue
Ingress!
Solution
If a relation is established to Traefik without
web-external-url
being set, the Grafana leader will configure Traefik with a route
which points to
{model}-{app.name}
publicly, which will use the{app}-{unit_num}-{endpoints}
binding Juju gives us in order toforward external traffic to the leader.
If
web-external-url
is set, use that, with the same internalendpoints as above.
On leadership election, rewrite the route so it points at the
correct leader. Similarly, if a config change sets
web-external-url
,use that.
Since
TraefikRouteRequirer
has a non-optionalRelation
as partof the constructor, also configure ingress if a relation is
established during the middle of a charm lifecycle after setting
a private variable in the library.
Testing Instructions
Relate to traefik, make sure it's accessible.
Release Notes
Add ingress support to Grafana