Skip to content

#763: cluster-onboard's preflight checks the Thanos retention and the root Application - #795

Open
ephico2real2 wants to merge 3 commits into
mainfrom
feat/763-preflight
Open

ephico2real2 wants to merge 3 commits into
mainfrom
feat/763-preflight

Conversation

@ephico2real2

Copy link
Copy Markdown
Owner

Closes #763
Part of #26

What

cluster-onboard's preflight step now does what docs/02, "Onboarding becomes shorter", step 2 says: "the Thanos Route
answers, retention is at least 15 days, and the root Application exists and is Synced", after the import's own checks.

  • cmapi/src/cmapi/capacity/retention.py (new): platform_retention_seconds reads Prometheus's gauge
    prometheus_tsdb_retention_limit_seconds{namespace="openshift-monitoring", job="prometheus-k8s"} through the same
    ThanosQuerier (Route, token, trust, Baseline reader: bind cluster-monitoring-metrics-api in openshift-monitoring, not cluster-monitoring-view cluster-wide #724 grants, partial_response=false, dedup=true) as the usage reads. The shortest
    replica counts; 0 is no time limit; no series or a value that is not seconds is MetricsUnavailable.
    MIN_RETENTION_DAYS = 15 (docs/02; no configuration key exists for it).
  • cmapi/src/cmapi/ops/__init__.py, preflight: _retention and _root_application. Each check is a pass (checks), a
    finding (findings; the step is Failed and its note names every finding), or not applicable with its reason
    (notApplicable). The output notChecked is gone.
    • Retention applies when capacity.yaml usage.source is thanos.
    • The root Application is delivery.argocd.rootApplication in delivery.argocd.namespace, read with ArgoCdSignal; it
      applies in argocd mode and in gitops mode with delivery.signal: argocd, not in apply mode or with another signal,
      nor when the name template has {namespace}. Only status.sync.status: Synced passes; 404, 403, an unreadable cluster
      or status are findings.
  • Docs: docs/02's as-built note for step 2, docs/21 (the new Thanos read and the Application read), the template comment.
    Decisions and sources: docs/reviews/2026-12-01-issue-763/README.md (D1 to D6).

Measured (CRC, OpenShift 4.22.14, 2026-12-01 21:47Z, read-only)

GET /api/v1/query?query=prometheus_tsdb_retention_limit_seconds on CRC's thanos-querier Route answered three series:
prometheus-k8s 1296000 (15 days), prometheus-user-workload 86400, thanos-ruler 86400. With the matchers, only
prometheus-k8s-0. Thanos Query's /api/v1/status/flags answered 81 flags, none on retention (option rejected, D1). CRC has
no applications.argoproj.io CRD and runs delivery.mode: apply, so the root Application check is not applicable there.

Tests (PostgreSQL 16 on 127.0.0.1:55432, the suite's fakes; no cluster)

cmapi/tests/service/test_onboard_preflight_763.py: 19 tests. Run with main's ops/__init__.py in place: 14 failed, 5
passed (the five test the new gauge module alone). With this change: 19 passed. test_operations_26.py: 21 passed, its
onboarding test now asserts notApplicable. test_doc_citations.py passed; scripts/doc-citations.py --check 0 problems
(4 new citations read, then --write).

Not tested: a cluster running Argo CD (none is available without a cluster write); the reader's own token on CRC's Route for
this query (the measurement used an administrator's token; the reader's grant for /api/v1/query is #724's).

Found

#794 (sev:low, Backlog): the example cluster folder's root Application ocp-gf15-namespaces differs from
delivery.argocd.rootApplication's default cluster-configs-{clusterId}.

Who wrote what

Every commit and file of this PR: the implementer, Opus 5.5 at high. Design: one design (the implementer's), no second
model family yet; the review is the coordinator's to run. The live Claude Doc of docs/02 still needs the same as-built
sentence as the export.

… root Application

docs/02, "Onboarding becomes shorter", step 2: "the Thanos Route answers, retention is at least 15 days, and the root
Application exists and is Synced". After the import's checks, preflight now reads the platform Prometheus's gauge
prometheus_tsdb_retention_limit_seconds of job prometheus-k8s in openshift-monitoring through the usage path's
ThanosQuerier (capacity/retention.py; the shortest replica counts, 0 is no time limit, under 15 days or unreadable is a
finding), and the root Application of delivery.argocd with ArgoCdSignal (only status.sync.status Synced passes; missing,
forbidden or unreadable is a finding). Each check passes, is a finding, or is not applicable with its reason: retention when
usage.source is none, the root Application in apply mode, in gitops mode without delivery.signal argocd, or with a
per-namespace name template. notChecked is gone.

Tests: test_onboard_preflight_763.py (19; 14 fail with main's preflight); test_operations_26's onboarding test asserts
notApplicable. Docs: docs/02 as built, docs/21 (the new reads, citations recorded), the template comment, and the decisions
with their sources in docs/reviews/2026-12-01-issue-763/README.md.

Written by Opus 5.5 (high), the implementer.
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.

Operations: cluster-onboard's preflight does not check Thanos retention or the root Application

1 participant