Fix GracePeriodSeconds (#1739)
`var x int64` means the value is 0 rather than the intended nil (default). `Delete` doesn't provide a way to configure the grace period anyway so remove the variable and only override on a `force` Co-authored-by: Phil Kates <phil.kates@cartacapitalmarkets.com>mine
parent
ea18aec512
commit
403cc63ddd
|
|
@ -98,14 +98,13 @@ func (g *Generic) Delete(ctx context.Context, path string, propagation *metav1.D
|
||||||
return fmt.Errorf("user is not authorized to delete %s", path)
|
return fmt.Errorf("user is not authorized to delete %s", path)
|
||||||
}
|
}
|
||||||
|
|
||||||
const defaultKillGrace = 1
|
|
||||||
var grace int64
|
|
||||||
if force {
|
|
||||||
grace = defaultKillGrace
|
|
||||||
}
|
|
||||||
opts := metav1.DeleteOptions{
|
opts := metav1.DeleteOptions{
|
||||||
PropagationPolicy: propagation,
|
PropagationPolicy: propagation,
|
||||||
GracePeriodSeconds: &grace,
|
}
|
||||||
|
|
||||||
|
if force {
|
||||||
|
var defaultKillGrace int64 = 1
|
||||||
|
opts.GracePeriodSeconds = &defaultKillGrace
|
||||||
}
|
}
|
||||||
|
|
||||||
dial, err := g.dynClient()
|
dial, err := g.dynClient()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue