From 4c159a29de335177fa29cb826f59daaf98781779 Mon Sep 17 00:00:00 2001 From: David Gageot Date: Thu, 28 Jun 2018 08:20:40 +0200 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20complain=20when=20object=20is?= =?UTF-8?q?=20not=20found=20during=20cleanup?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: David Gageot --- pkg/skaffold/deploy/kubectl.go | 2 +- pkg/skaffold/deploy/kubectl_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/skaffold/deploy/kubectl.go b/pkg/skaffold/deploy/kubectl.go index 2050d538096..d079a3fd87f 100644 --- a/pkg/skaffold/deploy/kubectl.go +++ b/pkg/skaffold/deploy/kubectl.go @@ -90,7 +90,7 @@ func (k *KubectlDeployer) Cleanup(ctx context.Context, out io.Writer) error { return errors.Wrap(err, "reading manifests") } - if err := kubectl(manifests.reader(), out, k.kubeContext, "delete", "-f", "-"); err != nil { + if err := kubectl(manifests.reader(), out, k.kubeContext, "delete", "--ignore-not-found=true", "-f", "-"); err != nil { return errors.Wrap(err, "deleting manifests") } diff --git a/pkg/skaffold/deploy/kubectl_test.go b/pkg/skaffold/deploy/kubectl_test.go index 6c2aca61f0e..9111c3dd0ba 100644 --- a/pkg/skaffold/deploy/kubectl_test.go +++ b/pkg/skaffold/deploy/kubectl_test.go @@ -162,14 +162,14 @@ func TestKubectlCleanup(t *testing.T) { cfg: &v1alpha2.KubectlDeploy{ Manifests: []string{"test/deployment.yaml"}, }, - command: testutil.NewFakeCmd("kubectl --context kubecontext delete -f -", nil), + command: testutil.NewFakeCmd("kubectl --context kubecontext delete --ignore-not-found=true -f -", nil), }, { description: "cleanup error", cfg: &v1alpha2.KubectlDeploy{ Manifests: []string{"test/deployment.yaml"}, }, - command: testutil.NewFakeCmd("kubectl --context kubecontext delete -f -", errors.New("BUG")), + command: testutil.NewFakeCmd("kubectl --context kubecontext delete --ignore-not-found=true -f -", errors.New("BUG")), shouldErr: true, }, }