Skip to content

Remove the Witness DC role; collapse to Member and Arbiter - #51

Closed
tamalsaha wants to merge 3 commits into
masterfrom
remove-witness-role
Closed

Remove the Witness DC role; collapse to Member and Arbiter#51
tamalsaha wants to merge 3 commits into
masterfrom
remove-witness-role

Conversation

@tamalsaha

Copy link
Copy Markdown
Contributor

The DC failover topology has exactly two kinds of data center:

  • Member: holds data, votes, primary-eligible.
  • Arbiter: empty replicaIndices, holds no data, never primary, votes for tie-breaking (runs the dr-controlplane failover service, plus for geo-quorum engines a data-less engine voter the operator places there).

The Witness role meant "a third DC that holds data but is never primary," and that case no longer exists: a third site is either a data-less Arbiter or a full Member, and MongoDB's third-site vote is a data-less arbiter in the Arbiter DC, not a data-bearing member. Witness was only just added (this branch) and has never shipped, so removing the enum value breaks nothing in use.

Changes

  • DCRole: drop the DCRoleWitness constant, the +kubebuilder:validation:Enum value, and the doc lines (enum is now Member;Arbiter).
  • ClusterSpreadConstraint.Validate(): drop the witnesses counter and the Witness branch; TwoDC now requires exactly two Members and at least one Arbiter (error text updated).
  • Webhook comment and the FailoverModeTwoDC / FailoverPolicy.Mode comments updated to Member/Arbiter.
  • Regenerated the PlacementPolicy CRD (controller-gen): role enum drops Witness.
  • Added Validate tests: TwoDC requires an Arbiter, and a Witness role is now rejected as an unknown role.

Based on dc-dr-failover-policy (where the Role field was introduced; it is not yet on master). go build, go vet, and go test ./apis/... ./pkg/webhooks/... pass. dr-controlplane and the db operators re-vendor afterward in their own PRs.

Introduce a FailoverPolicy on ClusterSpreadConstraint and a per-rule
DCRole (Member/Arbiter/Witness) to model cross data center (DC/DR)
deployments. FailoverTrigger selects which primary-dc Lease a workload
follows (Global or per Group). Adds a Validate() helper for the
PlacementPolicy webhook and regenerates deepcopy + CRD manifests.

Signed-off-by: Tamal Saha <tamal@appscode.com>
…ation

ClusterSpreadConstraint.Validate() (the DC/DR failover-policy and per-DC role
checks: Member/Arbiter/Witness data-bearing rules, member count, mode vs role
counts, scope vs group) was defined but never called, so an invalid DC/DR policy
passed validation. Call it from validatePlacementPolicy after the constraint nil
guard. It is a no-op for a non-DC/DR policy (FailoverPolicy unset), so existing
PlacementPolicies are unaffected.

Signed-off-by: Tamal Saha <tamal@appscode.com>
The DC failover topology has exactly two kinds of data center: Member (holds
data, votes, primary eligible) and Arbiter (no data, never primary, vote only for
tie-breaking). The Witness role meant "a third DC that holds data but is never
primary," and that case no longer exists: a third site is either a data-less
Arbiter or a full Member, and MongoDB's third-site vote is a data-less arbiter
placed in the Arbiter DC, not a data-bearing member. Witness was only just added
and never shipped, so removing the enum value breaks nothing in use.

- DCRole: drop the DCRoleWitness constant, the enum value, and the doc lines.
- ClusterSpreadConstraint.Validate(): drop the witnesses counter and the Witness
  branch; TwoDC now requires exactly two Members and at least one Arbiter.
- Webhook and FailoverMode/FailoverPolicy comments updated to Member/Arbiter.
- Regenerate the PlacementPolicy CRD (controller-gen): role enum is Member;Arbiter.
- Add Validate tests: TwoDC needs an Arbiter, and Witness is now an unknown role.

Signed-off-by: Tamal Saha <tamal@appscode.com>
Base automatically changed from dc-dr-failover-policy to master July 9, 2026 16:18
@tamalsaha tamalsaha closed this Jul 9, 2026
@tamalsaha
tamalsaha deleted the remove-witness-role branch July 9, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant