#1339·chaosblade

[Blade AI] preflight falsely reports ChaosBlade Operator ready when unrelated deployments contain "chaosblade"

Author: MyzmzzCreated Aug 10, 2026Updated Aug 18, 2026

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 chaosblade in their names: present

The live preflight response reported:

Environment self-check: 7/7 passed
chaosblade_operator: passed
message: v20260529

However, 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

  1. Ensure there is no real ChaosBlade Operator Deployment.
  2. Create an unavailable Deployment whose name contains chaosblade and whose first image has a numeric tag:
name: chaosblade-box
availableReplicas: <field absent>
image: example/box:20260529
  1. Create at least one unrelated ready Deployment whose name also contains chaosblade:
name: chaosblade-space-exploration-mysql
availableReplicas: 1
image: mysql:8.4
  1. Run Blade AI /doctor or call GET /api/v1/preflight.

Actual result:

chaosblade_operator: passed
message: v20260529

Expected result:

chaosblade_operator: failed
message: ChaosBlade Operator not deployed

Root cause

The affected preflight implementation has three interacting problems:

  1. The Deployment query scans all namespaces and the parser accepts every name containing chaosblade:
python
if "chaosblade" not in name:
    continue
  1. In the jsonpath parser, an absent availableReplicas field is ignored rather than treated as zero:
python
if rep:
    replicas.append(rep)

This means unavailable matching Deployments do not participate in the readiness decision.

  1. If no image contains chaosblade-operator, version extraction falls back to the first unrelated image:
python
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_version
  • check_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 name condition.
  • Treat missing availableReplicas as 0.
  • 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 availableReplicas field;
    • no actual Operator image present;
    • an actual ready Operator Deployment.

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