Skip to content

fix(detect): the Strimzi operator lookup is not thrown off by "error" in any deployment's JSON - #394

Merged
bmscomp merged 1 commit into
mainfrom
fix/detect-strimzi-operator-lookup
Oct 18, 2026
Merged

bmscomp merged 1 commit into
mainfrom
fix/detect-strimzi-operator-lookup

Conversation

@bmscomp

@bmscomp bmscomp commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Item 1.7a of the CLI performance and stability plan (finding F18, first half). Independent of the other Wave 1 PRs, 1.7b included.

Why

Detect feeds kates auto and the preflight and generated values of kates deploy. To find the Strimzi operator it lists every deployment in the cluster, kubectl get deployment -A -o json. On main (6f4cf61, cli/pkg/detect/collector.go:556) it falls back to -n kafka whenever that output contains the text error or Forbidden.

The output is the JSON of every deployment. One deployment with an argument like --log-level=error, which is common for ingress controllers and operators, sends the lookup to namespace kafka. An operator in strimzi-system then goes unseen, and detect reports Strimzi not running.

Changes

cli/pkg/detect/collector.go: the fallback runs on err != nil or empty output only. OSExecutor.Exec returns an error carrying kubectl's stderr when the command fails, so a cluster-scope refusal (Forbidden) still falls back.

Tests

Added TestGetStrimziStatus_FindsTheOperatorBesideAnErrorLogLevel. It lists an ingress controller with --log-level=error beside strimzi-cluster-operator in strimzi-system, and expects the operator found there with its image.

On main's collector.go the test fails with Running false in "".

Run locally, passing:

  • cd cli && go test ./..., go test -race ./pkg/detect, go vet ./....
  • golangci-lint run --new-from-rev=origin/main ./...: 0 issues.
  • scripts/check-cli-style.sh and scripts/check-cli-compat.sh: OK.
  • The backend suite, which cli/** triggers (Build & Test): this PR touches nothing under kates/. ./mvnw test on main's kates/ tree ran 1,254 tests with 0 failures and 0 errors, once for all of Wave 1.

Skipped locally: govulncheck, as go.mod is unchanged.

CI only: ./mvnw verify with the *IT tests, the Kind and Docker jobs, CodeQL and Trivy.

… in any deployment's JSON

Detect lists every deployment in the cluster to find the Strimzi operator,
and fell back to namespace kafka whenever that JSON contained the text
"error" or "Forbidden". Any deployment with an argument like
--log-level=error matched, so an operator in strimzi-system went unseen,
detect reported Strimzi not running, and kates deploy and kates auto acted
on that.

The fallback now runs on what kubectl says, an error or no output, the way
a refusal arrives. TestGetStrimziStatus_FindsTheOperatorBesideAnErrorLogLevel
lists an ingress controller with --log-level=error beside the operator in
strimzi-system.
@bmscomp
bmscomp merged commit e340754 into main Oct 18, 2026
55 checks passed
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