elastic / fleet-server

The Fleet server allows managing a fleet of Elastic Agents.
Other
82 stars 81 forks source link

checkin API should return 503 error when it fails to communicate properly with elasticsearch #3930

Closed blakerouse closed 2 days ago

blakerouse commented 2 days ago

Currently it seems that Fleet Server is returning a 401 error when performing agent checkins and Fleet Server cannot communicate properly with Elastic Agent. This causes the Elastic Agents to go into automatical unenrollment which is bad (and requires a manual restart of Elastic Agent). Instead it should be returning a 503 error until its able to start communicating with elasticsearch properly.

I believe the issue is this code here: https://github.com/elastic/fleet-server/blob/main/internal/pkg/apikey/auth.go#L54-L60

blakerouse commented 2 days ago

Duplicate of #3929