Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don’t complain when object is not found during cleanup #759

Merged
merged 1 commit into from
Jun 28, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/skaffold/deploy/kubectl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/skaffold/deploy/kubectl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
}
Expand Down