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

pkg/proxy/userspace/roundrobin: Make lb.services nil check standardized #108257

Closed
carlosdmz opened this issue Feb 21, 2022 · 8 comments · Fixed by #108259
Closed

pkg/proxy/userspace/roundrobin: Make lb.services nil check standardized #108257

carlosdmz opened this issue Feb 21, 2022 · 8 comments · Fixed by #108259
Assignees
Labels
sig/network Categorizes an issue or PR as relevant to SIG Network. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@carlosdmz
Copy link

carlosdmz commented Feb 21, 2022

As suggested in here, some portions of the code contains the map checking for nil values in lb.services map, and others don't have. Even though we're never assigning nil values to this map, we should standardize the portions that does not have this check in roundrobin module.

Example:

state, exists := lb.services[svcPort]
return exists && state != nil && len(state.endpoints) > 0

Should be like this:

state, exists := lb.services[svcPort]
if !exists || state == nil {
      return false
}
return len(state.endpoints) > 0

I can take care of this issue.

@k8s-ci-robot k8s-ci-robot added needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Feb 21, 2022
@carlosdmz
Copy link
Author

/sig network

@k8s-ci-robot k8s-ci-robot added sig/network Categorizes an issue or PR as relevant to SIG Network. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Feb 21, 2022
@carlosdmz carlosdmz changed the title pkg/proxy/userspace/roundrobin: Make state nil check standardized pkg/proxy/userspace/roundrobin: Make lb.services nil check standardized Feb 21, 2022
@uablrek
Copy link
Contributor

uablrek commented Mar 1, 2022

There have been discussions of deprecating the user-space proxier. Maybe transfer it to kpng. A question is if anybody still uses it. Seems like you do, so if possible please explain if you have a use-case where the user-space proxier is wanted/needed.

@carlosdmz
Copy link
Author

Hey @uablrek. Actually, I was casually reading the source code and I saw a TODO over there regarding the nil checks. Regarding your question, we should check if anyone actually uses it though, or maybe discuss its usage or deprecation a little further.

@carlosdmz
Copy link
Author

Quick question though: I saw in the kpng news that the user-space proxy porting was near completion, maybe it's worth talking to them in order to check upon the status.

@thockin
Copy link
Member

thockin commented Mar 3, 2022

I don't object to making it clearer or more consistent, if you want to spend time on it, but it's not a high priority. That said, I think a nil value in that map would be really bad (and should be impossible) and I don't know how we would raise a signal about it.

@thockin
Copy link
Member

thockin commented Mar 3, 2022

let us know if you want to try to fix it, otherwise we can just close this.

@carlosdmz
Copy link
Author

carlosdmz commented Mar 4, 2022

@thockin I already opened a PR with the clearer nil checks for this specific module pkg/proxy/userspace/roundrobin.go in #108259, so you can review it. I think whether this would have nil values into the service map we should discuss this apart and try to reproduce this case (if any would happen).

@dcbw
Copy link
Member

dcbw commented Mar 17, 2022

PR submitted, so let's review and discuss further there.
/assign dcbw
/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/network Categorizes an issue or PR as relevant to SIG Network. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants