apache / camel-k

Apache Camel K is a lightweight integration platform, born on Kubernetes, with serverless superpowers
https://camel.apache.org/camel-k
Apache License 2.0
848 stars 345 forks source link

Add route policy to wait for K_SINK injection #3532

Open christophd opened 1 year ago

christophd commented 1 year ago

This is related to #3522 where the integration pod fails right after the start because K_SINK has not been injected by Knative sink binding controller before the Camel route starts. So the Pod results in error state recovering once the K_SINK env var has been injected.

We should avoid the failure state by adding a route policy and a dedicated health check when the integration needs a K_SINK so in essence, the route policy would not start the route if the mentioned env var is not set and an health check could make the pod not ready.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale due to 90 days of inactivity. It will be closed if no further activity occurs within 15 days. If you think that’s incorrect or the issue should never stale, please simply write any comment. Thanks for your contributions!

christophd commented 1 year ago

Please mark as non stale because this one still is relevant

squakez commented 2 months ago

Is this still relevant today? I wonder if with the recent cleaning on Knative trait, this has cleared as well. Any possible way to double check please?

christophd commented 2 months ago

I think this is still a relevant case. I just had the situation yesterday that Knative eventing and serving was not ready on a cluster for some reason and the integration using K_SINK injection just went to error with non-intuitive error msg.

At least we need to review the error propagation in case K_SINK injection is missing for an integration. Maybe we can add a new IntegrationReady condition for that case.

I am planning to work on this soon

lburgazzoli commented 2 months ago

@christophd, I've added a readiness health check in the knative component, see https://github.com/apache/camel/blob/ec871bfddf4f5e88818b6b31f989719a7be52faa/components/camel-knative/camel-knative-component/src/main/java/org/apache/camel/component/knative/KnativeProducer.java#L120-L141

It is not active by default as the producer health check must be explicitly enabled on camel so I'm not sure if it is enough but maybe we can start from that.