Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion exgentic_a2a_runner/deploy-benchmark.sh
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,20 @@ echo ""
# Step 7.1.1 + 7.1.2: Update secrets
echo "Step 7.1.1: Updating secrets..."
if [ "$CLUSTER_MODE" = "kind" ]; then
"$SCRIPT_DIR_BENCH/update-secrets.sh" --namespace "$NAMESPACE"
# Don't let set -e abort before the reason can be printed.
SECRETS_OUTPUT=$("$SCRIPT_DIR_BENCH/update-secrets.sh" --namespace "$NAMESPACE" 2>&1) && SECRETS_RC=0 || SECRETS_RC=$?
echo "$SECRETS_OUTPUT"
if [ "$SECRETS_RC" -ne 0 ]; then
echo "ERROR: update-secrets.sh failed (exit $SECRETS_RC) — see the output above for the reason" >&2
exit "$SECRETS_RC"
fi
# update-secrets.sh exits 0 even when an individual patch fails, so check
# its output for the warning and surface the reason it printed.
if echo "$SECRETS_OUTPUT" | grep -qE "Could not (update|create) openai-secret"; then
echo "ERROR: could not set secret openai-secret in namespace $NAMESPACE" >&2
echo "$SECRETS_OUTPUT" | grep -E -A 1 "Could not (update|create) openai-secret" >&2
exit 1
fi
else
echo "Step 7.1.1: Updating secrets... (skipped — secrets are pre-provisioned on OpenShift/in-cluster)"
fi
Expand Down
33 changes: 26 additions & 7 deletions exgentic_a2a_runner/update-secrets.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,32 @@ if [ -z "$OPENAI_API_KEY" ]; then
echo "Warning: OPENAI_API_KEY is not set — skipping"
else
ENCODED_KEY=$(echo -n "$OPENAI_API_KEY" | base64)
kubectl patch secret openai-secret -n "$NAMESPACE" --type='json' -p="[
{
\"op\": \"replace\",
\"path\": \"/data/apikey\",
\"value\": \"$ENCODED_KEY\"
}
]" 2>/dev/null && echo "✓ openai-secret updated" || echo "Warning: Could not update openai-secret"
# Patch when the secret already exists, create it otherwise. Stderr is
# captured (2>&1 >/dev/null) so a real failure reports why kubectl refused
# — RBAC denial, missing namespace, missing /data/apikey key, ...
if kubectl get secret openai-secret -n "$NAMESPACE" >/dev/null 2>&1; then
if PATCH_ERR=$(kubectl patch secret openai-secret -n "$NAMESPACE" --type='json' -p="[
{
\"op\": \"replace\",
\"path\": \"/data/apikey\",
\"value\": \"$ENCODED_KEY\"
}
]" 2>&1 >/dev/null); then
echo "✓ openai-secret updated"
else
echo "Warning: Could not update openai-secret (kubectl patch secret openai-secret -n $NAMESPACE failed)"
[ -n "$PATCH_ERR" ] && echo " Reason: $PATCH_ERR"
fi
else
# Key must be "apikey" — that is what k8s/job.yaml's secretKeyRef reads.
if CREATE_ERR=$(kubectl create secret generic openai-secret -n "$NAMESPACE" \
--from-literal=apikey="$OPENAI_API_KEY" 2>&1 >/dev/null); then
echo "✓ openai-secret created"
else
echo "Warning: Could not create openai-secret (kubectl create secret generic openai-secret -n $NAMESPACE failed)"
[ -n "$CREATE_ERR" ] && echo " Reason: $CREATE_ERR"
fi
fi
fi

echo ""
Expand Down
Loading