Closed sed-i closed 2 weeks ago
When I removed the relation between prometheus and traefik, I noticed that web.external-url still has the ingress path. This is because in prometheus we use self.ingress.url (IngressPerUnitRequirer.url), which in turn uses _urls_from_relation_data.
web.external-url
self.ingress.url
IngressPerUnitRequirer.url
_urls_from_relation_data
However, on relation broken, relation data can be misleading. https://github.com/canonical/traefik-k8s-operator/blob/f6b150f1da2aa83da74c7eae28b35b4048fb8270/lib/charms/traefik_k8s/v1/ingress_per_unit.py#L726-L728
Luckily, in _handle_relation, the requirer already has up to date information:
_handle_relation
def _handle_relation(self, event: RelationEvent): # ... self._stored.current_urls = current_urls # ... self.on.revoked.emit(self.relation, unit_name)
All we need to do™ is also look at self._stored.current_urls inside IngressPerUnitRequirer.url.
self._stored.current_urls
prom - trfk
Juju 3.2.0. Latest charms.
NTA.
No response
With recent ops, relation data should be hidden on relation broken.
We certainly have a recent enough version of ops by now.
Bug Description
When I removed the relation between prometheus and traefik, I noticed that
web.external-url
still has the ingress path. This is because in prometheus we useself.ingress.url
(IngressPerUnitRequirer.url
), which in turn uses_urls_from_relation_data
.However, on relation broken, relation data can be misleading. https://github.com/canonical/traefik-k8s-operator/blob/f6b150f1da2aa83da74c7eae28b35b4048fb8270/lib/charms/traefik_k8s/v1/ingress_per_unit.py#L726-L728
Luckily, in
_handle_relation
, the requirer already has up to date information:All we need to do™ is also look at
self._stored.current_urls
insideIngressPerUnitRequirer.url
.To Reproduce
prom - trfk
.Environment
Juju 3.2.0. Latest charms.
Relevant log output
Additional context
No response