<#7671 Treat K8s Invalid/BadRequest on resource cr...
# flyte-github
a
#7671 Treat K8s Invalid/BadRequest on resource create as permanent user failure Pull request opened by SVilgelm Tracking issue Related to RUN-53 Why are the changes needed? A run submitted with a deterministically invalid pod spec (e.g. an empty container image, as in
playground/flytesnacks/development/run-labels-smoke-6a40e9
) is rejected by K8s with 422 on every create attempt:
Copy code
Pod "..." is invalid: spec.containers[0].image: Required value
launchResource
only special-cases
IsForbidden
and `IsRequestEntityTooLargeError`;
IsInvalid
falls through to the generic system-error path. Leasor then system-retries up to
max_system_retries
(30) at ~1/min, and each retry flips the action back to Queued while the previous attempt's error is still on the record — the run shows "Queued but error" in the UI for ~35 minutes before permanently failing, and inflates active-run counts in queue metrics. Since the same spec is rejected on every attempt, retrying can never succeed. What changes were proposed in this pull request? In
executor/pkg/plugin/k8s/plugin_manager.go
launchResource
, handle
k8serrors.IsInvalid
and
k8serrors.IsBadRequest
on resource create the same way as `IsRequestEntityTooLargeError`: a permanent user failure (
PhaseInfoFailure
, code
InvalidResource
) that fails the action immediately instead of burning system retries. This mirrors upstream flyte1's
transitionFromError
IsBadRequest || IsInvalid
branch (where the permanent-failure transition is commented out), and acts as the catch-all for all K8s plugins and dynamically spawned child actions. Front-door validation of the task spec at CreateRun is tracked separately in RUN-53. How was this patch tested? Added
plugin_manager_test.go
covering
launchResource
create-error handling: Invalid and BadRequest → permanent USER failure with code `InvalidResource`; Forbidden → retryable failure (unchanged); other errors (e.g. internal) → system error (unchanged); successful create → Queued. Check all the applicable boxes • I updated the documentation accordingly. • All new and existing tests passed. • All commits are signed-off. flyteorg/flyte