[Blade AI] preflight falsely reports ChaosBlade Operator ready when unrelated deployments contain "chaosblade"
Issue Description
Type: bug report
Summary
Blade AI's chaosblade_operator preflight check can report passed even when no ChaosBlade Operator Deployment or Pod exists.
The check currently treats any Deployment whose name contains chaosblade as an Operator candidate. This allows unrelated applications such as ChaosBlade Box or a chaosblade-space-exploration-* database to satisfy the readiness check. It may also report the unrelated application's image tag as the Operator version.
This creates false confidence during /doctor: the environment is shown as fully ready, but a Kubernetes fault later creates a ChaosBlade CR whose status remains empty because no controller is reconciling it.
Observed behavior
Environment:
- Blade AI: v0.6.1
- Kubernetes: v1.28
- Transport: kubectl/kubeconfig
- Actual ChaosBlade Operator Deployment/Pod/image: absent
- Other Deployments with
chaosbladein their names: present
The live preflight response reported:
Environment self-check: 7/7 passed
chaosblade_operator: passed
message: v20260529However, the cluster had no chaosblade-operator workload. The displayed version came from an unrelated image whose tag was 20260529.
A subsequent fault injection failed as follows:
Experiment CR was created
expected status: create
actual status: ""Minimal reproduction
- Ensure there is no real ChaosBlade Operator Deployment.
- Create an unavailable Deployment whose name contains
chaosbladeand whose first image has a numeric tag:
name: chaosblade-box
availableReplicas: <field absent>
image: example/box:20260529- Create at least one unrelated ready Deployment whose name also contains
chaosblade:
name: chaosblade-space-exploration-mysql
availableReplicas: 1
image: mysql:8.4- Run Blade AI
/doctoror callGET /api/v1/preflight.
Actual result:
chaosblade_operator: passed
message: v20260529Expected result:
chaosblade_operator: failed
message: ChaosBlade Operator not deployedRoot cause
The affected preflight implementation has three interacting problems:
- The Deployment query scans all namespaces and the parser accepts every name containing
chaosblade:
if "chaosblade" not in name:
continue- In the jsonpath parser, an absent
availableReplicasfield is ignored rather than treated as zero:
if rep:
replicas.append(rep)This means unavailable matching Deployments do not participate in the readiness decision.
- If no image contains
chaosblade-operator, version extraction falls back to the first unrelated image:
chosen = next(
(img for img in images if "chaosblade-operator" in img),
images[0],
)As a result, the ready unrelated Deployment makes _operator_replicas_ready return true, while the first unrelated image supplies the displayed version.
Relevant functions:
_parse_operator_jsonpath_parse_operator_json_extract_operator_image_versioncheck_chaosblade_operator
Suggested behavior
- Select actual Operator Deployments using an exact supported name, stable labels, and/or an Operator image match instead of the broad
"chaosblade" in namecondition. - Treat missing
availableReplicasas0. - Evaluate readiness only for the selected Operator workload.
- Do not fall back to an unrelated image when reporting the Operator version.
- Add regression tests covering:
- unrelated ready Deployments containing
chaosblade; - an unavailable candidate with an absent
availableReplicasfield; - no actual Operator image present;
- an actual ready Operator Deployment.
- unrelated ready Deployments containing
Impact
This is more than a cosmetic version-reporting issue. The false positive tells users that Kubernetes fault-injection prerequisites are satisfied and allows them to proceed, but ChaosBlade CRs are then never reconciled. The resulting injection failure appears later and is harder to diagnose.
Source: chaosblade-io/chaosblade