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

Simple konn-client cleanups #343

Merged
merged 3 commits into from
Sep 9, 2022

Conversation

rata
Copy link
Contributor

@rata rata commented Mar 10, 2022

This PR doesn't make any behavior change, just cleans up the code to reduce unneeded indentations and just tries to filter out errors first for better readability.

If when you review this you think "hm, do we want to close the connection in this case instead of just continue on the loop?", I wonder the same and opened #338 to investigate that. This PR, though, is just making the current code more readable. The bugfix (if any ends up being needed) can be discussed in that issue.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 10, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @rata. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Mar 10, 2022
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Mar 10, 2022
Copy link
Member

@andrewsykim andrewsykim left a comment

Choose a reason for hiding this comment

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

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Mar 10, 2022
@rata
Copy link
Contributor Author

rata commented Mar 10, 2022

/retest

@rata
Copy link
Contributor Author

rata commented Mar 10, 2022

Tests are green now :)

@rata
Copy link
Contributor Author

rata commented Mar 17, 2022

Friendly ping? :)

@andrewsykim andrewsykim mentioned this pull request Mar 17, 2022
@andrewsykim
Copy link
Member

@rata thinking we should hold on merging non bug fixes until this is done #346, thoughts?

@rata
Copy link
Contributor Author

rata commented Mar 17, 2022

@andrewsykim SGTM, thanks!

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 15, 2022
@rata
Copy link
Contributor Author

rata commented Jun 16, 2022

/remove-lifecycle stale

We are waiting for the release before moving with more changes.

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jun 16, 2022
@rata
Copy link
Contributor Author

rata commented Jun 21, 2022

I'll rebase when there is a release and we can merge this (if that is the path agreed)

@ipochi ipochi force-pushed the rata/misc-small-fixes branch from cfbaca1 to c83bb07 Compare September 8, 2022 14:07
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 8, 2022
@ipochi
Copy link
Contributor

ipochi commented Sep 8, 2022

@rata Rebased to the latest master

@cheftako These changes are cosmetic in nature to improve readaiblity of the code.

Please review at your convenience :)

klog.V(1).InfoS("Tunnel has been closed; dropped", "connectionID", resp.ConnectID, "dialID", resp.Random)
return
}
}
Copy link
Member

Choose a reason for hiding this comment

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

nit: add a line break after this line

t.conns.remove(resp.ConnectID)
return
if !ok {
klog.V(1).InfoS("connection not recognized", "connectionID", resp.ConnectID)
Copy link
Member

Choose a reason for hiding this comment

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

Since we're making cosmetic changes here, can we start this log line with capitals (consistent with other log lines)

klog.V(1).InfoS("Tunnel has been closed, the grpc connection to the proxy server will be closed", "connectionID", conn.connID)
}
} else {
if !ok {
klog.V(1).InfoS("connection not recognized", "connectionID", resp.ConnectID)
Copy link
Member

Choose a reason for hiding this comment

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

Since we're making cosmetic changes here, can we start this log line with capitals (consistent with other log lines)

rata added 3 commits September 9, 2022 15:29
The else is pointless because the true branch has a return. Let's just
remove the else and identation for better readability.

There is no behavior change, this change is cosmetical.
Instead of having all the code inside an if, and outside just a log for
the "uninteresting" case, let's just check if the conection is not
recognize and remove the identation for the rest.

There is no behavior change, this change is cosmetical.

Signed-off-by: Rodrigo Campos <[email protected]>
Again, let's move the code out of the identation and just filter error
cases out first.

There is no behavior change, this change is cosmetical.

Signed-off-by: Rodrigo Campos <[email protected]>
@ipochi ipochi force-pushed the rata/misc-small-fixes branch from c83bb07 to 9f2918c Compare September 9, 2022 09:59
@ipochi
Copy link
Contributor

ipochi commented Sep 9, 2022

@andrewsykim Addressed your feedback.

@cheftako
Copy link
Contributor

cheftako commented Sep 9, 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 Sep 9, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cheftako, rata

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 Sep 9, 2022
@k8s-ci-robot k8s-ci-robot merged commit b5e5436 into kubernetes-sigs:master Sep 9, 2022
@ipochi ipochi deleted the rata/misc-small-fixes branch September 9, 2022 18:51
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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants