Skip to content

Dcdr cli - #837

Merged
souravbiswassanto merged 4 commits into
masterfrom
dcdr-cli
Aug 8, 2026
Merged

Dcdr cli#837
souravbiswassanto merged 4 commits into
masterfrom
dcdr-cli

Conversation

@souravbiswassanto

Copy link
Copy Markdown
Member

No description provided.

…tions

Adds `kubectl dba dc-dr` with nine commands, each live-verified against a
three data center cluster before documenting:

  switchover        planned zero-RPO move of the primary role (hub)
  status            one-shot state + step-by-step switchover progress (hub)
  abort             abort an in-flight switchover via the explicit abort signal
  accept-data-loss  release a failover held by the RPO budget, --yes required
  handoff           move the failover authority; the scope-local failover lever
  pin-primary       break-glass: this DC stays primary and writable, no failover
  pin-standby       this DC never promotes
  active-dc         who holds the primary role, read from the Lease itself
  debug             failover / switchover / fence symptom walkers

DC-DR spans three API surfaces, so each command states which it needs. The
coordination control plane is a separate apiserver: its kubeconfig is resolved
from a file, a ConfigMap, or a Secret (defaulting to the dc-failover/coord-kubeconfig
the chart mints), via the shared --coord-* flags. The pin commands act on a
spoke by design, which is why they still work when the hub is unreachable.

Scope resolution mirrors the operator's own (PlacementPolicy failoverPolicy
trigger, then the legacy annotation, then Global) so the CLI can never disagree
with the controller about which Lease a database follows. Guards refuse an
Arbiter or Witness target, a no-op self-target, an unconfirmed data-loss
acceptance, and a handoff into a break-glass-pinned scope.

Documented in docs/CLI.md with real captured output.

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

The override-hold annotation on the Lease is normally cleared only by the pinned
DC's own agent when its override ConfigMap disappears. If that DC dies with the
pin standing, the annotation persists and every handoff refuses, which blocks the
deliberate promote-the-survivor runbook exactly when it is needed.

--remove --force, run from any live cluster with the --coord-* flags, tolerates
the failed ConfigMap delete and clears the annotation directly on the Lease.
Refuses to run without a reachable coordination plane. Live-proven in the bank
two-site dc-loss drill: handoff refused while the pin stood, force cleared it,
dr acquired and promoted cleanly.

Signed-off-by: Tamal Saha <tamal@appscode.com>
Signed-off-by: Tamal Saha <tamal@appscode.com>
Discard fmt.Fprint* return values explicitly, matching the repo's
existing _, _ = convention, and simplify the pin-primary force guard
per De Morgan (QF1001).

Signed-off-by: Tamal Saha <tamal@appscode.com>
@souravbiswassanto
souravbiswassanto merged commit 0787f60 into master Aug 8, 2026
6 checks passed
@souravbiswassanto
souravbiswassanto deleted the dcdr-cli branch August 8, 2026 04:36
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.

2 participants