---
title: "Charmhub | Deploy traefik-route-k8s\n using Charmhub - The Open Operator Collection"
description: "Deploy the latest version of traefik-route-k8s\n on any cloud."
url: https://charmhub.io/traefik-route-k8s/libraries/traefik_route
---

# traefik-route-k8s

[Canonical Observability](https://charmhub.io/publisher/observability "View all packages from Canonical Observability")

* [Canonical Observability](https://charmhub.io/publisher/observability "View all packages from Canonical Observability")

Platform:

20.04

stable 23

```
juju deploy traefik-route-k8s
```

[Learn to deploy on juju >](https://juju.is/docs/juju/manage-applications)

[Toggle side navigation](https://charmhub.io/traefik-route-k8s/libraries/traefik_route#drawer)

## charms.traefik\_route\_k8s.v0.traefik\_route

* [*Docstrings*Docstrings](https://charmhub.io/traefik-route-k8s/libraries/traefik_route)
  [*Code*Source code](https://charmhub.io/traefik-route-k8s/libraries/traefik_route/source-code)
* + Download

    Fetch library

    ```
    charmcraft fetch-lib charms.traefik_route_k8s.v0.traefik_route
    ```

    [Download traefik\_route.py](https://charmhub.io/traefik-route-k8s/libraries/traefik_route/download)
  + *Last updated* 18 Sep 2024
  + *Revision* Library version 0.11

#### [DEPRECATED!] Interface Library for traefik\_route.

This is a DEPRECATED version of the traefik\_route interface library.

It was dropped and no longer maintained under `traefik-route-k8s-operator`, which will soon be archived.

traefik\_route v0 is now maintained under `traefik-k8s-operator`.

Please fetch the new library with `charmcraft fetch-lib charms.traefik_k8s.v0.traefik_route`.

---

Index

* [class TraefikRouteException](https://charmhub.io/traefik-route-k8s/libraries/traefik_route#traefikrouteexception)
* [class UnauthorizedError](https://charmhub.io/traefik-route-k8s/libraries/traefik_route#unauthorizederror)
* [class TraefikRouteProviderReadyEvent](https://charmhub.io/traefik-route-k8s/libraries/traefik_route#traefikrouteproviderreadyevent)
* [class TraefikRouteProviderDataRemovedEvent](https://charmhub.io/traefik-route-k8s/libraries/traefik_route#traefikrouteproviderdataremovedevent)
* [class TraefikRouteRequirerReadyEvent](https://charmhub.io/traefik-route-k8s/libraries/traefik_route#traefikrouterequirerreadyevent)
* [class TraefikRouteRequirerEvents](https://charmhub.io/traefik-route-k8s/libraries/traefik_route#traefikrouterequirerevents)
* [class TraefikRouteProviderEvents](https://charmhub.io/traefik-route-k8s/libraries/traefik_route#traefikrouteproviderevents)
* [class TraefikRouteProvider](https://charmhub.io/traefik-route-k8s/libraries/traefik_route#traefikrouteprovider)
* + [def \_\_init\_\_(
    self,
    charm,
    relation\_name,
    external\_host)](https://charmhub.io/traefik-route-k8s/libraries/traefik_route#traefikrouteprovider-__init__)
* + [def external\_host(
    self)](https://charmhub.io/traefik-route-k8s/libraries/traefik_route#traefikrouteprovider-external_host)
* + [def scheme(
    self)](https://charmhub.io/traefik-route-k8s/libraries/traefik_route#traefikrouteprovider-scheme)
* + [def relations(
    self)](https://charmhub.io/traefik-route-k8s/libraries/traefik_route#traefikrouteprovider-relations)
* + [def update\_traefik\_address(
    self)](https://charmhub.io/traefik-route-k8s/libraries/traefik_route#traefikrouteprovider-update_traefik_address)
* + [def is\_ready(
    self,
    relation)](https://charmhub.io/traefik-route-k8s/libraries/traefik_route#traefikrouteprovider-is_ready)
* + [def get\_config(
    self,
    relation)](https://charmhub.io/traefik-route-k8s/libraries/traefik_route#traefikrouteprovider-get_config)
* + [def get\_dynamic\_config(
    self,
    relation)](https://charmhub.io/traefik-route-k8s/libraries/traefik_route#traefikrouteprovider-get_dynamic_config)
* + [def get\_static\_config(
    self,
    relation)](https://charmhub.io/traefik-route-k8s/libraries/traefik_route#traefikrouteprovider-get_static_config)
* [class TraefikRouteRequirer](https://charmhub.io/traefik-route-k8s/libraries/traefik_route#traefikrouterequirer)
* + [def \_\_init\_\_(
    self,
    charm,
    relation,
    relation\_name)](https://charmhub.io/traefik-route-k8s/libraries/traefik_route#traefikrouterequirer-__init__)
* + [def external\_host(
    self)](https://charmhub.io/traefik-route-k8s/libraries/traefik_route#traefikrouterequirer-external_host)
* + [def scheme(
    self)](https://charmhub.io/traefik-route-k8s/libraries/traefik_route#traefikrouterequirer-scheme)
* + [def is\_ready(
    self)](https://charmhub.io/traefik-route-k8s/libraries/traefik_route#traefikrouterequirer-is_ready)
* + [def submit\_to\_traefik(
    self,
    config,
    static)](https://charmhub.io/traefik-route-k8s/libraries/traefik_route#traefikrouterequirer-submit_to_traefik)

#### class TraefikRouteException

Description

Base class for exceptions raised by TraefikRoute. None

#### class UnauthorizedError

Description

Raised when the unit needs leadership to perform some action. None

#### class TraefikRouteProviderReadyEvent

Description

Event emitted when Traefik is ready to provide ingress for a routed unit. None

#### class TraefikRouteProviderDataRemovedEvent

Description

Event emitted when a routed ingress relation is removed. None

#### class TraefikRouteRequirerReadyEvent

Description

Event emitted when a unit requesting ingress has provided all data Traefik needs. None

#### class TraefikRouteRequirerEvents

Description

Container for TraefikRouteRequirer events. None

#### class TraefikRouteProviderEvents

Description

Container for TraefikRouteProvider events. None

#### class TraefikRouteProvider

Implementation of the provider of traefik\_route.

Description

This will presumably be owned by a Traefik charm.
The main idea is that Traefik will observe the `ready` event and, upon
receiving it, will fetch the config from the TraefikRoute's application databag,
apply it, and update its own app databag to let Route know that the ingress
is there.
The TraefikRouteProvider provides api to do this easily.

Methods

TraefikRouteProvider.
\_\_init\_\_(

*self*

,
charm: CharmBase

,
relation\_name: str

,
external\_host: str
)

Constructor for TraefikRouteProvider.

Arguments

charm

The charm that is instantiating the instance.

relation\_name

The name of the relation relation\_name to bind to
(defaults to "traefik-route").

external\_host

The external host.

scheme

The scheme.

TraefikRouteProvider.
external\_host(

*self*
)

Description

Return the external host set by Traefik, if any. None

TraefikRouteProvider.
scheme(

*self*
)

Description

Return the scheme set by Traefik, if any. None

TraefikRouteProvider.
relations(

*self*
)

Description

The list of Relation instances associated with this endpoint. None

TraefikRouteProvider.
update\_traefik\_address(

*self*
)

Description

Ensure that requirers know the external host for Traefik. None

TraefikRouteProvider.
is\_ready(

*self*

,
relation: Relation
)

Whether TraefikRoute is ready on this relation.

Description

Returns True when the remote app shared the config; False otherwise.

TraefikRouteProvider.
get\_config(

*self*

,
relation: Relation
)

Description

Renamed to `get_dynamic_config`. None

TraefikRouteProvider.
get\_dynamic\_config(

*self*

,
relation: Relation
)

Description

Retrieve the dynamic config published by the remote application. None

TraefikRouteProvider.
get\_static\_config(

*self*

,
relation: Relation
)

Description

Retrieve the static config published by the remote application. None

#### class TraefikRouteRequirer

Wrapper for the requirer side of traefik-route.

Description

The traefik\_route requirer will publish to the application databag an object like:
{
'config': <Traefik\_config>
'static': <Traefik\_config> # optional
}

NB: TraefikRouteRequirer does no validation; it assumes that the
traefik-route-k8s charm will provide valid yaml-encoded config.
The TraefikRouteRequirer provides api to store this config in the
application databag.

Methods

TraefikRouteRequirer.
\_\_init\_\_(

*self*

,
charm: CharmBase

,
relation: Relation

,
relation\_name: str
)

TraefikRouteRequirer.
external\_host(

*self*
)

Description

Return the external host set by Traefik, if any. None

TraefikRouteRequirer.
scheme(

*self*
)

Description

Return the scheme set by Traefik, if any. None

TraefikRouteRequirer.
is\_ready(

*self*
)

Description

Is the TraefikRouteRequirer ready to submit data to Traefik? None

TraefikRouteRequirer.
submit\_to\_traefik(

*self*

,
config: dict

,
static
)

Relay an ingress configuration data structure to traefik.

Description

This will publish to the traefik-route relation databag
a chunk of Traefik dynamic config that the traefik charm on the other end can pick
up and apply.

Use `static` if you need to update traefik's **static** configuration.
Note that this will force traefik to restart to comply.
