Skip to content

Commit

Permalink
Omit NotFound when cleaning up the Affinity Assistant
Browse files Browse the repository at this point in the history
The PipelineRun reconciler cleanup the affinity assistant
when the PipelineRun is completed. If the cleanup-function
is called more than once, the DELETE request will return
a NotFound response. It does not make sense to return NotFound
responses as an error, since this is what we want to achieve.

(cherry picked from commit 204a403)
  • Loading branch information
jlpettersson authored and tekton-robot committed Sep 14, 2020
1 parent e409071 commit 4e23d50
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/reconciler/pipelinerun/affinity_assistant.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ func (c *Reconciler) cleanupAffinityAssistants(pr *v1beta1.PipelineRun) error {
for _, w := range pr.Spec.Workspaces {
if w.PersistentVolumeClaim != nil || w.VolumeClaimTemplate != nil {
affinityAssistantStsName := getAffinityAssistantName(w.Name, pr.Name)
if err := c.KubeClientSet.AppsV1().StatefulSets(pr.Namespace).Delete(affinityAssistantStsName, &metav1.DeleteOptions{}); err != nil {
if err := c.KubeClientSet.AppsV1().StatefulSets(pr.Namespace).Delete(affinityAssistantStsName, &metav1.DeleteOptions{}); err != nil && !apierrors.IsNotFound(err) {
errs = append(errs, fmt.Errorf("failed to delete StatefulSet %s: %s", affinityAssistantStsName, err))
}
}
Expand Down

0 comments on commit 4e23d50

Please sign in to comment.