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 master service endpoint system for multiple masters #7273

Merged
1 commit merged into from May 5, 2015

Conversation

lavalamp
Copy link
Member

Closes #6572.

@thockin I can't see any reason why the old system won't still work?

@lavalamp
Copy link
Member Author

Also, @davidopp

@davidopp davidopp self-assigned this Apr 24, 2015
// So we *always* add our own IP address to the end, and if
// there are too many IP addresses, we remove from the
// beginning. Given the requirements stated at the top of this
// function, this should cause the list of IP addresses to
Copy link
Member

Choose a reason for hiding this comment

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

Address structures are sorted by IP - what am I missing? I guess it could NOT sort, but that would potentially trigger false updates.

Why not just detect that you have too many and remove one at random. That should still converge, no?

Copy link
Member Author

Choose a reason for hiding this comment

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

We sort by IP? Why? What component does that?

Copy link
Member Author

Choose a reason for hiding this comment

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

I will make it sort and then delete the address(es) that come after it's own address. I think that has faster convergence properties than deleting a random one.

Copy link
Member

Choose a reason for hiding this comment

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

The sorting is done in the RepackSubsets function.

On Tue, Apr 28, 2015 at 5:33 PM, Daniel Smith notifications@github.com
wrote:

In pkg/master/publish.go
#7273 (comment)
:

  • // First, determine if the endpoint is in the format we expect (one
  • // subset, one port, N IP addresses).
  • formatCorrect, foundIP := m.checkEndpointSubsetFormat(e, ip.String(), port)
  • if !formatCorrect {
  •   // Something is egregiously wrong, just re-make the endpoints record.
    
  •   e.Subsets = []api.EndpointSubset{{
    
  •       Addresses: []api.EndpointAddress{{IP: ip.String()}},
    
  •       Ports:     []api.EndpointPort{{Port: port, Protocol: api.ProtocolTCP}},
    
  •   }}
    
  •   glog.Infof("Resetting endpoints for master service %q to %v", serviceName, e)
    
  •   return m.endpointRegistry.UpdateEndpoints(ctx, e)
    
  • } else if !foundIP {
  •   // So we _always_ add our own IP address to the end, and if
    
  •   // there are too many IP addresses, we remove from the
    
  •   // beginning. Given the requirements stated at the top of this
    
  •   // function, this should cause the list of IP addresses to
    

I will make it sort and then delete the address(es) that come after it's
own address. I think that has faster convergence properties than deleting a
random one.


Reply to this email directly or view it on GitHub
https://github.com/GoogleCloudPlatform/kubernetes/pull/7273/files#r29302403
.

@lavalamp
Copy link
Member Author

lavalamp commented May 4, 2015

Comments addressed, PTAL

e.Subsets[0].Addresses = append(e.Subsets[0].Addresses, api.EndpointAddress{IP: ip.String()})
e.Subsets = endpoints.RepackSubsets(e.Subsets)
addrs := &e.Subsets[0].Addresses
for i, addr := range *addrs {
Copy link
Member

Choose a reason for hiding this comment

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

It's minor, but this will make copies of every address struct. I've gotten into the habit (as suggested by r) to do

for i := range *addrs {
    addr := &(*addrs)[i]
    //...
}

Copy link
Member

Choose a reason for hiding this comment

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

wrap this loop with a test for len > masterCount?

Copy link
Member Author

Choose a reason for hiding this comment

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

Meh, the struct is like two words, it's hard for me to get excited about not copying it. Two word copy vs an indirection everywhere is not even a clear victory for the latter. That pattern is really only useful when you're worried about a reference escaping the loop. (or when the struct is huge, maybe)

@lavalamp
Copy link
Member Author

lavalamp commented May 5, 2015

Comments disputed or addressed :) PTAL

@thockin
Copy link
Member

thockin commented May 5, 2015

LGTM

1 similar comment
@davidopp
Copy link
Member

davidopp commented May 5, 2015

LGTM

@lavalamp
Copy link
Member Author

lavalamp commented May 5, 2015

Shippable is a flake; I can haz merge?

ghost pushed a commit that referenced this pull request May 5, 2015
fix master service endpoint system for multiple masters
@ghost ghost merged commit 8a4a39d into kubernetes:master May 5, 2015
@lavalamp lavalamp deleted the fix7 branch September 1, 2020 22:57
This pull request was closed.
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.

Provide an option on the apiserver to specify apiserver address for services
4 participants