← Back to Pull requests

kube generate: write Job backoffLimit from restart retries #30404

Closed
unknown closed this pull request without merging on Dec 04, 2026 09:29 UTC
View on GitHub
unknown unknown commented on Nov 30, 2026 14:07 UTC
Author

@mheon requested on #30342.

kube generate --type job always writes restartPolicy: Never and no backoffLimit, even for a container created with --restart on-failure:3. Since #30342, kube play honours backoffLimit, so a generate and play round trip drops the retry bound.

This writes the source's restart policy and retry count into the Job, the inverse of #30342:

  • on-failure:N, N > 0: restartPolicy: OnFailure, backoffLimit: N

  • on-failure with no count: OnFailure, no backoffLimit. Podman stores on-failure:0 the same way, so it maps here too.

  • no or unset: Never, as before

  • always: an error, as before
  • For a pod the pod's retry count is used. With several containers, the first container's count is used.

    Where it differs from Kubernetes:

  • With no backoffLimit, kube play restarts without limit, where Kubernetes defaults to 6. kubernetes_support.md now says so.

  • The per-container count from #30342 still applies.
  • Left as is: a pod with no restart policy of its own still generates Never, even when its containers use on-failure.

    To reproduce: podman create --restart on-failure:3 --name c alpine false, then podman kube generate --type job c. Main writes Never and no limit. With this change it writes OnFailure and backoffLimit: 3, and playing that YAML stops after 3 restarts.

    The new e2e table case in generate_kube_test.go and the round trip in 710-kube.bats fail on main and pass with the change. On the final tree:

  • e2e (Podman kube generate): 78 passed, 0 failed

  • 710-kube.bats (kube generate): 8 ok, 0 failed

  • golangci-lint (hack/golangci-lint.sh, base, systemd and remote tags): 0 issues
  • Run on podman main 4ad7ed5d6, rootless, Fedora 45.

    Checklist

    Ensure you have completed the following checklist for your pull request to be reviewed:
    <!-- Use [x] to mark as done, or click the checkbox after opening PR -->

  • I have read and understood our contributing guidelines and will not have more than two open PRs as a new contributor.

  • PR description, commit message, and GitHub comments are human-written, per LLM Policy

  • Certify you wrote the patch or otherwise have the right to pass it on as an open-source patch by including your Signed-off-by line in all

  • commits. (git commit -s). (If needed, use git commit -s --amend). The author email must match
    the sign-off email address. Read the DCO Sign-off requirements
    and ensure you follow them before signing off your commits.
  • Referenced issues using Fixes: #00000 in commit message (if applicable)

  • Tests have been added/updated (or no tests are needed)

  • Documentation has been updated (or no documentation changes are needed)

  • All commits pass make validatepr (format/lint checks)

  • Release note entered in the section below (or None if no user-facing changes)
  • Does this PR introduce a user-facing change?

    ``release-note
    kube generate --type job now writes restartPolicy OnFailure and backoffLimit from the container's restart retries.
    ``

    Diff: 442 lines (+331 / -111) across 5 files Reviewer: ajoshua2004 Review duration: 5481m
    All Vouch review confidence checks passed
    Residual risk 0.27 = Change Risk (0.68) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.68 · 442 lines diff across 5 files
    0.68
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.365
    Shallow Review Depth shallow_review_depth
    0.289
    Sensitive Paths sensitive_paths
    0.068
    Real PR Conversation Timeline
    1 comments
    "Review active on #30404"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed sensitive_module
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 68.5% (HIGH) · Higher = larger blast radius
    68.5%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 27.1% · Safe to merge
    27.1%