-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Expected Behavior
When a user sets the tekton.dev/auto-cleanup-pvc annotation on a parent PipelineRun, only the parent PipelineRun's VolumeClaimTemplate PVCs should be cleaned up after completion. Child PipelineRuns created via Pipeline-in-Pipeline should not inherit this annotation.
Actual Behavior
The tekton.dev/auto-cleanup-pvc annotation propagates to child PipelineRuns through createChildResourceAnnotations in pkg/reconciler/pipelinerun/pipelinerun.go. This function only filters out chains.tekton.dev/* annotations, allowing all other annotations (including tekton.dev/auto-cleanup-pvc) to propagate to child PipelineRuns.
This causes child PipelineRun VolumeClaimTemplate PVCs to also be auto-deleted on completion — unexpected behavior for users who only intended parent PVC cleanup.
Steps to Reproduce the Problem
- Create a Pipeline that uses Pipeline-in-Pipeline (alpha feature)
- Create a PipelineRun with
tekton.dev/auto-cleanup-pvc: "true"annotation - Both parent and child PipelineRuns create VolumeClaimTemplate PVCs
- On completion, child PipelineRun PVCs are also deleted (unexpected)
Additional Info
- Found during review of PR feat: add optional PVC auto-cleanup annotation for workspaces mode #9354 (feat: add optional PVC auto-cleanup annotation for workspaces mode)
- The
createChildResourceAnnotationsfunction filters onlychains.tekton.dev/*— should also filtertekton.dev/auto-cleanup-pvc - Pipeline-in-Pipeline is an alpha feature, so blast radius is limited
- Fix: add
tekton.dev/auto-cleanup-pvcto the annotation filter list increateChildResourceAnnotations