-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Use exec in registryctl so signals are passed properly #16642
Conversation
Signed-off-by: Mac Chaffee <machaffe@renci.org>
Friendly bump :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx, this was super annoying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Codecov Report
@@ Coverage Diff @@
## main #16642 +/- ##
==========================================
+ Coverage 67.31% 67.33% +0.01%
==========================================
Files 953 968 +15
Lines 79028 81132 +2104
Branches 2331 2550 +219
==========================================
+ Hits 53198 54630 +1432
- Misses 22259 22823 +564
- Partials 3571 3679 +108
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Signed-off-by: Mac Chaffee <machaffe@renci.org>
So it seems that code for handing graceful shutdown might be bugged: harbor/src/registryctl/main.go Line 72 in 77df4d9
When registryctl receives SIGTERM, it just logs the following but doesn't actually shut down:
The bug isn't obvious to me as a golang novice, but is there some context we're not cancelling or a goroutine still running or something? |
When containers are terminated in Kubernetes, Kubernetes will send a SIGTERM to PID1, wait for terminationGracePeriodSeconds, then SIGKILL it.
But since PID1 in registryctl is
bash
, that SIGTERM signal is not automatically passed to the registryctl process, forcing Kubernetes to wait the whole terminationGracePeriodSeconds to update the registry Pod.This PR fixes that issue by using
exec
, which makesregistryctl
itself be PID1 so that it receives the SIGTERM signal.Wasn't able to test this locally, I think the build system needs some TLC, especially for testing individual components. Like for example, I need a local copy of
registry
to build the registryctl image which is downloaded fromhttps://storage.googleapis.com/harbor-builds/bin/registry/release-v2.8.0-patch-redis/registry
, but that URL 404s.