How to wait for the webhook to be ready?
We're installing the CNPG Helm chart via a dependencies chart prior to the application workload chart. If installed manually, all works as expected. When installed in an automated fashion though, we're seeing the following error message when installing the app chart:
Internal error occurred: failed calling webhook "mcluster.cnpg.io": failed to call webhook: Post "https://cnpg-webhook-service.galaxy-deps.svc:443/mutate-postgresql-cnpg-io-v1-cluster?timeout=10s": no endpoints available for service "cnpg-webhook-service"
If we add a wait task for the cloudnative-pg pod to enter ready state before installing the app chart, things work as expected again. However, this seems like it should be handled by the CNPG chart instead of each deployment having to deal with it, no?
I've tried setting the initialDelaySeconds on the CNPG webhook to a longer value (15 seconds) but nothing changes. I've also tried setting timeoutSeconds variable for the webhook but nothing happens (seems to me this variable isn't exposed in the CNPG chart perhaps).
For the time being, I've added a wait pod to our dependencies chart but this still does not seem like the right solution so am wondering if you have any recommendations here?