Fix Kubernetes node probe portability - #1262
Conversation
Strip carriage returns from rendered egress probe commands so Windows checkouts do not produce invalid Bash input. Treat any CubeProxy HTTP response as transport reachability because the root path requires a sandbox Host header and may validly return 400. Assisted-by: GitHub Copilot:GPT-5.4
Review: Fix Kubernetes node probe portability (#1262)AI-generated review — the findings below are machine-produced and have not been reviewed by a human maintainer. SummaryThis PR fixes two Kubernetes chart portability issues:
What I verified in the base tree
Findings
Positives
ConclusionThe changes are correct and well-targeted; both findings are non-blocking. Recommend confirming the 5xx-acceptance trade-off (finding 1) is intended, and optionally applying the CRLF guard more broadly (finding 2). No blocking issues found. |
Make the cube-proxy Service HTTP check a hard failure instead of a soft-failed warning, so an unreachable proxy surfaces in the test job. Add .gitattributes to normalize YAML/tpl line endings across platforms. Signed-off-by: jinlong <jinlong@tencent.com>
| - | | ||
| echo '[health-test] check CubeProxy via ClusterIP Service' | ||
| curl --connect-timeout 5 --max-time 15 -fsS -o /dev/null \ | ||
| curl --connect-timeout 5 --max-time 15 -sS -o /dev/null \ |
There was a problem hiding this comment.
Removing --fail makes curl exit 0 for any HTTP response, so a CubeProxy that is reachable but broken (e.g. returning HTTP 500 instead of the expected 400 for / without a sandbox Host header) now passes this test — previously -f turned a 5xx into a hard failure through the || … exit 1 chain. If the goal is only to tolerate the expected 4xx, consider asserting the status code so genuine server errors still fail:
status="$(curl --connect-timeout 5 --max-time 15 -sS -o /dev/null -w '%{http_code}' \
"http://<proxy-service>/" || echo 000)"
test "${status}" -lt 500 || { echo "cube-proxy Service unhealthy (HTTP ${status})"; exit 1; }keeping the HTTPS attempt as the transport fallback. (The || echo 000 guard matters because the script runs under sh -e.) Not blocking — flagging the trade-off to confirm it's intended.
| - /bin/bash | ||
| - -ec | ||
| - {{ include "cube.egressNetProbeCommand" . | quote }} | ||
| - {{ include "cube.egressNetProbeCommand" . | replace "\r" "" | quote }} |
There was a problem hiding this comment.
The replace "\r" "" guard correctly fixes this probe command (canonical Helm CRLF idiom, correctly ordered before quote). One completeness note: this is the only render site that got the guard, but the chart's other multi-line scripts — the | blocks in tests/node-health.yaml, node-bootstrap-daemonset.yaml, and the - | command at node-daemonset.yaml:81 — are equally CRLF-sensitive in a Windows working tree. .gitattributes only protects fresh checkouts; an already-polluted tree stays CRLF until re-normalized (git add --renormalize . then re-checkout). Consider applying the same guard at the other multi-line command renders, or documenting the renormalization step. Non-blocking.
Summary
Why
A Windows checkout can inject CRLF into the included Bash probe and make
set -efail with an invalid option. CubeProxy also validly returns HTTP 400 for/without a sandboxHostheader, socurl --failincorrectly reports a reachable proxy as unhealthy.Testing
helm lint deploy/kubernetes/chartwith non-default test credentialshelm templaterenders without carriage returnsAssisted-by: GitHub Copilot:GPT-5.4