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

move port splitting to common place; add to node resource location #7073

Merged
merged 1 commit into from Apr 21, 2015

Conversation

lavalamp
Copy link
Member

No description provided.

@lavalamp
Copy link
Member Author

To unblock the UI PR.

@yllierop
Copy link
Contributor

@lavalamp: I'll try now.

@yllierop
Copy link
Contributor

@lavalamp this seems to work as expected. I can now do requests like: https://104.154.67.146/api/v1beta2/proxy/nodes/kubernetes-minion-grly.c.shared-kraken.internal:4194/api/v1.1/machine/ thanks!

//
// Port is returned as a string, and it is not required to be numeric (could be
// used for a named port, for example).
func SplitPort(id string) (name, port string, valid bool) {
Copy link
Contributor

Choose a reason for hiding this comment

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

given that in all cases you test valid and then return an error, perhaps just return an error instead of the 'valid' bool?

Copy link
Member Author

Choose a reason for hiding this comment

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

The error is different in all three places, though... I also don't think util can return an api error (dependency goes the other direction), and if I return a regular error, then it has to get wrapped in all three places anyway.

@brendandburns
Copy link
Contributor

Basically LGTM, small comment on a refactor that I think makes the code cleaner.

@yllierop
Copy link
Contributor

@brendanburns can this be merged as-is as I think @lavalamp is correct unless I'm missing something.

@piosz
Copy link
Member

piosz commented Apr 21, 2015

I agree with @lavalamp.

@piosz piosz added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 21, 2015
piosz added a commit that referenced this pull request Apr 21, 2015
move port splitting to common place; add to node resource location
@piosz piosz merged commit 27daa29 into kubernetes:master Apr 21, 2015
"strings"
)

// Takes a string of the form "name:port" or "name".
Copy link
Member

Choose a reason for hiding this comment

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

This is very similar to but different from http://golang.org/pkg/net/#SplitHostPort - is it worthwhile, really? or should we thunk down to that when we can?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, we can investigate whether we can just use that. I wanted to at least get these three cases consistent, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm "Looks good to me", indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants