vmware-tanzu / velero

Backup and migrate Kubernetes applications and their persistent volumes
https://velero.io
Apache License 2.0
8.69k stars 1.4k forks source link

"velero restic repo get" panics if repo failed creation #2723

Closed figassis closed 4 years ago

figassis commented 4 years ago

What steps did you take and what happened: I attempted creating a pv backup through annotations, but the backup failed because the restic repo was unable to be initialized due to lack of object store credentials.

After this, doing velero restic repo get panics with a nil pointer dereference

What did you expect to happen: For velero to list the repositories (kubectl is able to) and show the failed status or show an error, not panic

Anything else you would like to add:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x201dc4b]

goroutine 1 [running]:
github.com/vmware-tanzu/velero/pkg/cmd/util/output.printResticRepo(0xc00046e600, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    /private/tmp/velero-20191108-17536-z6ry34/velero-1.2.0/src/github.com/vmware-tanzu/velero/pkg/cmd/util/output/restic_repo_printer.go:60 +0x9b
github.com/vmware-tanzu/velero/pkg/cmd/util/output.printResticRepoList(0xc0001a3810, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    /private/tmp/velero-20191108-17536-z6ry34/velero-1.2.0/src/github.com/vmware-tanzu/velero/pkg/cmd/util/output/restic_repo_printer.go:41 +0x1a0
reflect.Value.call(0x2325d60, 0x262c2a0, 0x13, 0x2572466, 0x4, 0xc0006cb580, 0x2, 0x2, 0x100be6f, 0x2501600, ...)
    /usr/local/Cellar/go/1.13.4/libexec/src/reflect/value.go:460 +0x5f6
reflect.Value.Call(0x2325d60, 0x262c2a0, 0x13, 0xc0006cb580, 0x2, 0x2, 0xc0001a3810, 0x0, 0x0)
    /usr/local/Cellar/go/1.13.4/libexec/src/reflect/value.go:321 +0xb4
github.com/vmware-tanzu/velero/vendor/k8s.io/kubernetes/pkg/printers.printRowsForHandlerEntry(0x283ed80, 0xc000634480, 0xc000630370, 0x2860860, 0xc0001a3810, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    /private/tmp/velero-20191108-17536-z6ry34/velero-1.2.0/src/github.com/vmware-tanzu/velero/vendor/k8s.io/kubernetes/pkg/printers/tableprinter.go:288 +0x23c
github.com/vmware-tanzu/velero/vendor/k8s.io/kubernetes/pkg/printers.(*HumanReadablePrinter).PrintObj(0xc0006602c0, 0x2860860, 0xc0001a3810, 0x283ed80, 0xc000634480, 0x0, 0x0)
    /private/tmp/velero-20191108-17536-z6ry34/velero-1.2.0/src/github.com/vmware-tanzu/velero/vendor/k8s.io/kubernetes/pkg/printers/tableprinter.go:114 +0x500
github.com/vmware-tanzu/velero/pkg/cmd/util/output.printTable(0xc000359180, 0x2860860, 0xc0001a3810, 0x2573b7b, 0x5, 0x0)
    /private/tmp/velero-20191108-17536-z6ry34/velero-1.2.0/src/github.com/vmware-tanzu/velero/pkg/cmd/util/output/output.go:163 +0x443
github.com/vmware-tanzu/velero/pkg/cmd/util/output.PrintWithFormat(0xc000359180, 0x2860860, 0xc0001a3810, 0x0, 0x0, 0x0)
    /private/tmp/velero-20191108-17536-z6ry34/velero-1.2.0/src/github.com/vmware-tanzu/velero/pkg/cmd/util/output/output.go:113 +0x180
github.com/vmware-tanzu/velero/pkg/cmd/cli/restic/repo.NewGetCommand.func1(0xc000359180, 0xc0005557c0, 0x0, 0x2)
    /private/tmp/velero-20191108-17536-z6ry34/velero-1.2.0/src/github.com/vmware-tanzu/velero/pkg/cmd/cli/restic/repo/get.go:55 +0x2e6
github.com/vmware-tanzu/velero/vendor/github.com/spf13/cobra.(*Command).execute(0xc000359180, 0xc000555780, 0x2, 0x2, 0xc000359180, 0xc000555780)
    /private/tmp/velero-20191108-17536-z6ry34/velero-1.2.0/src/github.com/vmware-tanzu/velero/vendor/github.com/spf13/cobra/command.go:766 +0x2aa
github.com/vmware-tanzu/velero/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc0001a4a00, 0x6, 0xc0001a4a00, 0x6)
    /private/tmp/velero-20191108-17536-z6ry34/velero-1.2.0/src/github.com/vmware-tanzu/velero/vendor/github.com/spf13/cobra/command.go:852 +0x2ea
github.com/vmware-tanzu/velero/vendor/github.com/spf13/cobra.(*Command).Execute(...)
    /private/tmp/velero-20191108-17536-z6ry34/velero-1.2.0/src/github.com/vmware-tanzu/velero/vendor/github.com/spf13/cobra/command.go:800
main.main()
    /private/tmp/velero-20191108-17536-z6ry34/velero-1.2.0/src/github.com/vmware-tanzu/velero/cmd/velero/main.go:34 +0x95

Environment:

ashish-amarnath commented 4 years ago

@figassis This bug that you are hitting has been fixed in https://github.com/vmware-tanzu/velero/pull/2315 I would recommend updating to a more recent version of Velero to get this fix.

I am going to mark this issue as closed. But feel free to reopen if you run into the same issue again.