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 e5bcea7 commit b759d1e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/await/await.go
Original file line number Diff line number Diff line change
Expand Up @@ -307,13 +307,14 @@ 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 {
} else if version.Compare(1, 7) < 0 {
// 1.6.x option. (NOTE: Background delete propagation is broken in k8s v1.6, and maybe later.)
fg := metav1.DeletePropagationForeground
deleteOpts.PropagationPolicy = &fg
Expand Down

0 comments on commit b759d1e

Please sign in to comment.