replicatedhq / troubleshoot

Preflight Checks and Support Bundles Framework for Kubernetes Applications
https://troubleshoot.sh
Apache License 2.0
543 stars 92 forks source link

fix panic in Velero analyzer when there's no Velero deployment found #1497

Closed nvanthao closed 6 months ago

nvanthao commented 6 months ago

Description, Motivation and Context

https://github.com/replicatedhq/troubleshoot/pull/1366 introduces a panic when there's no Velero Deployment found.

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

goroutine 1 [running]:
go.opentelemetry.io/otel/sdk/trace.(*recordingSpan).End.func1()
    /home/runner/go/pkg/mod/go.opentelemetry.io/otel/sdk@v1.23.0/trace/span.go:405 +0x25
go.opentelemetry.io/otel/sdk/trace.(*recordingSpan).End(0xc000ee8480, {0x0, 0x0, 0x106a36b?})
    /home/runner/go/pkg/mod/go.opentelemetry.io/otel/sdk@v1.23.0/trace/span.go:443 +0xa3b
panic({0x3301020?, 0x55ce110?})
    /opt/hostedtoolcache/go/1.21.6/x64/src/runtime/panic.go:914 +0x21f
github.com/replicatedhq/troubleshoot/pkg/analyze.getVeleroVersion({0x5660860, 0x0, 0x0}, 0xc000f29b60)
    /home/runner/work/troubleshoot/troubleshoot/pkg/analyze/velero.go:669 +0x1f1

Checklist

Does this PR introduce a breaking change?