Skip to content

feat: Add pod-free wait-for-delete resource action. Fixes #15874#15875

Open
AndreKurait wants to merge 1 commit intoargoproj:mainfrom
AndreKurait:feat/wait-for-delete-resource-action
Open

feat: Add pod-free wait-for-delete resource action. Fixes #15874#15875
AndreKurait wants to merge 1 commit intoargoproj:mainfrom
AndreKurait:feat/wait-for-delete-resource-action

Conversation

@AndreKurait
Copy link
Copy Markdown
Contributor

Fixes #15874

Motivation

There is currently no clean way to block a workflow until a Kubernetes resource is fully deleted without creating a pod. Users resort to script templates running kubectl wait --for=delete in a loop, which incurs pod scheduling, image pull, and memory overhead for what is fundamentally a single API call.

This adds a new pod-free action: wait with waitFor: delete for resource templates, following the same controller-side pattern used by Suspend nodes.

Modifications

  • API (workflow_types.go): Added wait to the Action enum and a new WaitFor field (enum: delete) on ResourceTemplate.
  • Validation (validate.go): waitFor is required when action: wait, forbidden otherwise. successCondition, failureCondition, and outputs are disallowed with wait.
  • Controller (operator.go): executeResource intercepts action: wait before pod creation. checkResourceWaitForDelete uses the dynamic client to check resource existence — 404 means succeeded, exists means requeue. podReconciliation skips wait-action nodes so they are not flagged as pod-missing.
  • Controller (controller.go): Added a restMapper to resolve GVK → GVR for the dynamic client GET.
  • CRDs/OpenAPI: Regenerated via controller-gen and openapi-gen.

Verification

  • Unit tests (operator_test.go): Two test cases — resource already deleted (→ Succeeded), resource still exists (→ Running, no pod created).
  • Unit tests (validate_test.go): Five test cases covering valid usage and all invalid combinations (missing waitFor, waitFor on non-wait action, with successCondition, with outputs).
  • Existing test regression: Updated TestInvalidResourceWorkflow expected error message to include wait in the valid actions list. Full workflow/controller (82s) and workflow/validate test suites pass.
  • E2E test (resource_template_test.go): TestWaitForDeleteAlreadyGone — submits a workflow that waits for a non-existent ConfigMap, expects immediate success.
  • Lint: golangci-lint v2.11.3 passes with 0 issues. go vet clean. Feature doc validated.

Documentation

  • docs/resource-template.md: Added "Wait for Resource Deletion" section with usage example.
  • .features/pending/wait-for-delete-resource-action.md: Feature description file for release notes.
  • The waitFor enum is designed for future extension (e.g. waitFor: condition) without breaking changes.

@AndreKurait AndreKurait force-pushed the feat/wait-for-delete-resource-action branch 3 times, most recently from 24f598f to cfe2876 Compare April 7, 2026 03:41


Signed-off-by: Andre Kurait <andre@kurait.com>

Signed-off-by: Andre Kurait <andrekurait@gmail.com>
@AndreKurait AndreKurait force-pushed the feat/wait-for-delete-resource-action branch from cfe2876 to 6b05505 Compare April 7, 2026 13:38
@AndreKurait AndreKurait marked this pull request as ready for review April 7, 2026 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Pod-free action: wait with waitFor: delete for resource templates

1 participant