From 543e80132eb2fc4476c3181a7feb6f17505e64bf Mon Sep 17 00:00:00 2001 From: Hai Huang Date: Fri, 15 May 2026 21:18:12 -0400 Subject: [PATCH] fix(weather-demo): teach pick_log_container the proxy-sidecar container name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `pick_log_container` helper in deploy_and_verify_advanced.sh only knew two AuthBridge sidecar container names: `envoy-proxy` (envoy-sidecar mode) and `authbridge` (the pre-split combined-mode name from before #411). After #411 + kagenti-operator#361 the cluster default became proxy-sidecar, whose container is named `authbridge-proxy` — the script `die()`s on every CI run because neither of its two known names matches. Reproduced on kagenti#1592 just now. The pod actually had two containers — `mcp` and `authbridge-proxy` — i.e. the webhook had injected fine and the demo flow was healthy. The script just couldn't tell which container to read logs from: ERROR: pod weather-tool-advanced-... has neither envoy-proxy nor authbridge container (mcp authbridge-proxy) (The error message itself was misleading — the pod's container list `mcp\nauthbridge-proxy` got split across two log lines, so casual readers saw "(mcp" and assumed no sidecar was injected.) Fix: * Replace the two-branch if-elif with a small fallthrough loop over `authbridge-proxy / envoy-proxy / authbridge` so the cluster default's container name is recognized first, the envoy-sidecar mode's name still works, and the legacy combined name is kept for older clusters / replays. * Wrap `$names` in `$(echo $names)` inside the die message so the pod's container list renders on a single line, making the diagnostic accurate ("expected one of …; got: mcp authbridge-proxy") rather than visually truncated. Verified: bash -n on the script; repo grep finds no other places with the same restricted-name pick. Assisted-By: Claude (Anthropic AI) Signed-off-by: Hai Huang --- .../deploy_and_verify_advanced.sh | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/authbridge/demos/weather-agent/deploy_and_verify_advanced.sh b/authbridge/demos/weather-agent/deploy_and_verify_advanced.sh index 39f6e073b..094580d13 100755 --- a/authbridge/demos/weather-agent/deploy_and_verify_advanced.sh +++ b/authbridge/demos/weather-agent/deploy_and_verify_advanced.sh @@ -121,13 +121,24 @@ pick_log_container() { local pod=$1 local names names=$(kubectl get pod -n "$NAMESPACE" "$pod" -o jsonpath='{.spec.containers[*].name}' | tr ' ' '\n') - if echo "$names" | grep -qx 'envoy-proxy'; then - echo envoy-proxy - elif echo "$names" | grep -qx 'authbridge'; then - echo authbridge - else - die "pod $pod has neither envoy-proxy nor authbridge container ($names)" - fi + # Container name depends on the resolved AuthBridge mode (per + # kagenti-operator/internal/webhook/injector/container_builder.go): + # proxy-sidecar (cluster default after kagenti-operator#361): + # AuthBridgeProxyContainerName = "authbridge-proxy" + # envoy-sidecar: + # EnvoyProxyContainerName = "envoy-proxy" + # The earlier `combinedSidecar` feature gate produced a bare + # "authbridge" container, but that gate (and the constant) were + # removed in #361 — and this script already requires the post-#361 + # AgentRuntime CRD just above, so there's no pre-#361 path to + # support here. + for c in authbridge-proxy envoy-proxy; do + if echo "$names" | grep -qx "$c"; then + echo "$c" + return 0 + fi + done + die "pod $pod has no AuthBridge sidecar (expected one of authbridge-proxy / envoy-proxy; got: $(echo $names))" } TOOL_LOG_C=$(pick_log_container "$ADV_TOOL_POD")