fix: Update Funnel resource cleanup all K8s resources (including Worker + Executor jobs)#1423
Merged
Merged
Conversation
Signed-off-by: Liam Beckman <lbeckman314@gmail.com>
- K8s fake client does not support cascading delete from Owner field Signed-off-by: Liam Beckman <lbeckman314@gmail.com>
Signed-off-by: Liam Beckman <lbeckman314@gmail.com>
[skip ci] Signed-off-by: Liam Beckman <lbeckman314@gmail.com>
Signed-off-by: Liam Beckman <lbeckman314@gmail.com>
…ources Signed-off-by: Liam Beckman <lbeckman314@gmail.com> Assisted-by: Claude:claude-sonnet-4-5
Gen3 Integration Tests
|
lbeckman314
added a commit
that referenced
this pull request
May 29, 2026
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]
lbeckman314
commented
Jun 3, 2026
| } | ||
| } | ||
| // TODO: Add Executor Jobs here beacause orphaned tasks can result in orphaned jobs | ||
|
|
Contributor
Author
There was a problem hiding this comment.
- Never added support here to clean orphaned Executor Jobs (orphaned worker jobs are already handled in
cleanOrphanedResources)
Recommended Steps (Credit: @nss10):
-
- Need to make sure that job completed (terminal)
-
- Ensure DeleteJob is triggered (to clean up the Executor job)
Important
- Take initial pass to add this support along with new tests
- Then update team to review/pair-program as needed!
Gen3 Integration Tests
|
lbeckman314
added a commit
that referenced
this pull request
Jun 3, 2026
…1421) * 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> * 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] --------- Signed-off-by: Liam Beckman <lbeckman314@gmail.com>
Gen3 Integration Tests
|
Gen3 Integration Tests
|
Gen3 Integration Tests
|
Gen3 Integration Tests
|
Contributor
Author
|
Caution Note to Self: The requested task above was not addressed before this PR was merged! Moving forward ensure that all PR's are reviewed in full (or marked as draft) before merging... |
2 tasks
lbeckman314
added a commit
that referenced
this pull request
Jun 9, 2026
* 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> * 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 support for cleaning orphaned Executor jobs Signed-off-by: Liam Beckman <lbeckman314@gmail.com> * fix: Test + lint errors * fix: Linting errors Signed-off-by: Liam Beckman <lbeckman314@gmail.com> --------- Signed-off-by: Liam Beckman <lbeckman314@gmail.com>
lbeckman314
added a commit
that referenced
this pull request
Jun 10, 2026
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview 🌀
This PR addresses review comments from PR #1421 by removing all resources tagged with an ownership field from
cleanOrphanedResources.Resources with an ownership field will be automatically cleaned up by the Kubernetes Garbage Collector upon task completion.
Note
This support will likely be adapted into an external
cronjob.yamlHelm Chart file to clean resources externally on a user-managed schedule!