Skip to content

fix(opentelemetry-operator): make the metrics helm test honour manage… - #2423

Merged
TylerHelmuth merged 7 commits into
open-telemetry:mainfrom
adityareddy-dev:issue-2420-operator-test
Oct 1, 2026
Merged

TylerHelmuth merged 7 commits into
open-telemetry:mainfrom
adityareddy-dev:issue-2420-operator-test

Conversation

@adityareddy-dev

Copy link
Copy Markdown
Member

Description

This PR fixes an issue where the operator's service connection helm test fails with an HTTP 404 error instead of the expected HTTP 400.

Link to tracking issue

Refs #2420

Context & Root Cause

The test pod currently issues a raw HTTP request and expects a 400 response. A 400 Bad Request is how Go's HTTP server handles plaintext traffic landing on a TLS-secured port—which is the chart's default state.However, if a user explicitly sets manager.metrics.secure: false (or works behind a service mesh sidecar), the metrics port switches to plain HTTP. When this happens, a GET / request hits the controller-runtime mux directly and correctly yields an HTTP 404 Not Found.

Proposed Solution

This fix conditionally adapts the connection test based on the secure setting:

  • Keeps the 400 validation check for the default secure configuration.
  • Dynamically fetches /metrics instead when secure is turned off, ensuring a clean test path for both setups.

Testing Done

I verified these changes locally using kind under the following conditions:

  • Default configuration (Secure): Confirmed the original chart expects 400 and passes.
  • Insecure configuration (secure: false): Verified the original chart fails with a 404, and this PR's updated fallback successfully fetches /metrics and passes.

Authorship

  • I, a human, wrote this pull request description myself.

…r.metrics.secure

The metrics connection test expects a 400 from a plain HTTP request. That
400 is Go's reply to plaintext on a TLS port, so it only holds while
manager.metrics.secure is true. With secure metrics off, controller-runtime
serves plain HTTP on the same port and GET / answers 404, which fails helm
test on an otherwise healthy operator.

Keep the 400 check for the secure default and, when secure is false, fetch
/metrics and pass on a successful response.

Refs open-telemetry#2420

Assisted-by: Claude Fable 5.1
@adityareddy-dev
adityareddy-dev requested review from a team and Allex1 as code owners September 22, 2026 18:33
@marcschaeferger marcschaeferger added the chart:operator Issue related to opentelemetry-operator helm chart label Sep 24, 2026
if [ "$wget_output" = "wget: server returned error: HTTP/1.0 400 Bad Request" ]; then
exit 0
fi
{{- else }}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls improve the indentation

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, the directives now sit at the script's indent. Rendered output is unchanged with secure on and off.

@marcschaeferger marcschaeferger added bug Something isn't working waiting-for-reviewers labels Sep 25, 2026
@TylerHelmuth
TylerHelmuth merged commit fc09578 into open-telemetry:main Oct 1, 2026
10 checks passed
@adityareddy-dev
adityareddy-dev deleted the issue-2420-operator-test branch October 15, 2026 00:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working chart:operator Issue related to opentelemetry-operator helm chart ready-to-merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

helm test failing because test pod is expecting a 400 but getting a 404

4 participants