Gateway API Integrator
Platform:
| Channel | Revision | Published | Runs on |
|---|---|---|---|
| latest/stable | 151 | 08 Apr 2026 | |
| latest/stable | 14 | 01 Jul 2024 | |
| latest/edge | 157 | 02 Jun 2026 | |
| latest/edge | 14 | 27 Jun 2024 |
juju deploy gateway-api-integrator
charms.gateway_api_integrator.v1.gateway_route
-
- Last updated 01 Jun 2026
- Revision Library version 1.0
gateway-route interface library v1.
This library implements the gateway-route interface.
The requirer publishes hostname information. The provider publishes gateway resource details (gateway name, model/namespace, HTTPS mode) so the requirer can reference the correct Gateway resource.
With the v1 interface, the requirer is expected to create and manage its own HTTP/TCP/UDP route resources referencing the provider's Gateway.
Getting Started
Fetch the library:
charmcraft fetch-lib charms.gateway_api_integrator.v1.gateway_route
Requirer usage
In the charmcraft.yaml of the charm, add the following:
requires:
gateway-route:
interface: gateway-route
from charms.gateway_api_integrator.v1.gateway_route import (
GATEWAY_ROUTE_RELATION_NAME,
GatewayRouteRequirer,
GatewayRouteProviderAppData,
)
class IngressConfiguratorCharm(CharmBase):
def __init__(self, *args):
super().__init__(*args)
self.gateway_route = GatewayRouteRequirer(self)
self.framework.observe(
self.on[GATEWAY_ROUTE_RELATION_NAME].relation_changed, self._on_gateway_route_changed
)
self.framework.observe(
self.on[GATEWAY_ROUTE_RELATION_NAME].relation_broken, self._on_gateway_route_changed
)
def _on_gateway_route_changed(self, event):
provider_data = self.gateway_route.get_provider_data()
if provider_data:
# Use provider_data.gateway_name, provider_data.gateway_model, provider_data.https_mode
...
Provider usage
In the charmcraft.yaml of the charm, add the following:
provides:
gateway-route:
interface: gateway-route
from charms.gateway_api_integrator.v1.gateway_route import (
GATEWAY_ROUTE_RELATION_NAME,
GatewayRouteProvider,
HttpsMode,
GatewayRouteRequirerAppData,
)
class GatewayAPIIntegratorCharm(CharmBase):
def __init__(self, *args):
super().__init__(*args)
self.gateway_route = GatewayRouteProvider(self)
self.framework.observe(
self.on[GATEWAY_ROUTE_RELATION_NAME].relation_changed, self._on_gateway_route_changed
)
self.framework.observe(
self.on[GATEWAY_ROUTE_RELATION_NAME].relation_broken, self._on_gateway_route_changed
)
def _on_gateway_route_changed(self, event):
requirer_data = self.gateway_route.get_requirer_data()
# requirer_data is a dict[int, GatewayRouteRequirerAppData]
# Use data.hostname, data.additional_hostnames
# Publish provider data to all valid relations
self.gateway_route.publish_provider_data(
gateway_name=self.app.name,
gateway_model=self.model.name,
https_mode=HttpsMode.ENFORCED,
)
Index
class GatewayRouteInvalidRelationDataError
Description
Raised when relation data validation for gateway-route fails. None
def valid_fqdn(value: str)
Validate if value is a valid FQDN (TLDs alone are not allowed).
Arguments
The value to validate.
class HttpsMode
HTTPS mode for the gateway.
Description
Attrs: DISABLED: TLS is not configured; only HTTP listener exists. ENABLED: TLS is configured; both HTTP and HTTPS listeners exist. ENFORCED: TLS is configured and enforce-https is true; HTTP redirects to HTTPS.
class GatewayRouteRequirerAppData
Requirer application databag schema.
Attributes
Description
The requirer provides hostname information so the provider can configure TLS certificates and DNS records.
class GatewayRouteProviderAppData
Provider application databag schema.
Attributes
Description
The provider publishes gateway resource details so the requirer can construct HTTPRoute resources referencing the correct Gateway.
class GatewayRouteProvider
Gateway-route interface provider implementation.
Description
The provider reads hostname data from requirers and publishes gateway resource information back.
Methods
GatewayRouteProvider. __init__( self , charm: CharmBase , relation_name: str )
Initialize the GatewayRouteProvider.
Arguments
The charm instance using this library.
The name of the relation endpoint.
GatewayRouteProvider. relations( self )
Description
All relations for this endpoint. None
GatewayRouteProvider. get_requirer_data( self )
Fetch requirer data from all relations.
Returns
Dictionary mapping relation ID to validated requirer data.
Description
Also stores the valid relations for use by publish_provider_data.
GatewayRouteProvider. publish_provider_data( self , gateway_name: str , gateway_model: str , https_mode: HttpsMode )
Publish gateway information to requirers with valid data.
Arguments
The name of the Gateway resource.
The Juju model (K8s namespace) of the Gateway resource.
The HTTPS mode for the gateway.
Description
Only publishes to relations previously validated by get_requirer_data.
class GatewayRouteRequirer
Gateway-route interface requirer implementation.
Description
The requirer provides hostname information and reads back gateway resource details from the provider.
Methods
GatewayRouteRequirer. __init__( self , charm: CharmBase , relation_name: str )
Initialize the GatewayRouteRequirer.
Arguments
The charm instance using this library.
The name of the relation endpoint.
GatewayRouteRequirer. relation( self )
Description
The relation instance for this endpoint. None
GatewayRouteRequirer. publish_requirer_data( self , hostname: str , additional_hostnames )
Publish hostname data to the provider.
Arguments
The hostname for the service.
Additional hostnames for the service.
GatewayRouteRequirer. get_provider_data( self )
Fetch provider application data from the relation.
Returns
Validated provider data or None if not yet available.