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

Fix node event (/node/{name}/event) can not get the whole node event #6649

Merged
merged 4 commits into from
Jan 3, 2022

Conversation

SihengCui
Copy link
Contributor

Using the kubectl command, I can get the node event like this:
image
However, on the dashboard, I cannot view any node events.
image

The reason of such problem is that, the k8s dashboard transmits node.UID to client-go for selection the involvedObject.uid of node event.

Kubectl kubectl(describe node), it use ref.UID=node.name for searching.

In kubernetes/kubernetes/issues/100236 , he reported a bug. That, the involvedObject.uid of node event may be node_uid or node_name.

So I set the uid of the search reference to "". It will not use involvedObject.uid to searching the node event, so that we can get the whole node event to handel both cases.

@SihengCui SihengCui marked this pull request as ready for review December 3, 2021 09:45
@linux-foundation-easycla
Copy link

CLA Not Signed

@k8s-ci-robot
Copy link
Contributor

Thanks for your pull request. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please follow instructions at https://git.k8s.io/community/CLA.md#the-contributor-license-agreement to sign the CLA.

It may take a couple minutes for the CLA signature to be fully registered; after that, please reply here with a new comment and we'll verify. Thanks.


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. I understand the commands that are listed here.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. label Dec 3, 2021
@k8s-ci-robot
Copy link
Contributor

Welcome @SihengCui!

It looks like this is your first PR to kubernetes/dashboard 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes/dashboard has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Dec 3, 2021
@linux-foundation-easycla
Copy link

CLA Not Signed

@SihengCui
Copy link
Contributor Author

CLA signed

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. and removed cncf-cla: no Indicates the PR's author has not signed the CNCF CLA. labels Dec 3, 2021
@SihengCui
Copy link
Contributor Author

It is a natural way to use ref.uid=node.uid to select.
But for some node events, node.uid may not be generated. So some components write node.name to the involvedObject.uid of the node event.
I have now removed the uid filter condition, Is there a better solution?
This is my first pr to cncf community, it's my pleasure to get your advise. @floreks @shu-mutou

@floreks
Copy link
Member

floreks commented Dec 3, 2021

I am wondering if keeping an empty UID won't result in getting event information from the unrelated (similar) nodes. It might be better to first try with the UID and if it will return an empty result then retry with UID set to node.name.

@SihengCui
Copy link
Contributor Author

SihengCui commented Dec 3, 2021

In my test environment, there are 9 node events at that time. 8 of them involvedObject.uid (from kubelte) are node_name , and 1 of them is node_uid.

Is it necessary to search with uid first (1 result) and then search with nodename (8 results)? finally list append the results.

If uid="", just use involvedObject.name=node.name to search. Theoretically, the node name of k8s is uniquely. But I dont know if there are risks elsewhere.

@SihengCui
Copy link
Contributor Author

SihengCui commented Dec 6, 2021

I am wondering if keeping an empty UID won't result in getting event information from the unrelated (similar) nodes. It might be better to first try with the UID and if it will return an empty result then retry with UID set to node.name.

If so, you have to find twice.
If the empty uid can meet the requirements, only use involvedObject.name=node.name to find, it might be easier.

XD kubernetes/pull/106485He also provided a similar method to solve this problem

@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Dec 16, 2021
@SihengCui
Copy link
Contributor Author

I am wondering if keeping an empty UID won't result in getting event information from the unrelated (similar) nodes. It might be better to first try with the UID and if it will return an empty result then retry with UID set to node.name.

@floreks Some new work was submitted. node,Name and node.UID are both set as node.UID for searching. At the end, The results were integrated.

@floreks
Copy link
Member

floreks commented Dec 16, 2021

Can you elaborate? Will it be fixed on the K8S core side or what?

@SihengCui
Copy link
Contributor Author

SihengCui commented Dec 16, 2021

Can you elaborate? Will it be fixed on the K8S core side or what?

@floreks
As in kubernetes/issues/100236 , node events are two situations.
I think it is caused by different core components of kubernetes. When some node events are generated, the uid of the node is not generated. Therefore the involvedObject.uid is set to node.name.

The original logic of the k8s dashboard is to query the node info first, and directly apply it to the query conditions of the node event. In this way, a part of the node event is lost, which involvedObject.uid = node.name .

In this PR, the two cases were queried separately in dashborad. Then integrate them. So the return of node event is complete.

@codecov
Copy link

codecov bot commented Dec 22, 2021

Codecov Report

Merging #6649 (a38de4d) into master (6c249bb) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #6649   +/-   ##
=======================================
  Coverage   41.89%   41.89%           
=======================================
  Files          44       44           
  Lines        1234     1234           
  Branches      163      163           
=======================================
  Hits          517      517           
  Misses        717      717           

@floreks
Copy link
Member

floreks commented Dec 23, 2021

Please fix the CI (npm run fix should be enough).

@SihengCui
Copy link
Contributor Author

Please fix the CI (npm run fix should be enough).

@floreks Sorry. I clicked the reset review by mistake. Also, please describe Fix CI in detail. This is my first submission and I am not very familiar with the process.

@SihengCui
Copy link
Contributor Author

I have changed the go imports order to fix the CI.

@floreks
Copy link
Member

floreks commented Jan 3, 2022

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 3, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: floreks, SihengCui

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 3, 2022
@k8s-ci-robot k8s-ci-robot merged commit df366ff into kubernetes:master Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants