Skip to content
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

ready_for_unit is emitted too early #78

Open
sed-i opened this issue Aug 15, 2022 · 1 comment
Open

ready_for_unit is emitted too early #78

sed-i opened this issue Aug 15, 2022 · 1 comment

Comments

@sed-i
Copy link
Contributor

sed-i commented Aug 15, 2022

Bug Description

Currently, ready_for_unit is emitted based on relation events only:

if this_unit_name in changed:
self.on.ready_for_unit.emit( # type: ignore
self.relation, current_urls[this_unit_name]
)

This is racy with the traefik workload: sometimes the remote app processes the event before traefik workload is in fact ready.

To Reproduce

Relate prometheus and traefik.

Environment

  • traefik-k8s edge 84

Relevant log output

# Prometheus gets the "ready-for-unit" event, but http requests still fail

Ingress for unit ready on 'http://pd-ssd-4cpu-8gb.us-central1-a.c.lma-light-load-testing.internal:80/cos-lite-load-test-prometheus-0'

config reload error via http://localhost:9090/cos-lite-load-test-prometheus-0/-/reload: HTTPConnectionPool(host='localhost', port=9090): Read timed out. (read timeout=2.0)


# After a while update-status fires, at which point the traefik workload is really ready and http reqs to prom work

Emitting Juju event update_status.

Starting new HTTP connection (1): localhost:9090
http://localhost:9090 "GET /cos-lite-load-test-prometheus-0/api/v1/status/buildinfo HTTP/1.1" 200 188

Additional context

No response

@PietroPasotti
Copy link
Contributor

todo: look at canonical/observability-libs#10 and consider implementing some liveness check by using that external process to wake up the charm when "traefik is done", and only then publish the relation data to tell "ingress is ready"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants