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
Bug 2014420: dont crash topology page #10272
Bug 2014420: dont crash topology page #10272
Conversation
@yaacov: This pull request references Bugzilla bug 2014420, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker. 3 validation(s) were run on this bug
Requesting review from QA contact: In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
@rawagner PTAL |
@spadgett @vojtechszocs please review |
@spadgett @vojtechszocs ping |
@@ -7,7 +7,7 @@ export const referenceForGroupVersionKind = (group: string) => (version: string) | |||
) => [group, version, kind].join('~'); | |||
|
|||
export const referenceForModel = (model: K8sKind): GroupVersionKind => | |||
referenceForGroupVersionKind(model.apiGroup || 'core')(model.apiVersion)(model.kind); | |||
model && referenceForGroupVersionKind(model.apiGroup || 'core')(model.apiVersion)(model.kind); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is better than the current state but we need to look into two things
- model is required, so ideally should be handled by the caller
- why is the model not discovered
we can get this PR in and but still will be nice to dig deeper
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yaacov Is this happening in a lot of places or one place? Any reason not to fix this at the caller?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@spadgett hi, didn't find the offending call, I think it's hiding inside the dynamic creation of the kebab mechanism, but didn't dig that deep.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yaacov IMO it would be better to track that down. We don't know what other issues there might be if the model is not found. I'd like to understand what's happening better before putting in this fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@spadgett , the offending call in was using modelForGroupKind
as argument for referenceForModel
without checking the return value of modelForGroupKind
.
I added a check that an internally defined model actually exist before assuming it exist and using it even if a dynamically defined one is missing.
please re-review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rollback this change for now. I think we should discuss whether we want null checking when we move referenceForModel
to the dynamic plugin SDK. We should strive to be consistent with how we handle that across APIs in the SDK.
could be happening due to usage of |
@invincibleJai is was using |
: v?.model | ||
? referenceForModel(modelForGroupKind(v.model?.group, v.model?.kind)) | ||
: internalModel | ||
? referenceForModel(internalModel) | ||
: v?.opts?.kind; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't quite look right. We shouldn't ever be falling back to just the kind if v.model.group
is defined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@spadgett hi,
I think the logic is clearer now, please re-review
@@ -7,7 +7,7 @@ export const referenceForGroupVersionKind = (group: string) => (version: string) | |||
) => [group, version, kind].join('~'); | |||
|
|||
export const referenceForModel = (model: K8sKind): GroupVersionKind => | |||
referenceForGroupVersionKind(model.apiGroup || 'core')(model.apiVersion)(model.kind); | |||
model && referenceForGroupVersionKind(model.apiGroup || 'core')(model.apiVersion)(model.kind); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rollback this change for now. I think we should discuss whether we want null checking when we move referenceForModel
to the dynamic plugin SDK. We should strive to be consistent with how we handle that across APIs in the SDK.
/bugzilla refresh |
@yaacov: This pull request references Bugzilla bug 2014420, which is valid. 3 validation(s) were run on this bug
Requesting review from QA contact: In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
bb1b402
to
7b56eea
Compare
@spadgett please re review |
/retest |
v.model?.version && | ||
v.model?.kind && | ||
referenceForExtensionModel(v.model); | ||
const kind = internalKind || extensionKind || v?.opts?.kind; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
based on the previous code the priority for kind will be in below order
const kind = internalKind || extensionKind || v?.opts?.kind; | |
const kind = extensionKind || internalKind || v?.opts?.kind; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on internal and extension provided types with both priorities, still working, switching as suggested.
7b56eea
to
67ecdfe
Compare
/approve Thanks @yaacov, have verified the changes on the shared cluster with kubevirt and it works as expected. |
/retest |
1 similar comment
/retest |
@spadgett please re review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
: v?.model | ||
? referenceForModel(modelForGroupKind(v.model?.group, v.model?.kind)) | ||
: v?.opts?.kind; | ||
const model = v.model && modelForGroupKind(v.model?.group, v.model?.kind); // Return null for CRDs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const model = v.model && modelForGroupKind(v.model?.group, v.model?.kind); // Return null for CRDs | |
const model = v.model && modelForGroupKind(v.model.group, v.model.kind); // Return null for CRDs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hee, in ExtensionK8sGroupKindModel
only version
is optional, removing all ?
except for version
|
||
const internalKind = model && referenceForModel(model); | ||
const extensionKind = | ||
v?.model && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You have optional chaining after v
here but not above. If v
can be undefined, we should have optional chaining above (line 34).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in WatchK8sResourcesGeneric
model is optional, i'll add ? above
v?.model && | ||
v.model?.version && | ||
v.model?.kind && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
v?.model && | |
v.model?.version && | |
v.model?.kind && | |
v?.model?.version && | |
v?.model?.kind && |
: v?.opts?.kind; | ||
const model = v.model && modelForGroupKind(v.model?.group, v.model?.kind); // Return null for CRDs | ||
|
||
const internalKind = model && referenceForModel(model); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should try to use the term "reference" here rather than "kind" since "kind" means something else (although I see the return object already uses property kind
).
c384960
to
bccc60b
Compare
I moved the logic into a named method to give some semantics, I also added some types to hint what is optional and what is required. @spadgett please re-review p.s. |
@spadgett ping |
@yaacov I feel even this issue is connected https://bugzilla.redhat.com/show_bug.cgi?id=2020904 the root cause is the model not being discovered in the case of VMs with ApiDiscovery ... we need to look at why is this not getting discovered I think for VMs @rohitkrai03 @glekner any inputs? these are contributed vis dynamic extensions here |
@invincibleJai hi, dynamic plugins are loaded at runtime and may be broken, as a dev-console developer I don't want to be warry about 3rd party code braking the topology view. IMHO the dev-console should fail gracefully in this cases, currently we let dynamic plugins to break the console for all users (even those who don't use this plugin) |
yeah we should have checks and user should not see failures in topology so your changes in this PR is needed but I was trying to highlight the other issue logged here https://bugzilla.redhat.com/show_bug.cgi?id=2020904 we need dynamic discovery for the model here which is not happening looks like and if this would have happened then the user would not have encountered current issue (we should def have checks for such runtime cases, +1 for that). |
@invincibleJai yes I agree, btw/ I re-installed my cluster and the bug disappeared ... I currently don't have a cluster to reproduce and test the fix. |
@spadgett please re-review |
@spadgett please re review |
return { namespace, ...opts }; | ||
} | ||
|
||
if (model?.version) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (model?.version) { | |
if (model.version) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
} | ||
|
||
// If can't find reference for an extention model, fall back to internal reference | ||
const internalModel = modelForGroupKind(model.group, model.kind); // Return null for CRDs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why aren't we using the API version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how to get the API version at this point, modelForGroupKind
is using the store
to get it.
@spadgett what am I missing ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@spadgett help, what am I missing ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@spadgett these models are fetched form extension contributed via diff packages for topology
where resources have the model with type ExtensionK8sGroupKindModel
, where version is optional but kind group is required.
that is why modelForGroupKind
is used here to get models with group and kind and existing logic as well does that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @invincibleJai. Thanks. I'm not familiar with the topology extension points, but isn't the API version important if the extension needs to work with the data? Why was it left out?
We can make this a follow up discussion to unblock the bug fix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can make this a follow up discussion to unblock the bug fix.
This bug affect users, unblocking the bug and creating a follow up discussion makes a lot of sense to me too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK I don't want to block the bug any longer. Let's go ahead with the fix. Can we open a bug to track the follow on issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Sam, have logged one here https://bugzilla.redhat.com/show_bug.cgi?id=2039381
@yaacov based on the original ticket, have created a new one but to reproduce team would need help to get kubevirt CI cluster
and even the issue was intermittent #10272 (comment)
so if there are steps to reproduce consistently or any way to reproduce it on another cluster, pls add a comment on the ticket.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, added @gouyang to the new bugzilla.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK I don't want to block the bug any longer. Let's go ahead with the fix. Can we open a bug to track the follow on issue?
@spadgett hi, do I need to change something before you can lgtm it ?
bccc60b
to
f2d48ea
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: invincibleJai, spadgett, yaacov The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
@yaacov: All pull requests linked via external trackers have merged: Bugzilla bug 2014420 has been moved to the MODIFIED state. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
The
referenceForModel
method crash if called withmodel
undefined, this may happen in the topology page.This PR let it fail gracefully.
Screenshots:
Before:
After: