Skip to content

Support Pipeline Cascade Delete #1091

@yangfan0328

Description

@yangfan0328

Is your feature request related to a problem? Please describe.
Currently, Users can delete a pipeline through MA command directly, but only pipeline CR is deleted. No related CR is deleted correspondingly. Users can't just delete TriggerRuns, and they have to manually kill them first if they're running. The correct delete order is::
Kill non-terminated TriggerRuns → Check all TriggerRuns and PipelineRuns in terminated states → Delete TriggerRuns → Delete PipelineRuns → Delete Pipeline
And this is managed by the user with full responsibility, this will increase system management burden if no concrete delete design is implemented in the backend.

Describe the solution you'd like

  1. TriggerRunManager interface
    File: shared/libs/triggerrun/manager.go
    Add three new methods to the Manager interface:
type Manager interface {
    ListActiveTriggerRuns(ctx context.Context, namespace, pipelineName string) ([]*triggerrunv1.TriggerRun, error)
    KillTriggerRun(ctx context.Context, namespace, name string) error
    DeleteAllTriggerRuns(ctx context.Context, namespace, pipelineName string) error
}
  1. PipelineRunManager interface
    File: shared/libs/pipelinerun/manager.go
    Add three new methods to the Manager interface:
type Manager interface {
    ListActivePipelineRuns(ctx context.Context, namespace, pipelineName string) ([]*pipelinerunv1.PipelineRun, error)
    KillPipelineRun(ctx context.Context, namespace, name string) error
    DeleteAllPipelineRuns(ctx context.Context, namespace, pipelineName string) error
}
  1. Controller finalizer: kill + wait + delete loop
    File: controllermgr/pkg/controllers/pipeline/controller.go
    Replace current best-effort delete block with full cascaded kill + wait loop

Describe alternatives you've considered
Option A: Synchronous cascaded delete at ma pipeline delete call time
Option B: Async/background cleanup job (soft delete + GC)
Option C: pipeline Controller implementation as internal, k8s idiomatic -> final decision
Option D: pipeline hook implementation

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions