Skip to content

feat: status subresource with MAIN, conditions, printer columns#25

Open
as51340 wants to merge 1 commit into
01-repo-reset-scaffoldfrom
06-status-and-conditions
Open

feat: status subresource with MAIN, conditions, printer columns#25
as51340 wants to merge 1 commit into
01-repo-reset-scaffoldfrom
06-status-and-conditions

Conversation

@as51340

@as51340 as51340 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

What & why

Implements specs/operator-mvp/issues/06-status-and-conditions.md: makes cluster health inspectable from the CR without hand-querying coordinators. Status is observation-only — no secret material, never read back as reconcile input.

Changes

  • API (api/v1alpha1)

    • New status.main: the data instance currently observed as MAIN (empty before initial election; updates on coordinator-driven failover).
    • Two normal-True conditions with a stable reason vocabulary:
      • Ready — a MAIN is elected and the leader is reachable (is the cluster serving?).
      • Converged — the observed cluster matches the declared topology (no pending registration commands).
      • A cluster can be Ready but not Converged — a MAIN keeps serving while a lost replica registration is restored.
    • Printer columns for kubectl get mgc: Coordinators, Data, Main, Ready, Converged, Age.
  • Controller (internal/controller)

    • Writes status at each reconcile branch via the status subresource only (spec untouched), computing MAIN from SHOW INSTANCES and setting conditions per phase (bootstrapping → converged → degraded).
    • writeStatus skips no-op patches, so a converged cluster re-observed on every resync does not churn the resource version.

State → conditions

Phase Ready Converged
Pods not ready False (WorkloadsNotReady) False (WorkloadsNotReady)
No coordinator reachable False (CoordinatorUnreachable) False (CoordinatorUnreachable)
Registering (fresh, no MAIN yet) False (NoMainElected) False (RegistrationInProgress)
Registering (drift, MAIN serving) True (MainElected) False (RegistrationInProgress)
Converged True (MainElected) True (AllInstancesRegistered)

Tests

New envtest coverage (HA client mocked): bootstrapping, unreachable/degraded, converged, drift (Ready stays True while Converged drops), MAIN tracked across a coordinator-driven failover with no operator promotion, and a spec-immutability-under-status-update check. Added a connect-failure toggle to the fake cluster. make test and make lint green.

Base branch: 01-repo-reset-scaffold. Scoped strictly to issue 06.

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