…ackoffLimit`) (#1413)
* fix: Ensure CreateContainerConfigError results in SYSTEM_ERROR
Signed-off-by: Liam Beckman <lbeckman314@gmail.com>
* fix: Minor linting error in kubernetes backend test
Signed-off-by: Liam Beckman <lbeckman314@gmail.com>
* feat: Update ContainerConfigError status check in K8s
Signed-off-by: Liam Beckman <lbeckman314@gmail.com>
* fix: Correctly mark tasks as SYSTEM_ERROR when K8s Job creation fails
Signed-off-by: Liam Beckman <lbeckman314@gmail.com>
* fix: enrich Kubernetes error diagnostics with pod warning events and exit info
Surfaces human-readable detail from pod Warning events and container
termination status into TES system logs, so users can see messages like
'secret "foo" not found' without needing kubectl access.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Assisted-by: Claude Code:claude [Claude Code]
* fix: Resolve ServiceAccount deletion race condition (thanks @nss10!)
Signed-off-by: Liam Beckman <lbeckman314@gmail.com>
* fix: K8s Unit Tests
- K8s fake client does not support cascading delete from Owner field
Signed-off-by: Liam Beckman <lbeckman314@gmail.com>
* chore: Revert function name in serviceaccount.go
Signed-off-by: Liam Beckman <lbeckman314@gmail.com>
* chore: Update comment
[skip ci]
Signed-off-by: Liam Beckman <lbeckman314@gmail.com>
* chore: Remove unused parameter
Signed-off-by: Liam Beckman <lbeckman314@gmail.com>
* feat: Add state filter in ListTasks (Credit: @nss10)
- Original source: 7f60650
* feat: Add support for graceful FailedCreateEvents
Signed-off-by: Liam Beckman <lbeckman314@gmail.com>
* chore: Combine `if` statements in kubernetes/backend.go
Signed-off-by: Liam Beckman <lbeckman314@gmail.com>
* fix: Add Executor Pod status check
Signed-off-by: Liam Beckman <lbeckman314@gmail.com>
* fix: Correctly set K8sExecutorErr reason fallback
* feat: Add Executor-pod error events to SYSTEM_LOG
* chore: Restrict fix/service-account-deletion to SA race condition only
Move backend.go and backend_test.go resource cleanup changes to
review/service-account-deletion (PR #1423) per reviewer request.
PR #1421 should only contain the ServiceAccount deletion race condition fix.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Assisted-by: Claude Code:claude [Claude Code]
* fix: Add ImagePullBackOff to terminal pod states (SYSTEM_ERROR)
* fix: Add remaining K8s terminal pod states (SYSTEM_ERROR)
Signed-off-by: Liam Beckman <lbeckman314@gmail.com>
* chore: Remove debug fmt.Println statements from reconciler
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Assisted-by: Claude Code:claude [Claude Code]
* refactor: Unify FetchPodWarningEvents as a shared exported function
Rename fetchExecutorPodWarningEvents (worker) and the backend method
fetchPodWarningEvents to a single exported FetchPodWarningEvents in the
compute/kubernetes package. worker/kubernetes.go now imports and calls
the shared function, eliminating duplicate logic.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Assisted-by: Claude Code:claude [Claude Code]
* fix: Replace maxErrEventWrites with failedCreateThreshold + minFailureSpan
hasJobFailedCreateEvent now fetches all job events in one API call and
requires both a minimum occurrence count (failedCreateThreshold=5) and a
minimum time span between first and last failure (minFailureSpan=20s)
before treating FailedCreate events as a persistent error. This avoids
false-positives from rapid transient bursts early in a job's lifecycle.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Assisted-by: Claude Code:claude [Claude Code]
* fix: Update ImagePullBackOff test to match current terminal waiting list
ImagePullBackOff was added to terminalWaitingReasons but the
corresponding test case was not updated. Correct the assertion.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Assisted-by: Claude Code:claude [Claude Code]
* fix: Minor linting fix
* fix: Add support for cleaning orphaned Executor jobs
Signed-off-by: Liam Beckman <lbeckman314@gmail.com>
* refactor: Address remaining PR review comments
- Move terminalWaitingReasons inside hasTerminalContainerWaitingError (no longer needed at package scope)
- Remove InitContainers check (YAGNI — worker/executor pods don't use init containers)
- Use slices.Contains in hasTerminalContainerWaitingError
- Consolidate pod list fetch: fetch pods once per job and pass to both hasTerminalContainerWaitingError and FetchPodWarningEvents to avoid redundant K8s API calls
- Update FetchPodWarningEvents signature to accept *corev1.PodList instead of jobName
- Update all callers (reconciler, worker/kubernetes.go, tests)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Assisted-by: Claude Code:claude [Claude Code]
* Update backend.go
---------
Signed-off-by: Liam Beckman <lbeckman314@gmail.com>
Co-authored-by: Sai Shanmukha <nss10@outlook.com>
Overview 🌀
This PR address Issue #71 Clean Orphaned Resources as Go routine + PVC Finalizers by adding improvements to how ServiceAccounts and related task resources are managed by Funnel.
Current Behavior⚠️
In Funnel 2026-04-21,
cleanOrphanedResourceswas moved to run at app startup. However, it was implemented as a blocking call, which causes health checks to fail when there are multiple tasks requiring cleanup. Additionally, after running for some time, the Kubernetes API becomes rate limited, causing the pod to crash.Proposed fixes:
Convert to a goroutine: — Run
cleanOrphanedResourcesasynchronously so it no longer blocks startup and health checks can proceed normally.Prevent Kubernetes API rate limiting — Implement a batched deletion strategy with a sleep interval between batches to spread out API calls and stay within rate limits.
New Behavior ✔️
Added 5 second delay to avoid race conditions when cleaning up ServiceAccounts (
serviceaccount.go)Removed code cleaning up Namespace-scoped resources in favor of automatic K8s Garbage Collection via Ownership fields (
backend.go)Breaking Changes? ❌
Caution
Yes! This update currently breaks the TTL config first introduced by PR #1357.
This feature is being re-introduced as part of PR #1410 to avoid breaking existing configurations.