Improve droplet upload draining - #245
Merged
Merged
Conversation
kathap
marked this pull request as draft
July 18, 2025 07:24
This was referenced Jul 18, 2025
kathap
force-pushed
the
improve-droplet-upload-draining
branch
2 times, most recently
from
July 21, 2025 13:06
07c903e to
b5eddc1
Compare
kathap
marked this pull request as ready for review
July 24, 2025 07:05
kathap
marked this pull request as draft
July 29, 2025 14:54
kathap
marked this pull request as ready for review
July 30, 2025 14:21
jochenehret
reviewed
Aug 8, 2025
jochenehret
left a comment
There was a problem hiding this comment.
Looks good in general, but I still had some questions...
kathap
marked this pull request as draft
August 14, 2025 08:01
kathap
marked this pull request as ready for review
August 15, 2025 09:39
kathap
force-pushed
the
improve-droplet-upload-draining
branch
from
August 15, 2025 14:23
fceb7cf to
a5b111a
Compare
peanball
reviewed
Aug 26, 2025
peanball
left a comment
There was a problem hiding this comment.
A few comments on the Go code, as requested. I've primarily looked at the changes and new code, not at the existing structure/usage patterns.
In main.go signal handler: • Refactor main into smaller funcs: createShutdownSignal, configureServers, waitForDrainingToFinish for clearer flow and easier testing. • Introduce -shutdownTimeoutInMinutes flag (default 15m) to bound graceful shutdown time. • Switch shutdown strategy to Ifrit-only: send os.Interrupt to the group to stop accepting new conns, then wait up to the timeout for in‑flight uploads to complete by racing uploadWaitGroup.Wait() against timeout. • Remove direct http.Server management and Server.Shutdown calls; initializeServer now returns an ifrit.Runner only. • Keep existing TLS/non-TLS behavior and debug server; preserve TLS12 + cipher suite settings. • Replace deprecated ioutil.ReadFile with os.ReadFile. In upload_droplet.ServeHTTP: • Retain existing logging and WaitGroup tracking for in-flight requests. • replace deprecated CloseNotifier with context-based cancellation: • Enhance per-request flow, introduce context.WithTimeout(r.Context(), timeout) to produce a single ctx.Done() channel that: • Cancels when the client disconnects (r.Context()). • Cancels when the configured timeout elapses. Co-Authored-By: serdarozerr <serdarozer14@gmail.com>
kathap
force-pushed
the
improve-droplet-upload-draining
branch
from
September 10, 2025 19:03
3fd0a4c to
8b2b068
Compare
jochenehret
previously approved these changes
Sep 15, 2025
jochenehret
self-requested a review
September 16, 2025 13:00
jochenehret
approved these changes
Sep 16, 2025
ari-wg-gitbot
added a commit
to cloudfoundry/capi-release
that referenced
this pull request
Sep 16, 2025
Changes in code.cloudfoundry.org/cc-uploader:
- Improve droplet upload draining
PR: cloudfoundry/cc-uploader#245
Author: Katharina Przybill <30441792+kathap@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In
main.gosignal handler:• Refactor main into smaller funcs: createShutdownSignal, configureServers, waitForDrainingToFinish for clearer flow and easier testing.
• Introduce -shutdownTimeoutInMinutes flag (default 15m) to bound graceful shutdown time.
• Switch shutdown strategy to Ifrit-only: send os.Interrupt to the group to stop accepting new conns, then wait up to the timeout for in‑flight uploads to complete by racing uploadWaitGroup.Wait() against timeout.
• Remove direct http.Server management and Server.Shutdown calls; initializeServer now returns an ifrit.Runner only.
• Keep existing TLS/non-TLS behavior and debug server; preserve TLS12 + cipher suite settings.
• Replace deprecated ioutil.ReadFile with os.ReadFile.
In
upload_droplet.ServeHTTP:• Retain existing logging and WaitGroup tracking for in-flight requests.
• replace deprecated CloseNotifier with context-based cancellation:
• Enhance per-request flow, introduce
context.WithTimeout(r.Context(), timeout)to produce a singlectx.Done()channel that:• Cancels when the client disconnects (
r.Context()).• Cancels when the configured timeout elapses.
This ensures that ongoing droplet uploads finish cleanly while preventing new requests during shutdown.
Related PRs:
cloudfoundry/capi-release#562
Related issue:
cloudfoundry/cloud_controller_ng#4351