Does Http4kK8sServer’s start() method wait for the main app to start before starting the health server?
d
dave
02/10/2023, 6:19 AM
No, it doesn't. TBH we've never found this it be a problem as http4k generally starts in milliseconds instead of the seconds which you might see in <insert world's most popular lib here/>, and especially as you can configure K8S with timeouts to for when to start polling for readiness .
You can always write your own version if you really need to - it's literally only a couple of lines of code! 🙃
https://github.com/http4k/http4k/blob/master/http4k-cloudnative/src/main/kotlin/org/http4k/cloudnative/Http4kK8sServer.kt
What's the usecase you need it to wait for?
a
Asif Ahmed
02/10/2023, 6:26 AM
Thanks @dave,
I was wondering, The health server starts allowing kubernetes to start sending traffic but the appServer is not up yet. That might cause errors.
but in logs mostly i see app server is started first and later health server
d
dave
02/10/2023, 6:28 AM
You can use the readiness checks to determine if a server should be sent traffic by K8s.
a
Asif Ahmed
02/10/2023, 6:43 AM
Yeah , I have simple readiness check in place , but just wanted to confirm