operator-framework / operator-registry

Operator Registry runs in a Kubernetes or OpenShift cluster to provide operator catalog data to Operator Lifecycle Manager.
Apache License 2.0
212 stars 248 forks source link

explicitly handle SIGINT and SIGTERM #1448

Closed joelanford closed 2 months ago

joelanford commented 2 months ago

Description of the change:

This PR adds explicit handling for SIGINT and SIGTERM, so that we can catch those signals and propagate them via a Go context to long running processes in order to perform a graceful shutdown.

Motivation for the change:

Temporary files are being left behind because defer statements are not executed when these signals are not caught and handled by the program. This PR ensures that we run defer statements prior to exiting.

Reviewer Checklist

openshift-ci[bot] commented 2 months ago

Skipping CI for Draft Pull Request. If you want CI signal for your change, please convert it to an actual PR. You can still manually trigger a test run with /test all

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 48.53%. Comparing base (1f9e725) to head (6a917e9). Report is 15 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #1448 +/- ## ========================================== + Coverage 48.47% 48.53% +0.05% ========================================== Files 136 135 -1 Lines 12814 12800 -14 ========================================== Hits 6212 6212 + Misses 5561 5547 -14 Partials 1041 1041 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

openshift-ci[bot] commented 2 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: joelanford, perdasilva

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/operator-framework/operator-registry/blob/master/OWNERS)~~ [joelanford,perdasilva] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment
grokspawn commented 2 months ago

/lgtm