fix: make local docker uploads replica-independent #104
Reference in New Issue
Block a user
Delete Branch "benvin/docker-upload-sessions-s3"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
Chunked blob uploads kept the in-progress session in process memory keyed by upload UUID, so the
POST/PATCH/PUTof a singledocker pushhad to land on the same replica. The API runs atminReplicas: 2with no session affinity (see argocd-appsapi-hpa.yaml), so a real push — which streams the layer viaPATCHthen finalises withPUT— intermittently 404s withBLOB_UPLOAD_UNKNOWNwhen a chunk hits a replica that never saw thePOST. This was flagged when the local docker registry landed (#103).Changes
uploads/<uuid>instead of an in-memory temp file. The UUID travels in theLocationURL handed to the client, so any replica reconstructs the staging key with no shared in-process state. Finalise streams the staged bytes plus any trailingPUTbody through the CAS in one pass; monolithic uploads are unchanged.DELETEof an in-progress upload (cancel) by dropping its staging object.uploads/older than 24h) via a newS3.ListStaleObjects, so cancelled/interrupted pushes don't leak.Verification
POST→A,PATCH→B,PUT→A finalises with the correct digest, and the blob pulls back byte-identical from both replicas. Config-blob and manifest pushes split the same way succeed;tags/listis correct. (Pre-fix, the cross-replicaPATCH404s.)scripts/docker-e2e.shstill passes (incl.TestLocalDockerPushPull); unit tests +go vetclean.