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

Add port podip nodeip to tkctl upinfo #538

Merged
merged 6 commits into from
Jun 4, 2019

Conversation

shuijing198799
Copy link
Contributor

@shuijing198799 shuijing198799 commented May 30, 2019

What problem does this PR solve?

add port podip nodeip to tkctl upinfo

$ tkc list -A
NAMESPACE      NAME           PD    TIKV   TIDB   AGE
e2e-cluster1   e2e-cluster1   3/3   0/3    2/2    43h

$ tkctl use -n e2e-cluster1 -t e2e-cluster1
Tidb cluster switched to e2e-cluster1/e2e-cluster1

$ ./tkctl upinfo
Name:                  e2e-cluster1
Namespace:             e2e-cluster1
CreationTimestamp:     2019-05-29 17:01:35 +0800 CST
Status:                Normal
  Name                 State    NodeIP      PodIP        Port  
  ----                 -----    ------      -----        ----  
  e2e-cluster1-tidb-0  updated  10.192.0.4  10.244.3.44  4000:30469/TCP 
  e2e-cluster1-tidb-1  updated  10.192.0.5  10.244.2.55  4000:30469/TCP

What is changed and how it works?

Check List

Tests

  • E2E test
  • Stability test
  • Manual test (add detailed scripts or steps below)

Code changes

  • Has Go code change

Does this PR introduce a user-facing change?:

`tkctl upinfo` can show nodeIp podIp port now

@shuijing198799
Copy link
Contributor Author

/run-e2e-tests

1 similar comment
@shuijing198799
Copy link
Contributor Author

/run-e2e-tests

@shuijing198799 shuijing198799 marked this pull request as ready for review May 30, 2019 09:01
pkg/util/util.go Outdated

if len(pod.Spec.Containers) == 0 {
return nil, false
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove these three redundant lines


container, ok := util.GetContainerViaName(v1alpha1.TiDBMemberType.String(), &pod)
if !ok {
return errors.New("no tidb container")
Copy link
Contributor

Choose a reason for hiding this comment

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

As of a CLI command, it's better to render <none> or error message instead of return an error. This can guarantee that other informations are still rendered and won't be hidden by this error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

make sense

}
port, ok := getServerPort(container)
if !ok {
return errors.New("no server port")
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto

@shuijing198799 shuijing198799 requested a review from aylei May 31, 2019 02:00
@weekface
Copy link
Contributor

weekface commented May 31, 2019

Please paste the output of this command, as #387 (comment) does

aylei
aylei previously approved these changes May 31, 2019
Copy link
Contributor

@aylei aylei left a comment

Choose a reason for hiding this comment

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

LGTM

@shuijing198799
Copy link
Contributor Author

/run-e2e-tests

1 similar comment
@shuijing198799
Copy link
Contributor Author

/run-e2e-tests

@weekface
Copy link
Contributor

please add a release note.

@shuijing198799 shuijing198799 changed the title add port podip nodeip to tkctl upinfo Add port podip nodeip to tkctl upinfo May 31, 2019
@shuijing198799
Copy link
Contributor Author

/run-e2e-tests

1 similar comment
@shuijing198799
Copy link
Contributor Author

/run-e2e-tests

@tennix
Copy link
Member

tennix commented Jun 2, 2019

It's better to follow kubectl get svc to print port info, that is svc_port:node_port.

@shuijing198799
Copy link
Contributor Author

/run-e2e-tests

@shuijing198799 shuijing198799 requested a review from aylei June 3, 2019 06:27
Copy link
Contributor

@aylei aylei left a comment

Choose a reason for hiding this comment

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

LGTM

@shuijing198799
Copy link
Contributor Author

/run-e2e-tests

1 similar comment
@shuijing198799
Copy link
Contributor Author

/run-e2e-tests

@shuijing198799
Copy link
Contributor Author

/run-e2e-tests

1 similar comment
@shuijing198799
Copy link
Contributor Author

/run-e2e-tests

@shuijing198799
Copy link
Contributor Author

/run-e2e-tests

@shuijing198799 shuijing198799 merged commit 3e9a3f0 into pingcap:master Jun 4, 2019
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.

4 participants