k0sproject / k0s

k0s - The Zero Friction Kubernetes
https://docs.k0sproject.io
Other
3.83k stars 368 forks source link

Several panic(..) calls that can trigger in runtime #3994

Open kke opened 9 months ago

kke commented 9 months ago

There seems to be 18 panic(..) calls, some of which can be triggered during runtime. I think most of them should be replaced/replaceable with just returning two values from those functions.

Here's all of them, some are in functions that are never used (NewFooOrDie(..)) and aren't relevant. The ones in tests should not matter much.

internal/autopilot/pkg/random/random.go
29:     panic("random is broken: " + err.Error())

internal/pkg/sysinfo/probes/linux/kernel.go
176:        panic(fmt.Sprintf("invalid kernel config: %q", config))

internal/pkg/sysinfo/probes/probes.go
177:        panic("probe not set")

internal/pkg/random/random.go
29:     panic("random is broken: " + err.Error())

static/gen_manifests.go
727:        panic("asset: Asset(" + name + "): " + err.Error())

pkg/component/controller/csrapprover_test.go
101:        panic(err)
111:        panic("invalid pem block")

pkg/component/controller/workerconfig/reconciler_test.go
835:            panic("cannot call apply() with nil resources")
841:                panic("unexpected call to apply")
923:    panic("not expected to be called in tests")

pkg/component/worker/config/config_test.go
178:        panic(err)

pkg/component/worker/utils_linux.go
20: panic("Invariant broken: this function should never be called on non-winodws platforms")

pkg/kubernetes/watch/watcher.go
82:     panic(err)

pkg/client/clientset/clientset.go
132:        panic(err)

pkg/client/clientset/typed/k0s/v1beta1/k0s_client.go
77:     panic(err)

pkg/client/clientset/typed/autopilot/v1beta2/autopilot_client.go
87:     panic(err)

pkg/client/clientset/typed/helm/v1beta1/helm_client.go
77:     panic(err)

pkg/client/clientset/fake/clientset_generated.go
44:         panic(err)
github-actions[bot] commented 8 months ago

The issue is marked as stale since no activity has been recorded in 30 days

github-actions[bot] commented 7 months ago

The issue is marked as stale since no activity has been recorded in 30 days

github-actions[bot] commented 6 months ago

The issue is marked as stale since no activity has been recorded in 30 days

github-actions[bot] commented 5 months ago

The issue is marked as stale since no activity has been recorded in 30 days

github-actions[bot] commented 4 months ago

The issue is marked as stale since no activity has been recorded in 30 days

github-actions[bot] commented 3 months ago

The issue is marked as stale since no activity has been recorded in 30 days

github-actions[bot] commented 2 months ago

The issue is marked as stale since no activity has been recorded in 30 days

github-actions[bot] commented 1 month ago

The issue is marked as stale since no activity has been recorded in 30 days

github-actions[bot] commented 2 weeks ago

The issue is marked as stale since no activity has been recorded in 30 days