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

restrict externalTrafficPolicy=Local interpretation only to NodePort and LoadBalancer services #819

Merged
merged 2 commits into from
Jan 22, 2020

Conversation

murali-reddy
Copy link
Member

  • change only impacts how IPVS service and service endpoints are configured for clusterIP service
  • current behaviour for NodePort and LoadBalancer services remains same
  • current behaviour for advertising the service VIP's remains same

Fixes #818

Copy link
Contributor

@DandyDeveloper DandyDeveloper left a comment

Choose a reason for hiding this comment

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

This is purely a language change and minor cleanup? If so, looks good.

Copy link
Collaborator

@aauren aauren left a comment

Choose a reason for hiding this comment

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

When I tested this in our cluster I found that while the IPVS endpoints were getting created on the node after this change, they weren't populated with any endpoints (I commented in the code where I think the issue with the endpoints is coming from). I think that where we want to try to get to is:

service.local service on a node WITH an endpoint:

NodeIP (if exists): Is configured
ExternalIP (if exists): Is configured
ClusterIP: Is configured

IPVS Routing: Configured with ONLY pod endpoints that are local to the host

service.local service on a node WITHOUT an endpoint:

NodeIP (if exists): Not configured (external traffic should not be ingressing on this node)
ExternalIP (if exists): Not configured (external traffic should not be ingressing on this node)
ClusterIP: Not BGP announced (internal traffic that is trying to route natively should not be ingressing on this node)

IPVS Routing: Configured with ALL pods endpoints of the service (so non-BGP announced cluster IP traffic can route from this node)

@@ -910,6 +905,11 @@ func (nsc *NetworkServicesController) syncIpvsServices(serviceInfoMap serviceInf
var clusterServiceId = generateIpPortId(svc.clusterIP.String(), svc.protocol, strconv.Itoa(svc.port))
activeServiceEndpointMap[clusterServiceId] = make([]string, 0)

if svc.local && !hasActiveEndpoints(svc, endpoints) {
glog.V(1).Infof("Skipping NodePort/LoadBalancer service %s/%s as it does not have active endpoints\n", svc.namespace, svc.name)
continue
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think that the problem is that if you continue here, then you end up with an IPVS service without any endpoints in it as endpoints are added below in the other section you modified.

So you need to make it to the section below, but you don't want to run anything imbetween. Probably the easiest way would be to abstract the nodeport and externalIP stuff into their own methods, then gate them by a variation of this if statement.

@murali-reddy
Copy link
Member Author

@aauren thanks for the review. I have addressed the issue you raised.

I have also taken this opportunity to restructure the sync logic to be more modular PTAL

@murali-reddy murali-reddy merged commit 27ec314 into master Jan 22, 2020
murali-reddy added a commit that referenced this pull request Jan 22, 2020
…odePort and LoadBalancer services (#819)"

This reverts commit 27ec314.
murali-reddy added a commit that referenced this pull request Jan 22, 2020
…odePort and LoadBalancer services (#819)" (#835)

This reverts commit 27ec314.
@murali-reddy
Copy link
Member Author

murali-reddy commented Jan 22, 2020

Accidentally merge and closed this PR.

I have opened new PR #836

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.

restrict externalTrafficPolicy=Local interpretation only to NodePort and LoadBalancer services
3 participants