feat(dir): add wait check to dependencies for apiserver - #1747
feat(dir): add wait check to dependencies for apiserver#1747arpad-csepi wants to merge 2 commits into
Conversation
8292400 to
d0511f0
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Although I understand the rationale, but is this really an issue? Kubernetes will sometimes deploy services not in order and will cause API server to crash, but it will be restarted until it's deployed and actually ready. |
In this case when Kubernetes deployment is ongoing, it cause unnecessary noise in form of log spamming and restart count increase. It is not ideal specially on version upgrade to have these kind of distractions, but I can understand the eventually consistent concept behind Kubernetes too. However this solution covers deployment outside of Kubernetes where this consistent concept are not there, like docker, native, etc... Do you think this "standardized" health check is worth it to have (in every environment) even if not aligned with Kubernetes consistent concept? Do you favor to handle the health checks for every type of environment instead? |
|
I think a "retry" mechanism could be useful, not only during initialization but also while the program is running. That's why I would make it much more generic. The logic/process itself is almost the same for any resource.
|
cadbfdc to
a2dd6d1
Compare
Signed-off-by: Árpád Csepi <csepi.arpad@outlook.com>
a2dd6d1 to
5d69a22
Compare
@tkircsi @ramizpolic |
Signed-off-by: Árpád Csepi <csepi.arpad@outlook.com>
5d69a22 to
07c88b2
Compare
Both the API server and the reconciler previously assumed their dependencies (PostgreSQL and the OCI registry) were already reachable the moment the process started. In Kubernetes environments where pod scheduling is not strictly ordered, this caused crash-loops during initial deploy/rolling restarts: the service failed on first connection attempt and the pod restarted before dependencies came up.
This PR introduces a configurable startup-wait mechanism. Before establishing any connections, each process probes its required dependencies and retries with exponential backoff until they become ready or a configurable timeout is reached. The behavior is opt-in via Helm values now and can be enabled per-dependency but should not broke any existing deployment workflow if opt-out (needs feedback, my preference opt-out).
An alternative solution can be implemented with Kubernetes init-containers but this approach is environment independent.