Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restart applications on binding/secret changes in an automated way #18601

Closed
a-thaler opened this issue Mar 7, 2024 · 5 comments
Closed

Restart applications on binding/secret changes in an automated way #18601

a-thaler opened this issue Mar 7, 2024 · 5 comments
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.

Comments

@a-thaler
Copy link
Contributor

a-thaler commented Mar 7, 2024

Description
The BTP Operator module provides a nice way of integration services with your workload. It defines a kubernetes Secret as the agreed interface, so the operator takes care that binding data gets injected into a well-defined secret and the workload just mounts the secret and can consume that data, no direct coupling. On top, the operator supports automatic secret rotation, resulting in an updating secret over time. The app just need to fetch the most recent binding data from the local mount.

However, not all applications are supporting a dynamic reload of credentials via the file system and will just fail after the rotated secret gets wiped out. Currently the SAP CAP application is falling under that category, a binding change will not get picked up.

As there is no trivial solution for such applications at hand, it will be great if the Kyma modules could provide some functionality to automatically restart such application on secret changes.

Reasons
It is not trivial to find a solution of restarting an app for changes secrets. It usually will require custom logic coded into an operator or job.

Attachments

@a-thaler
Copy link
Contributor Author

a-thaler commented Mar 7, 2024

Potential solution is to build an additional controller in the BTP Operator module which supports the scenario. In best case it is not complicating the things by building up relations between ServiceBindings and workloads but just allows to mark the secrets to watch and the related Deployment to rollout.

A solution like letting the app crash on secret updates so that kubernetes will do the restart will not help, as all pods would crash at the same time. However, the restart must happened coordinated using the rollout command to avoid downtimes.

For inspiration please also consider https://servicebinding.io/spec/core/1.0.0/#workload-resource-mapping which defines an explicit mapping of the binding to workloads.

@abbi-gaurav
Copy link
Member

We can check this OS project: https://github.com/stakater/Reloader if application restart would be the decision to be followed.

@abbi-gaurav
Copy link
Member

Currently, CAP supports consuming credentials via VolumeMounts which is K8s specific as compared to VCAP_SERVCIES which is CF native. These approaches are totally transparent to the developers.
Similarly, perhaps CAP should add further capabilities to auto consume new credentials once they become available.

Copy link

This issue has been automatically marked as stale due to the lack of recent activity. It will soon be closed if no further activity occurs.
Thank you for your contributions.

@github-actions github-actions bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label May 15, 2024
Copy link

This issue has been automatically closed due to the lack of recent activity.
/lifecycle rotten

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 23, 2024
@kyma-bot kyma-bot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed.
Projects
None yet
Development

No branches or pull requests

3 participants