From 277adc3de579aa80538d2635b02d0c4ca053e8fd Mon Sep 17 00:00:00 2001 From: Hongchao Deng Date: Thu, 27 Oct 2016 19:41:03 -0700 Subject: [PATCH] k8s: delete pod with 0 grace period --- pkg/chaos/chaos.go | 2 +- pkg/cluster/cluster.go | 2 +- test/e2e/e2e_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/chaos/chaos.go b/pkg/chaos/chaos.go index d4049a8..5e75d86 100644 --- a/pkg/chaos/chaos.go +++ b/pkg/chaos/chaos.go @@ -60,7 +60,7 @@ func (m *Monkeys) CrushPods(ctx context.Context, ns string, ls labels.Selector, // todo: kill multiple pods in one round? tokill := pods.Items[rand.Intn(len(pods.Items))].Name - err = m.k8s.Pods(ns).Delete(tokill, nil) + err = m.k8s.Pods(ns).Delete(tokill, api.NewDeleteOptions(0)) if err != nil { logrus.Errorf("failed to kill pod %v: %v", tokill, err) continue diff --git a/pkg/cluster/cluster.go b/pkg/cluster/cluster.go index 6d87f1a..d6d7bc0 100644 --- a/pkg/cluster/cluster.go +++ b/pkg/cluster/cluster.go @@ -427,7 +427,7 @@ func (c *Cluster) removePodAndService(name string) error { return err } } - err = c.kclient.Pods(c.namespace).Delete(name, nil) + err = c.kclient.Pods(c.namespace).Delete(name, k8sapi.NewDeleteOptions(0)) if err != nil { if !k8sutil.IsKubernetesResourceNotFoundError(err) { return err diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index f675078..72d877c 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -225,7 +225,7 @@ func waitSizeReachedWithFilter(f *framework.Framework, clusterName string, size, func killMembers(f *framework.Framework, names ...string) error { for _, name := range names { - err := f.KubeClient.Pods(f.Namespace.Name).Delete(name, nil) + err := f.KubeClient.Pods(f.Namespace.Name).Delete(name, api.NewDeleteOptions(0)) if err != nil { return err }