Skip to content

Commit

Permalink
chore: insert OwnerReferences param to pipelines
Browse files Browse the repository at this point in the history
sometimes the pipeline can fail and cleanup tasks are
not triggered. By inserting the ownerReferences to created
objects, when the pipelineRun fails, they can still be deleted
by deleting the pipelineRun

Signed-off-by: Karel Simon <[email protected]>
  • Loading branch information
ksimon1 committed Jul 9, 2024
1 parent a52746a commit e0e1645
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 8 deletions.
4 changes: 3 additions & 1 deletion release/pipelines/windows-customize/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,6 @@ EOF

## Cancelling/Deleting PipelineRuns

When running the example Pipelines, they create temporary objects (DataVolumes, VirtualMachines, etc.). Each Pipeline has its own clean up system which should keep the cluster clean from leftovers. In case user hard deletes or cancels running PipelineRun, the PipelineRun will not clean temporary objects and objects will stay in the cluster and then they have to be deleted manually. To prevent this behaviour, cancel the [PipelineRun gracefully](https://tekton.dev/docs/pipelines/pipelineruns/#gracefully-cancelling-a-pipelinerun). It triggers special Tasks, which remove temporary objects and keep only result DataSource/DataVolume/PVC.
When running the example Pipelines, they create temporary objects (DataVolumes, VirtualMachines, etc.). Each Pipeline has its own clean up system which should keep the cluster clean from leftovers. In case user hard deletes or cancels running PipelineRun, the PipelineRun will not clean temporary objects and objects will stay in the cluster. To prevent this behaviour, cancel the [PipelineRun gracefully](https://tekton.dev/docs/pipelines/pipelineruns/#gracefully-cancelling-a-pipelinerun). It triggers special Tasks, which remove temporary objects and keep only result DataSource/DataVolume/PVC.

Each object created by the Pipeline has OwnerReference to the Pod which created them (result DataVolume do not have it). If for some reasons the clean up steps are not triggered, delete the PipelineRun and all leftover objects created by the Pipeline will be deleted.
2 changes: 2 additions & 0 deletions release/pipelines/windows-customize/windows-customize.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ spec:
params:
- name: runStrategy
value: RerunOnFailure
- name: setOwnerReference
value: true
- name: manifest
value: |-
apiVersion: kubevirt.io/v1
Expand Down
6 changes: 3 additions & 3 deletions release/pipelines/windows-efi-installer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@ EOF

## Cancelling/Deleting PipelineRuns

When running the example Pipelines, they create temporary objects (DataVolumes, VirtualMachines, etc.). Each Pipeline has its own clean up system which should keep the cluster clean from leftovers. In case user hard deletes or cancels running PipelineRun, the PipelineRun will not clean temporary objects and objects will stay in the cluster and then they have to be deleted manually. To prevent this behaviour, cancel the [PipelineRun gracefully](https://tekton.dev/docs/pipelines/pipelineruns/#gracefully-cancelling-a-pipelinerun). It triggers special Tasks, which remove temporary objects and keep only result DataSource/DataVolume/PVC.
When running the example Pipelines, they create temporary objects (DataVolumes, VirtualMachines, etc.). Each Pipeline has its own clean up system which should keep the cluster clean from leftovers. In case user hard deletes or cancels running PipelineRun, the PipelineRun will not clean temporary objects and objects will stay in the cluster. To prevent this behaviour, cancel the [PipelineRun gracefully](https://tekton.dev/docs/pipelines/pipelineruns/#gracefully-cancelling-a-pipelinerun). It triggers special Tasks, which remove temporary objects and keep only result DataSource/DataVolume/PVC.
Each object created by the Pipeline has OwnerReference to the Pod which created them (result DataSource and DataVolume do not have it). If for some reasons the clean up steps are not triggered, delete the PipelineRun and all leftover objects created by the Pipeline will be deleted.

windows-efi-installer Pipeline generates for each PipelineRun new source DataVolume which contains imported ISO file. This DataVolume has generated name and is deleted after Pipeline succeeds. However, the created PVC will stay in cluster, but it will have terminating state. It will wait, until pipelinRun is deleted. This behaviour is caused by a fact, that PVC is mounted into modify-windows-iso TaskRun pod and PVC can be deleted only when the pod does not
exist.
windows-efi-installer Pipeline generates for each PipelineRun new source DataVolume which contains imported ISO file. This DataVolume has generated name and is deleted after Pipeline succeeds. However, the created PVC will stay in cluster, but it will have terminating state. It will wait, until pipelinRun is deleted. This behaviour is caused by a fact, that PVC is mounted into modify-windows-iso TaskRun pod and PVC can be deleted only when the pod does not exist.

#### Obtaining a download URL in an automated way

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ spec:
value: false
- name: allowReplace
value: true
- name: setOwnerReference
value: true
taskRef:
resolver: hub
params:
Expand Down Expand Up @@ -193,6 +195,8 @@ spec:
params:
- name: runStrategy
value: RerunOnFailure
- name: setOwnerReference
value: true
- name: manifest
value: |-
apiVersion: kubevirt.io/v1
Expand Down
4 changes: 3 additions & 1 deletion templates-pipelines/windows-customize/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,6 @@ oc create -f - <<EOF

## Cancelling/Deleting PipelineRuns

When running the example Pipelines, they create temporary objects (DataVolumes, VirtualMachines, etc.). Each Pipeline has its own clean up system which should keep the cluster clean from leftovers. In case user hard deletes or cancels running PipelineRun, the PipelineRun will not clean temporary objects and objects will stay in the cluster and then they have to be deleted manually. To prevent this behaviour, cancel the [PipelineRun gracefully](https://tekton.dev/docs/pipelines/pipelineruns/#gracefully-cancelling-a-pipelinerun). It triggers special Tasks, which remove temporary objects and keep only result DataSource/DataVolume/PVC.
When running the example Pipelines, they create temporary objects (DataVolumes, VirtualMachines, etc.). Each Pipeline has its own clean up system which should keep the cluster clean from leftovers. In case user hard deletes or cancels running PipelineRun, the PipelineRun will not clean temporary objects and objects will stay in the cluster. To prevent this behaviour, cancel the [PipelineRun gracefully](https://tekton.dev/docs/pipelines/pipelineruns/#gracefully-cancelling-a-pipelinerun). It triggers special Tasks, which remove temporary objects and keep only result DataSource/DataVolume/PVC.

Each object created by the Pipeline has OwnerReference to the Pod which created them (result DataVolume do not have it). If for some reasons the clean up steps are not triggered, delete the PipelineRun and all leftover objects created by the Pipeline will be deleted.
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ spec:
params:
- name: runStrategy
value: RerunOnFailure
- name: setOwnerReference
value: true
- name: manifest
value: |-
apiVersion: kubevirt.io/v1
Expand Down
6 changes: 3 additions & 3 deletions templates-pipelines/windows-efi-installer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,10 @@ oc create -f - <<EOF

## Cancelling/Deleting PipelineRuns

When running the example Pipelines, they create temporary objects (DataVolumes, VirtualMachines, etc.). Each Pipeline has its own clean up system which should keep the cluster clean from leftovers. In case user hard deletes or cancels running PipelineRun, the PipelineRun will not clean temporary objects and objects will stay in the cluster and then they have to be deleted manually. To prevent this behaviour, cancel the [PipelineRun gracefully](https://tekton.dev/docs/pipelines/pipelineruns/#gracefully-cancelling-a-pipelinerun). It triggers special Tasks, which remove temporary objects and keep only result DataSource/DataVolume/PVC.
When running the example Pipelines, they create temporary objects (DataVolumes, VirtualMachines, etc.). Each Pipeline has its own clean up system which should keep the cluster clean from leftovers. In case user hard deletes or cancels running PipelineRun, the PipelineRun will not clean temporary objects and objects will stay in the cluster. To prevent this behaviour, cancel the [PipelineRun gracefully](https://tekton.dev/docs/pipelines/pipelineruns/#gracefully-cancelling-a-pipelinerun). It triggers special Tasks, which remove temporary objects and keep only result DataSource/DataVolume/PVC.
Each object created by the Pipeline has OwnerReference to the Pod which created them (result DataSource and DataVolume do not have it). If for some reasons the clean up steps are not triggered, delete the PipelineRun and all leftover objects created by the Pipeline will be deleted.

windows-efi-installer Pipeline generates for each PipelineRun new source DataVolume which contains imported ISO file. This DataVolume has generated name and is deleted after Pipeline succeeds. However, the created PVC will stay in cluster, but it will have terminating state. It will wait, until pipelinRun is deleted. This behaviour is caused by a fact, that PVC is mounted into modify-windows-iso TaskRun pod and PVC can be deleted only when the pod does not
exist.
windows-efi-installer Pipeline generates for each PipelineRun new source DataVolume which contains imported ISO file. This DataVolume has generated name and is deleted after Pipeline succeeds. However, the created PVC will stay in cluster, but it will have terminating state. It will wait, until pipelinRun is deleted. This behaviour is caused by a fact, that PVC is mounted into modify-windows-iso TaskRun pod and PVC can be deleted only when the pod does not exist.

#### Obtaining a download URL in an automated way

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ spec:
value: false
- name: allowReplace
value: true
- name: setOwnerReference
value: true
taskRef:
{% if use_resolver_in_manifests %}
resolver: hub
Expand Down Expand Up @@ -208,6 +210,8 @@ spec:
params:
- name: runStrategy
value: RerunOnFailure
- name: setOwnerReference
value: true
- name: manifest
value: |-
apiVersion: kubevirt.io/v1
Expand Down

0 comments on commit e0e1645

Please sign in to comment.