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: get wrong node ip on k8s #100

Merged
merged 3 commits into from
Sep 18, 2023
Merged

fix: get wrong node ip on k8s #100

merged 3 commits into from
Sep 18, 2023

Conversation

rugalcrimson
Copy link
Contributor

@rugalcrimson rugalcrimson commented Sep 14, 2023

What is the purpose of the change

#101
node.getStatus().getAddresses().get(0).getAddress() will retrun hostname on k8s

# kubectl get node node1 -o yaml|grep addresses -A 6|tail -7
  addresses:
  - address: node1
    type: Hostname
  - address: xxxxx
    type: ExternalIP
  - address: xxxxx
    type: InternalIP

Brief changelog

It is best to associate an existing issue

Verifying this change

Do I need to test?
Has testing been completed?
Test method?

Follow this checklist to help us incorporate your contribution quickly and easily. Notice, it would be helpful if you could finish the following 3 checklist before request the community to review your PR.

  • Make sure there is a Github issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Follow the git commit specification
    • feat: xxx -> The feat type is used to identify production changes related to new backward-compatible abilities or functionality.
    • perf: xxx -> The perf type is used to identify production changes related to backward-compatible performance improvements.
    • fix: xxx -> The fix type is used to identify production changes related to backward-compatible bug fixes.
    • docs: xxx -> The docs type is used to identify documentation changes related to the project - whether intended externally for the end users (in case of a library) or internally for the developers.
    • test: xxx -> The test type is used to identify development changes related to tests - such as refactoring existing tests or adding new tests.
    • refactor: xxx -> The refactor type is used to identify development changes related to modifying the codebase, which neither adds a feature nor fixes a bug - such as removing redundant code, simplifying the code, renaming variables, etc.

@rugalcrimson rugalcrimson changed the title fix: get wrong ip on k8s fix: get wrong node ip on k8s Sep 14, 2023
Copy link
Collaborator

@Pandas886 Pandas886 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a Good Improvement !

@@ -149,7 +151,9 @@ public ResultDTO<List<NodeInfoVO>> listNode(Integer clusterId) {
Map<String, Node> nodeMap = items.stream().collect(Collectors.toMap(new Function<Node, String>() {
@Override
public String apply(Node node) {
return node.getStatus().getAddresses().get(0).getAddress();
return node.getStatus().getAddresses().stream().filter(n -> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same code should be reused

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

redundancy code reused

@Pandas886 Pandas886 merged commit 9f38ea1 into dromara:dev Sep 18, 2023
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