Repository navigation
feat(placement): reconcile RGW across the cluster - #889
Open
johnramsden wants to merge 1 commit into
Open
johnramsden wants to merge 1 commit into
johnramsden wants to merge 1 commit into
Conversation
johnramsden
added this pull request to stack #894
September 23, 2026 04:20
This was referenced Sep 23, 2026
This was referenced Sep 23, 2026
johnramsden
marked this pull request as ready for review
September 23, 2026 04:30
johnramsden
marked this pull request as draft
September 23, 2026 06:23
johnramsden
marked this pull request as ready for review
September 23, 2026 06:25
johnramsden
force-pushed
the
rgw-stack/09-reconcile
branch
2 times, most recently
from
September 24, 2026 19:32
2397974 to
df46e92
Compare
johnramsden
force-pushed
the
rgw-stack/09-reconcile
branch
from
September 29, 2026 18:43
df46e92 to
59dd35e
Compare
johnramsden
force-pushed
the
rgw-stack/09-reconcile
branch
from
September 29, 2026 19:50
59dd35e to
02c8c88
Compare
johnramsden
force-pushed
the
rgw-stack/09-reconcile
branch
from
October 1, 2026 22:24
02c8c88 to
57e3744
Compare
This is where the feature turns on end to end, from PUT /1.0/placement through to a member dispatch. reconcilePlacement now calls the new applyRgwPlacement once the control services (mon, mgr, mds) are settled, so control quorum is established before any gateway moves. applyRgwPlacement splits the policy's members into those with rgw.enabled=true and those with enabled=false, sorted for a deterministic dispatch order, and calls enableRgwServiceFunc for every enable, collecting failures instead of stopping at the first. If any enable failed it returns without disabling anything, naming the disables it held back, so a migration never stops the old gateway before the new one serves -- the commit message's own words for the invariant. Only when every enable succeeds does it move to the disable loop, which runs unconditionally and collects failures the same way: RGW has no keep-one rule, so a pure scale-to-zero is allowed, unlike mon/mgr/mds. Error classes cross the network boundary here: rgwDispatchFailure treats a forwarded HTTP 400 from the member's own serviceErrorResponse (added inert in "fix(services): keep error classes through the service enable path") as client-classified, and everything else, an unreachable member, a failed start, a failed teardown, as operational. rgwAggregateError then returns ErrRgwFrontendInvalid only when every collected failure was a forwarded 400, and ErrPlacementOperationFailed the instant any failure was not, so a genuinely mixed batch answers 500, never 400. retainRefusals appends an earlier keep-one refusal from the control pass to a later failure, including a failed control removal, so the reported reason names both instead of one silently replacing the other. cmdPlacementPut checks ErrPlacementOperationFailed first, ahead of the existing client-error ladder, so that combination still answers 500. cmd/microcephd/prod_wiring.go wires the two hooks, each a fail-closed default: with no production implementation assigned, the outer function returns an explicit error naming the member rather than silently reporting success, so a daemon binary that forgets to wire one cannot hide the gap. prodEnableRgwServiceFunc first calls the new client.CheckRGWPlacementSupport, which asks the target member's own GET /1.0/cluster/capabilities for "placement-rgw" and fails closed with 400 if it is missing -- an older member would otherwise ignore ssl and could turn a TLS retry into plaintext. That capabilities endpoint becomes ProxyTarget so it can be asked of another member, not only whichever one answered this request. prodRemoveRgwServiceFunc runs no such check: a removal carries no TLS intent, so there is nothing an older member could silently downgrade. api/capabilities.go advertises "placement-rgw" from this commit on, since this is the commit that starts acting on the field, not the one that defined it. Two later branches only add proof and documentation on top of this, nothing functional: the single-VM and three-VM Robot suites in "test(robot): add the single-VM RGW placement suite" and "test(robot): add the three-VM RGW placement suite" exercise this reconciler against a real snap and a real gateway, and the HACKING.md write-up lands after the behaviour it documents already exists. Co-authored-by: Peter Sabaini <peter.sabaini@canonical.com> Assisted-by: claude-code:claude-fable-5-1 Assisted-by: pi:gpt-6-astra Signed-off-by: John Ramsden <john.ramsden@canonical.com>
johnramsden
force-pushed
the
rgw-stack/09-reconcile
branch
from
October 6, 2026 00:47
57e3744 to
24e2bdf
Compare
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.
Description
This is where the feature turns on end to end, from
PUT /1.0/placementthrough to a member dispatch.reconcilePlacementnow calls the newapplyRgwPlacementonce the control services (mon, mgr, mds) are settled, so control quorum is established before any gateway moves.applyRgwPlacementsplits the policy's members into those withrgw.enabled=trueand those withenabled=false, sorted for a deterministic dispatch order, and callsenableRgwServiceFuncfor every enable, collecting failures instead of stopping at the first. If any enable failed it returns without disabling anything, so a migration never stops the old gateway before the new one serves. Only when every enable succeeds does it move to the disable loop, which runs unconditionally: RGW has no keep-one rule, so a pure scale-to-zero is allowed, unlike mon/mgr/mds.Error classes cross the network boundary here:
rgwDispatchFailuretreats a forwarded HTTP 400 from the member's ownserviceErrorResponseas client-classified, and everything else — an unreachable member, a failed start, a failed teardown — as operational.rgwAggregateErrorthen returnsErrRgwFrontendInvalidonly when every collected failure was a forwarded 400, andErrPlacementOperationFailedthe instant any failure was not, so a genuinely mixed batch answers 500, never 400.retainRefusalsappends an earlier keep-one refusal from the control pass to a later failure, so the reported reason names both instead of one silently replacing the other.prod_wiring.gowires the production hooks, each a fail-closed default: with no implementation assigned, the outer function returns an explicit error naming the member rather than silently reporting success.prodEnableRgwServiceFuncfirst callsclient.CheckRGWPlacementSupport, which asks the target member's ownGET /1.0/cluster/capabilitiesforplacement-rgwand fails closed with 400 if it is missing — an older member would otherwise ignoressland could turn a TLS retry into plaintext.api/capabilities.goadvertisesplacement-rgwfrom this commit on, since this is the commit that starts acting on the field.Stack: PR 9 of 13. Merge in order. Each PR is one logical change on top of the one before it.
Reviewer note: two later PRs in this stack only add proof and documentation on top of this, nothing functional — the single-VM and three-VM Robot suites exercise this reconciler against a real snap and a real gateway, and the HACKING.md write-up lands after the behaviour it documents already exists.
Type of change
How has this been tested?
Contributor checklist
Please check that you have: