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

Handle case where returned object from a Watch is not a Pod #132

Merged
merged 2 commits into from
Apr 17, 2023

Conversation

harjsing7
Copy link
Contributor

@harjsing7 harjsing7 commented Apr 17, 2023

Description

The Watch function, when passed in interface of v1.PodInterface assumes that the returned type is always of *corev1.Pod, this is not always the case and can result in panics. Here is a simple log of a panic that I hit:

2023-04-17T16:10:31Z | INFO | 2023/04/17 16:10:31 panic: interface conversion: runtime.Object is *v1.Status, not *v1.Pod
2023-04-17T16:10:38Z | INFO | 2023/04/17 16:10:38 
2023-04-17T16:10:38Z | INFO | 2023/04/17 16:10:38 goroutine 101 [running]:
2023-04-17T16:10:38Z | INFO | 2023/04/17 16:10:38 github.com/adobe/rules_gitops/testing/it_sidecar/stern.Watch.func1()
2023-04-17T16:10:38Z | INFO | 2023/04/17 16:10:38 	external/com_adobe_rules_gitops/testing/it_sidecar/stern/watch.go:62 +0x958
2023-04-17T16:10:38Z | INFO | 2023/04/17 16:10:38 created by github.com/adobe/rules_gitops/testing/it_sidecar/stern.Watch
2023-04-17T16:10:38Z | INFO | 2023/04/17 16:10:38 	external/com_adobe_rules_gitops/testing/it_sidecar/stern/watch.go:53 +0x305

Related Issue

Motivation and Context

Fix panic.

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@harjsing7 harjsing7 requested a review from a team as a code owner April 17, 2023 16:45
@kzadorozhny kzadorozhny merged commit 00b155e into adobe:main Apr 17, 2023
arturo-skydio pushed a commit to Skydio/rules_gitops that referenced this pull request Oct 5, 2023
* Handle cases where returned object from a watch is not a Pod
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants