Skip to content

Commit 59a1281

Browse files
committed
fix(DSR): setup DSR inside pod on local eps only
Only attempt to setup DSR inside containers for local endpoints. Setting up DSR inside the containers network namespace requires local pods / endpoints.
1 parent 4b011db commit 59a1281

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

pkg/controllers/proxy/service_endpoints_sync.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -564,9 +564,13 @@ func (nsc *NetworkServicesController) setupExternalIPForDSRService(svc *serviceI
564564
endpoint.ip, externalIP, err)
565565
}
566566

567-
// add the external IP to a virtual interface inside the pod so that the pod can receive it
568-
if err = nsc.addDSRIPInsidePodNetNamespace(externalIP.String(), endpoint.ip); err != nil {
569-
return fmt.Errorf("unable to setup DSR receiver inside pod: %v", err)
567+
// It's only for local endpoints that we can enter the container's namespace and add DSR receivers inside it.
568+
// If we aren't local, then we should skip this step so that we don't accidentally throw an error.
569+
if endpoint.isLocal {
570+
// add the external IP to a virtual interface inside the pod so that the pod can receive it
571+
if err = nsc.addDSRIPInsidePodNetNamespace(externalIP.String(), endpoint.ip); err != nil {
572+
return fmt.Errorf("unable to setup DSR receiver inside pod: %v", err)
573+
}
570574
}
571575

572576
svcEndpointMap[externalIPServiceID] = append(svcEndpointMap[externalIPServiceID],

0 commit comments

Comments
 (0)