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

fix: daemon listen for SIGTERM and SIGINIT to gracefully clean up and shutdown #569

Closed
wants to merge 1 commit into from

Conversation

nddq
Copy link
Contributor

@nddq nddq commented Jul 29, 2024

Description

Closes #537. Explanation in issue.

Related Issue

If this pull request is related to any issue, please mention it here. Additionally, make sure that the issue is assigned to you before submitting this pull request.

Checklist

  • I have read the contributing documentation.
  • I signed and signed-off the commits (git commit -S -s ...). See this documentation on signing commits.
  • I have correctly attributed the author(s) of the code.
  • I have tested the changes locally.
  • I have followed the project's style guidelines.
  • I have updated the documentation, if necessary.
  • I have added tests, if applicable.

Screenshots (if applicable) or Testing Completed

Please add any relevant screenshots or GIFs to showcase the changes made.

Additional Notes

Add any additional notes or context about the pull request here.


Please refer to the CONTRIBUTING.md file for more information on how to contribute to this project.

@nddq nddq added type/fix Fixes something area/controllers labels Jul 29, 2024
@nddq nddq self-assigned this Jul 29, 2024
@nddq nddq requested a review from a team as a code owner July 29, 2024 20:25
go func() {
sig := <-sigChan
mainLogger.Info("Received signal, stopping controller manager", zap.String("signal", sig.String()))
controllerMgr.Stop(ctx)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's cleaner to pass the context to (everything), and then cancel the context in the signal handler to cause cascading graceful shutdown.
controller-runtime also provides a cross-platform helper which we could use.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok nvm, apparently, we are using SetupSignalHandler and passing down the returned ctx already 🥲, and also TIL it is not a good idea to test with kill -9

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't catch that one

@nddq nddq closed this Aug 2, 2024
@nddq nddq deleted the fix/ebpfMapCleanup branch August 16, 2024 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Stale ebpf maps if agent stops abruptly
2 participants