<#7478 Don't panic when receiving status in k8s re...
# flyte-github
a
#7478 Don't panic when receiving status in k8s resolver Pull request opened by Sovietaced Why are the changes needed? The resolver panics when the k8s resolver watcher receives a
*v1.Status
messages instead of a
v1.Endpoints
.
Copy code
panic: interface conversion: runtime.Object is *v1.Status, not *v1.Endpoints [recovered, repanicked]

goroutine 310 [running]:
k8s.io/apimachinery/pkg/util/runtime.handleCrash({0x36d4520, 0x208a036b6310}, {0x2ee8d20, 0x208ec806eab0}, {0x0, 0x0, 0x208a44769b38?})
  /go/pkg/mod/k8s.io/apimachinery@v0.34.1/pkg/util/runtime/runtime.go:114 +0x1a9
k8s.io/apimachinery/pkg/util/runtime.HandleCrashWithContext({0x36d4520, 0x208a036b6310}, {0x0, 0x0, 0x0})
  /go/pkg/mod/k8s.io/apimachinery@v0.34.1/pkg/util/runtime/runtime.go:78 +0x55
panic({0x2ee8d20?, 0x208ec806eab0?})
  /usr/local/go/src/runtime/panic.go:860 +0x13a
github.com/flyteorg/flyte/flytestdlib/resolver.(*kResolver).run(0x208a0239f300)
  /go/src/github.com/flyteorg/flytestdlib/resolver/k8s_resolver.go:190 +0x8de
k8s.io/apimachinery/pkg/util/wait.BackoffUntil.func1({0x0?, 0x7f1b6cc3c000?})
  /go/pkg/mod/k8s.io/apimachinery@v0.34.1/pkg/util/wait/backoff.go:233 +0x13
k8s.io/apimachinery/pkg/util/wait.BackoffUntilWithContext.func1({0x36d4520?, 0x208a036b6310?}, 0x42532f?)
  /go/pkg/mod/k8s.io/apimachinery@v0.34.1/pkg/util/wait/backoff.go:255 +0x51
k8s.io/apimachinery/pkg/util/wait.BackoffUntilWithContext({0x36d4520, 0x208a036b6310}, 0x208a44769f50, {0x3694840, 0x208a02fa4090}, 0x1)
  /go/pkg/mod/k8s.io/apimachinery@v0.34.1/pkg/util/wait/backoff.go:256 +0xe5
k8s.io/apimachinery/pkg/util/wait.BackoffUntil(0x208a02c888a0?, {0x3694840?, 0x208a02fa4090?}, 0x50?, 0x0?)
  /go/pkg/mod/k8s.io/apimachinery@v0.34.1/pkg/util/wait/backoff.go:233 +0x46
k8s.io/apimachinery/pkg/util/wait.JitterUntil(0x208a036a1040, 0x0, 0x0, 0x1, 0x208a036b6310)
  /go/pkg/mod/k8s.io/apimachinery@v0.34.1/pkg/util/wait/backoff.go:210 +0x7f
k8s.io/apimachinery/pkg/util/wait.Until(...)
  /go/pkg/mod/k8s.io/apimachinery@v0.34.1/pkg/util/wait/backoff.go:163
created by github.com/flyteorg/flyte/flytestdlib/resolver.(*kubeBuilder).Build in goroutine 308
  /go/src/github.com/flyteorg/flytestdlib/resolver/k8s_resolver.go:106 +0x2f8
What changes were proposed in this pull request? Instead of unconditionally casting to endpoints check if the cast was successful. How was this patch tested? Tested in our production environment Labels Please add one or more of the following labels to categorize your PR: • added: For new features. • changed: For changes in existing functionality. • deprecated: For soon-to-be-removed features. • removed: For features being removed. • fixed: For any bug fixed. • security: In case of vulnerabilities This is important to improve the readability of release notes. Setup process Screenshots Check all the applicable boxes • I updated the documentation accordingly. • All new and existing tests passed. • All commits are signed-off. Related PRs Stack If you do use
git town
to manage PR Stacks, the stack relevant to this PR will show below. Otherwise, you can ignore this section. Docs link flyteorg/flyte