Skip to content

Commit

Permalink
Default to foreground deletion only in Kubernetes 1.6
Browse files Browse the repository at this point in the history
Background deletion was broken for much of Kubernetes 1.6, and our code
accordingly manually sets deletion to "foreground" after 1.6. This
causes pain when deleting CRDs with finalizers, which will hang until
the GC has a chance to delete them and all their dependencies, which is
quite likely to be a time longer than our timeout period.

This assumption is outdated for newer verions of Kubernetes, so this
commit will default to whatever the user has set for all versions > 1.7.
  • Loading branch information
hausdorff committed Nov 14, 2018
1 parent 85e2a75 commit 9f4317d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/await/await.go
Original file line number Diff line number Diff line change
Expand Up @@ -325,14 +325,15 @@ func Deletion(
version = client.DefaultVersion()
}

// Manually set delete propagation for Kubernetes versions < 1.6 to avoid bugs.
deleteOpts := metav1.DeleteOptions{}
if version.Compare(1, 6) < 0 {
// 1.5.x option.
boolFalse := false
// nolint
deleteOpts.OrphanDependents = &boolFalse
} else {
// 1.6.x option. (NOTE: Background delete propagation is broken in k8s v1.6, and maybe later.)
} else if version.Compare(1, 7) < 0 {
// 1.6.x option. Background delete propagation is broken in k8s v1.6.
fg := metav1.DeletePropagationForeground
deleteOpts.PropagationPolicy = &fg
}
Expand Down

0 comments on commit 9f4317d

Please sign in to comment.