Fix transient webhook timeouts on kueue job submission - #6252
Fix transient webhook timeouts on kueue job submission#6252sudheer-quad wants to merge 1 commit into
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request improves the robustness of the Cloud Build pipeline by introducing retry logic for Kueue job submissions. By handling transient network or webhook latency, the pipeline is now less likely to fail due to temporary GKE control plane issues, ensuring more reliable job execution. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a retry mechanism for the kubectl apply command in submit_and_monitor_kueue_job.sh to handle transient failures during Kueue job submission. The review feedback recommends replacing the double-parentheses post-increment (( SUBMIT_ATTEMPT++ )) with standard arithmetic expansion SUBMIT_ATTEMPT=$((SUBMIT_ATTEMPT + 1)) to avoid potential script termination under set -e and to maintain consistency with the rest of the script.
a6f99e3 to
512df21
Compare
efc9857 to
53404c7
Compare
| while true; do | ||
| echo "Executing job submission (attempt ${SUBMIT_ATTEMPT}/${SUBMIT_RETRIES})..." | ||
|
|
||
| if kubectl apply -f /workspace/job.yaml; then |
There was a problem hiding this comment.
Currently, this retries on any non-zero exit code from kubectl apply. If there is an invalid field or syntax error in /workspace/job.yaml, kubectl apply fails with a permanent schema error, but the loop will still sleep and retry across all attempts before failing—unnecessarily stalling CI feedback.
Consider capturing the output so we fail fast on permanent errors and only retry on transient webhook/connection timeouts:
if APPLY_OUT=$(kubectl apply -f /workspace/job.yaml 2>&1); then
echo "$APPLY_OUT"
break
fi
echo "$APPLY_OUT"
if ((SUBMIT_ATTEMPT >= SUBMIT_RETRIES)); then
echo "ERROR: Failed to apply job manifest after ${SUBMIT_RETRIES} attempts." >&2
exit 1
fi
# Fail fast on non-transient schema or validation errors
if ! echo "$APPLY_OUT" | grep -iqE "(webhook|timeout|context deadline exceeded|connection refused)"; then
echo "ERROR: Non-retriable apply failure detected. Failing immediately." >&2
exit 1
fi53404c7 to
5be9811
Compare
This PR prevents the Cloud Build pipeline from terminating immediately during kueue job submission due to
set -ewhen the GKE control plane or Kueue mutating webhook (mjob.kb.io) experiences temporary latency.Submission Checklist
NOTE: Community submissions can take up to 2 weeks to be reviewed.
Please take the following actions before submitting this pull request.