Repository: cloudnativelabs/kube-router
Pull request #1598 (2024-01-11 05:58:43)

Feature: Support All Upstream Traffic Policies
Adds support for `spec.internalTrafficPolicy` (introduced in k8s v1.26) and fixes `spec.externalTrafficPolicy` to behave according to upstream indicated behavior: https://kubernetes.io/docs/reference/networking/virtual-ips/#traffic-policies

At this point, we still don't handle terminating endpoints as specified in the documentation. However, I think that this is a good bit of work, so its probably best to handle that in a future PR.

Relates to #1597 - However, #1597 won't be completely finished until we implement the specialized draining procedure and pass all traffic policy related e2e tests.

aauren: Also related to #1596

Patch:
diff --git a/.golangci.yml b/.golangci.yml
index 9972a903..2f8d0cfa 100644
--- a/.golangci.yml
+++ b/.golangci.yml
@@ -51,10 +51,14 @@ issues:
     - text: "G306:"
       linters:
         - gosec
-    # Exlude tests from long line linter
+    # Exclude tests from long line linter
     - linters:
         - lll
       path: _test\.go
+    # Exclude tests from duplicate linter
+    - linters:
+      - dupl
+      path: _test\.go
   # always show all issues rather than only showing 50 at a time
   max-issues-per-linter: 0
   # always show all issues of a type rather than showing 3
diff --git a/docs/user-guide.md b/docs/user-guide.md
index fd053c46..9fe9ae2b 100644
--- a/docs/user-guide.md
+++ b/docs/user-guide.md
@@ -253,6 +253,19 @@ Advertising LoadBalancer IPs works by inspecting the services `status.loadBalanc
 LoadBalancers like for example MetalLb. This has been successfully tested together with
 [MetalLB](https://github.com/google/metallb) in ARP mode.
 
+## Controlling Service Locality / Traffic Policies
+
+Service availability both externally and locally (within the cluster) can be controlled via the Kubernetes standard
+[Traffic Policies](https://kubernetes.io/docs/reference/networking/virtual-ips/#traffic-policies) and via the custom
+kube-router service annotation: `kube-router.io/service.local: true`.
+
+Refer to the previously linked upstream Kubernetes documentation for more information on `spec.internalTrafficPolicy`
+and `spec.externalTrafficPolicy`.
+
+In order to keep backwards compatibility the `kube-router.io/service.local: true` annotation effectively overrides
+`spec.internalTrafficPolicy` and `spec.externalTrafficPolicy` and forces kube-router to behave as if both were set to
+`Local`.
+
 ## Hairpin Mode
 
 Communication from a Pod that is behind a Service to its own ClusterIP:Port is not supported by default.  However, it
diff --git a/pkg/controllers/proxy/network_services_controller.go b/pkg/controllers/proxy/network_services_controller.go
index eef13539..e0e2642e 100644
--- a/pkg/controllers/proxy/network_services_controller.go
+++ b/pkg/controllers/proxy/network_services_controller.go
@@ -197,7 +197,8 @@ type serviceInfo struct {
 	skipLbIps                     bool
 	externalIPs                   []string
 	loadBalancerIPs               []string
-	local                         bool
+	intTrafficPolicy              *v1.ServiceInternalTrafficPolicy
+	extTrafficPolicy              *v1.ServiceExternalTrafficPolicy
 	flags                         schedFlags
 }
 
@@ -914,18 +915,21 @@ func (nsc *NetworkServicesController) buildServicesInfo() serviceInfoMap {
 			continue
 		}
 
+		intClusterPolicyDefault := v1.ServiceInternalTrafficPolicyCluster
+		extClusterPolicyDefault := v1.ServiceExternalTrafficPolicyCluster
 		for _, port := range svc.Spec.Ports {
 			svcInfo := serviceInfo{
-				clusterIP:   net.ParseIP(svc.Spec.ClusterIP),
-				clusterIPs:  make([]string, len(svc.Spec.ClusterIPs)),
-				port:        int(port.Port),
-				targetPort:  port.TargetPort.String(),
-				protocol:    strings.ToLower(string(port.Protocol)),
-				nodePort:    int(port.NodePort),
-				name:        svc.ObjectMeta.Name,
-				namespace:   svc.ObjectMeta.Namespace,
-				externalIPs: make([]string, len(svc.Spec.ExternalIPs)),
-				local:       false,
+				clusterIP:        net.ParseIP(svc.Spec.ClusterIP),
+				clusterIPs:       make([]string, len(svc.Spec.ClusterIPs)),
+				port:             int(port.Port),
+				targetPort:       port.TargetPort.String(),
+				protocol:         strings.ToLower(string(port.Protocol)),
+				nodePort:         int(port.NodePort),
+				name:             svc.ObjectMeta.Name,
+				namespace:        svc.ObjectMeta.Namespace,
+				externalIPs:      make([]string, len(svc.Spec.ExternalIPs)),
+				intTrafficPolicy: &intClusterPolicyDefault,
+				extTrafficPolicy: &extClusterPolicyDefault,
 			}
 			dsrMethod, ok := svc.ObjectMeta.Annotations[svcDSRAnnotation]
 			if ok {
@@ -971,10 +975,18 @@ func (nsc *NetworkServicesController) buildServicesInfo() serviceInfoMap {
 			}
 			_, svcInfo.hairpin = svc.ObjectMeta.Annotations[svcHairpinAnnotation]
 			_, svcInfo.hairpinExternalIPs = svc.ObjectMeta.Annotations[svcHairpinExternalIPsAnnotation]
-			_, svcInfo.local = svc.ObjectMeta.Annotations[svcLocalAnnotation]
 			_, svcInfo.skipLbIps = svc.ObjectMeta.Annotations[svcSkipLbIpsAnnotation]
-			if svc.Spec.ExternalTrafficPolicy == v1.ServiceExternalTrafficPolicyTypeLocal {
-				svcInfo.local = true
+			svcInfo.intTrafficPolicy = svc.Spec.InternalTrafficPolicy
+			svcInfo.extTrafficPolicy = &svc.Spec.ExternalTrafficPolicy
+
+			// The kube-router.io/service.local annotation has the ability to override the internal and external traffic
+			// policy that is set in the spec. In this case we set both to local when the annotation is true so that
+			// previous functionality of the annotation is best preserved.
+			if svc.ObjectMeta.Annotations[svcLocalAnnotation] == "true" {
+				intTrafficPolicyLocal := v1.ServiceInternalTrafficPolicyLocal
+				extTrafficPolicyLocal := v1.ServiceExternalTrafficPolicyLocal
+				svcInfo.intTrafficPolicy = &intTrafficPolicyLocal
+				svcInfo.extTrafficPolicy = &extTrafficPolicyLocal
 			}
 
 			svcID := generateServiceID(svc.Namespace, svc.Name, port.Name)
@@ -1025,6 +1037,7 @@ func (nsc *NetworkServicesController) buildEndpointSliceInfo() endpointSliceInfo
 	for _, obj := range nsc.epSliceLister.List() {
 		var isIPv4, isIPv6 bool
 		es := obj.(*discovery.EndpointSlice)
+		klog.V(2).Infof("Building endpoint info for EndpointSlice: %s/%s", es.Namespace, es.Name)
 		switch es.AddressType {
 		case discovery.AddressTypeIPv4:
 			isIPv4 = true
@@ -1073,6 +1086,7 @@ func (nsc *NetworkServicesController) buildEndpointSliceInfo() endpointSliceInfo
 			// changing this to .Serving which continues to include pods that are in Terminating state. For now we keep
 			// it the same.
 			if ep.Conditions.Ready == nil || !*ep.Conditions.Ready {
+				klog.V(2).Infof("Endpoint (with addresses %s) does not have a ready status, skipping...", ep.Addresses)
 				continue
 			}
 
diff --git a/pkg/controllers/proxy/service_endpoints_sync.go b/pkg/controllers/proxy/service_endpoints_sync.go
index 11b4eaff..69f45d79 100644
--- a/pkg/controllers/proxy/service_endpoints_sync.go
+++ b/pkg/controllers/proxy/service_endpoints_sync.go
@@ -107,14 +107,14 @@ func (nsc *NetworkServicesController) setupClusterIPServices(serviceInfoMap serv
 	endpointsInfoMap endpointSliceInfoMap, activeServiceEndpointMap map[string][]string) error {
 	ipvsSvcs, err := nsc.ln.ipvsGetServices()
 	if err != nil {
-		return errors.New("Failed get list of IPVS services due to: " + err.Error())
+		return fmt.Errorf("failed get list of IPVS services due to: %v", err)
 	}
 
 	for k, svc := range serviceInfoMap {
 		endpoints := endpointsInfoMap[k]
 		// First we check to see if this is a local service and that it has any active endpoints, if it doesn't there
 		// isn't any use doing any of the below work, let's save some compute cycles and break fast
-		if svc.local && !hasActiveEndpoints(endpoints) {
+		if *svc.intTrafficPolicy == v1.ServiceInternalTrafficPolicyLocal && !hasActiveEndpoints(endpoints) {
 			klog.V(1).Infof("Skipping setting up ClusterIP service %s/%s as it does not have active endpoints",
 				svc.namespace, svc.name)
 			continue
@@ -126,7 +126,7 @@ func (nsc *NetworkServicesController) setupClusterIPServices(serviceInfoMap serv
 		ipv6NodeIP := utils.FindBestIPv6NodeAddress(nsc.primaryIP, nsc.nodeIPv6Addrs)
 		dummyVipInterface, err := nsc.ln.getKubeDummyInterface()
 		if err != nil {
-			return errors.New("Failed creating dummy interface: " + err.Error())
+			return fmt.Errorf("failed creating dummy interface: %v", err)
 		}
 
 		for family, famClusIPs := range clusterIPs {
@@ -145,6 +145,7 @@ func (nsc *NetworkServicesController) setupClusterIPServices(serviceInfoMap serv
 				// node
 				err = nsc.ln.ipAddrAdd(dummyVipInterface, clusterIP.String(), nodeIP, true)
 				if err != nil {
+					// Not logging an error here because it was already logged in the ipAddrAdd function
 					continue
 				}
 
@@ -153,11 +154,12 @@ func (nsc *NetworkServicesController) setupClusterIPServices(serviceInfoMap serv
 					protocol, uint16(svc.port))
 				// We weren't able to create the IPVS service, so we won't be able to add endpoints to it
 				if svcID == "" {
+					// not logging an error here because it was already logged in the addIPVSService function
 					continue
 				}
 
 				// add IPVS remote server to the IPVS service
-				nsc.addEndpointsToIPVSService(endpoints, activeServiceEndpointMap, svc, svcID, ipvsSvc, clusterIP)
+				nsc.addEndpointsToIPVSService(endpoints, activeServiceEndpointMap, svc, svcID, ipvsSvc, clusterIP, true)
 			}
 		}
 	}
@@ -183,7 +185,8 @@ func (nsc *NetworkServicesController) addIPVSService(ipvsSvcs []*ipvs.Service, s
 }
 
 func (nsc *NetworkServicesController) addEndpointsToIPVSService(endpoints []endpointSliceInfo,
-	svcEndpointMap map[string][]string, svc *serviceInfo, svcID string, ipvsSvc *ipvs.Service, vip net.IP) {
+	svcEndpointMap map[string][]string, svc *serviceInfo, svcID string, ipvsSvc *ipvs.Service, vip net.IP,
+	isClusterIP bool) {
 	var family v1.IPFamily
 	if vip.To4() != nil {
 		family = v1.IPv4Protocol
@@ -191,13 +194,22 @@ func (nsc *NetworkServicesController) addEndpointsToIPVSService(endpoints []endp
 		family = v1.IPv6Protocol
 	}
 
+	if len(endpoints) < 1 {
+		klog.Infof("No endpoints detected for service VIP: %s, skipping adding endpoints...", vip)
+	}
 	for _, endpoint := range endpoints {
 		// Conditions on which to add an endpoint on this node:
 		// 1) Service is not a local service
 		// 2) Service is a local service, but has no active endpoints on this node
 		// 3) Service is a local service, has active endpoints on this node, and this endpoint is one of them
-		if svc.local && !endpoint.isLocal {
-			continue
+		if !endpoint.isLocal {
+			if isClusterIP && *svc.intTrafficPolicy == v1.ServiceInternalTrafficPolicyLocal {
+				klog.V(2).Info("service has an internal traffic policy of local, but endpoint is not, continuing...")
+				continue
+			} else if !isClusterIP && *svc.extTrafficPolicy == v1.ServiceExternalTrafficPolicyLocal {
+				klog.V(2).Info("service has an external traffic policy of local, but endpoint is not, continuing...")
+				continue
+			}
 		}
 		var syscallINET uint16
 		eIP := net.ParseIP(endpoint.ip)
@@ -227,11 +239,11 @@ func (nsc *NetworkServicesController) addEndpointsToIPVSService(endpoints []endp
 		}
 		err := nsc.ln.ipvsAddServer(ipvsSvc, &dst)
 		if err != nil {
-			klog.Errorf(err.Error())
-		} else {
-			svcEndpointMap[svcID] = append(svcEndpointMap[svcID],
-				generateEndpointID(endpoint.ip, strconv.Itoa(endpoint.port)))
+			klog.Errorf("encountered error adding endpoint to service: %v", err)
+			continue
 		}
+		svcEndpointMap[svcID] = append(svcEndpointMap[svcID],
+			generateEndpointID(endpoint.ip, strconv.Itoa(endpoint.port)))
 	}
 }
 
@@ -254,7 +266,7 @@ func (nsc *NetworkServicesController) setupNodePortServices(serviceInfoMap servi
 		endpoints := endpointsInfoMap[k]
 		// First we check to see if this is a local service and that it has any active endpoints, if it doesn't there
 		// isn't any use doing any of the below work, let's save some compute cycles and break fast
-		if svc.local && !hasActiveEndpoints(endpoints) {
+		if *svc.extTrafficPolicy == v1.ServiceExternalTrafficPolicyLocal && !hasActiveEndpoints(endpoints) {
 			klog.V(1).Infof("Skipping setting up NodePort service %s/%s as it does not have active endpoints",
 				svc.namespace, svc.name)
 			continue
@@ -295,7 +307,7 @@ func (nsc *NetworkServicesController) setupNodePortServices(serviceInfoMap servi
 					if svcID == "" {
 						continue
 					}
-					nsc.addEndpointsToIPVSService(endpoints, activeServiceEndpointMap, svc, svcID, ipvsSvc, addr)
+					nsc.addEndpointsToIPVSService(endpoints, activeServiceEndpointMap, svc, svcID, ipvsSvc, addr, false)
 				}
 			}
 		} else {
@@ -305,7 +317,8 @@ func (nsc *NetworkServicesController) setupNodePortServices(serviceInfoMap servi
 			if svcID == "" {
 				continue
 			}
-			nsc.addEndpointsToIPVSService(endpoints, activeServiceEndpointMap, svc, svcID, ipvsSvc, nsc.primaryIP)
+			nsc.addEndpointsToIPVSService(endpoints, activeServiceEndpointMap, svc, svcID, ipvsSvc, nsc.primaryIP,
+				false)
 		}
 	}
 
@@ -318,7 +331,7 @@ func (nsc *NetworkServicesController) setupExternalIPServices(serviceInfoMap ser
 		endpoints := endpointsInfoMap[k]
 		// First we check to see if this is a local service and that it has any active endpoints, if it doesn't there
 		// isn't any use doing any of the below work, let's save some compute cycles and break fast
-		if svc.local && !hasActiveEndpoints(endpoints) {
+		if *svc.extTrafficPolicy == v1.ServiceExternalTrafficPolicyLocal && !hasActiveEndpoints(endpoints) {
 			klog.V(1).Infof("Skipping setting up IPVS service for external IP and LoadBalancer IP "+
 				"for the service %s/%s as it does not have active endpoints\n", svc.namespace, svc.name)
 			continue
@@ -336,7 +349,8 @@ func (nsc *NetworkServicesController) setupExternalIPServices(serviceInfoMap ser
 			}
 		}
 		if !addrsFound {
-			klog.V(1).Infof("no IP addresses returned for external service %s:%s", svc.namespace, svc.name)
+			klog.V(1).Infof("no external IP addresses returned for service %s:%s skipping...",
+				svc.namespace, svc.name)
 			continue
 		}
 
@@ -420,7 +434,7 @@ func (nsc *NetworkServicesController) setupExternalIPForService(svc *serviceInfo
 	}
 
 	// add pod endpoints to the IPVS service
-	nsc.addEndpointsToIPVSService(endpoints, svcEndpointMap, svc, svcID, ipvsExternalIPSvc, externalIP)
+	nsc.addEndpointsToIPVSService(endpoints, svcEndpointMap, svc, svcID, ipvsExternalIPSvc, externalIP, false)
 
 	return nil
 }
@@ -501,7 +515,7 @@ func (nsc *NetworkServicesController) setupExternalIPForDSRService(svc *serviceI
 		// 1) Service is not a local service
 		// 2) Service is a local service, but has no active endpoints on this node
 		// 3) Service is a local service, has active endpoints on this node, and this endpoint is one of them
-		if svc.local && !endpoint.isLocal {
+		if *svc.extTrafficPolicy == v1.ServiceExternalTrafficPolicyLocal && !endpoint.isLocal {
 			continue
 		}
 		var syscallINET uint16
diff --git a/pkg/controllers/routing/bgp_policies.go b/pkg/controllers/routing/bgp_policies.go
index a4ba076e..311ae961 100644
--- a/pkg/controllers/routing/bgp_policies.go
+++ b/pkg/controllers/routing/bgp_policies.go
@@ -169,7 +169,7 @@ func (nrc *NetworkRoutingController) addServiceVIPsDefinedSet() error {
 		}
 
 		advIPPrefixList := make([]*gobgpapi.Prefix, 0)
-		advIps, _, _ := nrc.getAllVIPs()
+		advIps, _, _ := nrc.getVIPs()
 		for _, ipStr := range advIps {
 			ip := net.ParseIP(ipStr)
 			if ip == nil {
diff --git a/pkg/controllers/routing/ecmp_vip.go b/pkg/controllers/routing/ecmp_vip.go
index e7826708..ff8eb49a 100644
--- a/pkg/controllers/routing/ecmp_vip.go
+++ b/pkg/controllers/routing/ecmp_vip.go
@@ -141,7 +141,7 @@ func (nrc *NetworkRoutingController) handleServiceUpdate(svcOld, svcNew *v1core.
 		return
 	}
 
-	toAdvertise, toWithdraw, err := nrc.getChangedVIPs(svcOld, svcNew, true)
+	toAdvertise, toWithdraw, err := nrc.getChangedVIPs(svcOld, svcNew)
 	if err != nil {
 		klog.Errorf("error getting routes for services: %s", err)
 		return
@@ -167,15 +167,21 @@ func (nrc *NetworkRoutingController) handleServiceDelete(oldSvc *v1core.Service)
 
 	err := nrc.AddPolicies()
 	if err != nil {
-		klog.Errorf("Error adding BGP policies: %s", err.Error())
+		klog.Errorf("Error adding BGP policies during service update for %s/%s: %v", oldSvc.Namespace, oldSvc.Name,
+			err)
 	}
 
-	activeVIPs, _, err := nrc.getActiveVIPs()
+	activeVIPs, _, err := nrc.getVIPs()
 	if err != nil {
-		klog.Errorf("Failed to get active VIP's on service delete event due to: %s", err.Error())
+		klog.Errorf("Failed to get active VIP's on service delete event for %s/%s due to: %v", oldSvc.Namespace,
+			oldSvc.Name, err)
 		return
 	}
-	advertiseIPList, unadvertiseIPList := nrc.getAllVIPsForService(oldSvc)
+	advertiseIPList, unadvertiseIPList, err := nrc.getAllVIPsForService(oldSvc)
+	if err != nil {
+		klog.Errorf("Error getting VIPs on service delete event for %s/%s due to: %v", oldSvc.Namespace, oldSvc.Name,
+			err)
+	}
 	//nolint:gocritic // we understand that we're assigning to a new slice
 	allIPList := append(advertiseIPList, unadvertiseIPList...)
 	withdrawVIPs := make([]string, 0)
@@ -364,23 +370,14 @@ func (nrc *NetworkRoutingController) getLoadBalancerIPs(svc *v1core.Service) []s
 	return loadBalancerIPList
 }
 
-func (nrc *NetworkRoutingController) getChangedVIPs(oldSvc, newSvc *v1core.Service,
-	onlyActiveEndpoints bool) ([]string, []string, error) {
+func (nrc *NetworkRoutingController) getChangedVIPs(oldSvc, newSvc *v1core.Service) ([]string, []string, error) {
 	advertiseService := true
 
-	_, hasLocalAnnotation := newSvc.Annotations[svcLocalAnnotation]
-	hasLocalTrafficPolicy := newSvc.Spec.ExternalTrafficPolicy == v1core.ServiceExternalTrafficPolicyTypeLocal
-	isLocal := hasLocalAnnotation || hasLocalTrafficPolicy
-
-	if onlyActiveEndpoints && isLocal {
-		var err error
-		advertiseService, err = nrc.nodeHasEndpointsForService(newSvc)
-		if err != nil {
-			return nil, nil, err
-		}
+	newAdvertiseServiceVIPs, newUnadvertiseServiceVIPs, err := nrc.getAllVIPsForService(newSvc)
+	if err != nil {
+		return nil, nil, fmt.Errorf("failed to get all VIPs for new service %s/%s due to: %v", newSvc.Namespace,
+			newSvc.Name, err)
 	}
-
-	newAdvertiseServiceVIPs, newUnadvertiseServiceVIPs := nrc.getAllVIPsForService(newSvc)
 	// This function allows oldSvc to be nil, if this is the case, we don't have any old VIPs to compare against and
 	// possibly withdraw instead treat all VIPs as new and return them as either toAdvertise or toWithdraw depending
 	// on service configuration
@@ -393,7 +390,11 @@ func (nrc *NetworkRoutingController) getChangedVIPs(oldSvc, newSvc *v1core.Servi
 			return nil, allVIPs, nil
 		}
 	}
-	oldAdvertiseServiceVIPs, oldUnadvertiseServiceVIPs := nrc.getAllVIPsForService(oldSvc)
+	oldAdvertiseServiceVIPs, oldUnadvertiseServiceVIPs, err := nrc.getAllVIPsForService(oldSvc)
+	if err != nil {
+		return nil, nil, fmt.Errorf("failed to get all VIPs for old service %s/%s due to: %v", oldSvc.Namespace,
+			oldSvc.Name, err)
+	}
 	//nolint:gocritic // we understand that we're assigning to a new slice
 	oldAllServiceVIPs := append(oldAdvertiseServiceVIPs, oldUnadvertiseServiceVIPs...)
 
@@ -416,7 +417,7 @@ func (nrc *NetworkRoutingController) getChangedVIPs(oldSvc, newSvc *v1core.Servi
 	// It is possible that this host may have the same IP advertised from multiple services, and we don't want to
 	// withdraw it if there is an active service for this VIP on a different service than the one that is changing.
 	toWithdrawListFinal := make([]string, 0)
-	allVIPsOnServer, _, err := nrc.getVIPs(onlyActiveEndpoints)
+	allVIPsOnServer, _, err := nrc.getVIPs()
 	if err != nil {
 		return nil, nil, err
 	}
@@ -429,22 +430,14 @@ func (nrc *NetworkRoutingController) getChangedVIPs(oldSvc, newSvc *v1core.Servi
 	return toAdvertiseListFinal, toWithdrawListFinal, nil
 }
 
-func (nrc *NetworkRoutingController) getAllVIPs() ([]string, []string, error) {
-	return nrc.getVIPs(false)
-}
-
-func (nrc *NetworkRoutingController) getActiveVIPs() ([]string, []string, error) {
-	return nrc.getVIPs(true)
-}
-
-func (nrc *NetworkRoutingController) getVIPs(onlyActiveEndpoints bool) ([]string, []string, error) {
+func (nrc *NetworkRoutingController) getVIPs() ([]string, []string, error) {
 	toAdvertiseList := make([]string, 0)
 	toWithdrawList := make([]string, 0)
 
 	for _, obj := range nrc.svcLister.List() {
 		svc := obj.(*v1core.Service)
 
-		toAdvertise, toWithdraw, err := nrc.getVIPsForService(svc, onlyActiveEndpoints)
+		toAdvertise, toWithdraw, err := nrc.getAllVIPsForService(svc)
 		if err != nil {
 			return nil, nil, err
 		}
@@ -472,52 +465,67 @@ func (nrc *NetworkRoutingController) getVIPs(onlyActiveEndpoints bool) ([]string
 }
 
 func (nrc *NetworkRoutingController) shouldAdvertiseService(svc *v1core.Service, annotation string,
-	defaultValue bool) bool {
+	defaultValue, isClusterIP bool) (bool, error) {
 	returnValue := defaultValue
 	stringValue, exists := svc.Annotations[annotation]
 	if exists {
 		// Service annotations overrides defaults.
 		returnValue, _ = strconv.ParseBool(stringValue)
 	}
-	return returnValue
-}
 
-func (nrc *NetworkRoutingController) getVIPsForService(svc *v1core.Service,
-	onlyActiveEndpoints bool) ([]string, []string, error) {
-
-	advertise := true
-
-	_, hasLocalAnnotation := svc.Annotations[svcLocalAnnotation]
-	hasLocalTrafficPolicy := svc.Spec.ExternalTrafficPolicy == v1core.ServiceExternalTrafficPolicyTypeLocal
-	isLocal := hasLocalAnnotation || hasLocalTrafficPolicy
+	// If we already know that we shouldn't advertise the service, fail fast
+	if !returnValue {
+		return returnValue, nil
+	}
 
-	if onlyActiveEndpoints && isLocal {
-		var err error
-		advertise, err = nrc.nodeHasEndpointsForService(svc)
-		if err != nil {
-			return nil, nil, err
-		}
+	hasLocalEndpoints, err := nrc.nodeHasEndpointsForService(svc)
+	if err != nil {
+		return returnValue, err
 	}
 
-	advertiseIPList, unAdvertisedIPList := nrc.getAllVIPsForService(svc)
+	// If:
+	// - We are assessing the clusterIP of the service (the internally facing VIP)
+	// - The service has an internal traffic policy of "local" or the service has the service.local annotation on it
+	// - The service doesn't have any endpoints on the node we're executing on
+	// Then: return false
+	// We handle spec.internalTrafficPolicy different because it was introduced in v1.26 and may not be available in all
+	// clusters, in this case, it will be set to nil
+	serIntTrafPol := false
+	if svc.Spec.InternalTrafficPolicy != nil {
+		serIntTrafPol = *svc.Spec.InternalTrafficPolicy == v1core.ServiceInternalTrafficPolicyLocal
+	}
+	intLocalPol := (serIntTrafPol || svc.Annotations[svcLocalAnnotation] == "true")
+	if isClusterIP && intLocalPol && !hasLocalEndpoints {
+		return false, nil
+	}
 
-	if !advertise {
-		//nolint:gocritic // we understand that we're assigning to a new slice
-		allIPList := append(advertiseIPList, unAdvertisedIPList...)
-		return nil, allIPList, nil
+	// If:
+	// - We are assessing something other than a clusterIP like an externalIP or nodePort (externally facing)
+	// - The service has an external traffic policy of "local" or the service has the service.local annotation on it
+	// - The service doesn't have any endpoints on the node we're executing on
+	// Then: return false
+	extLocalPol := (svc.Spec.ExternalTrafficPolicy == v1core.ServiceExternalTrafficPolicyLocal ||
+		svc.Annotations[svcLocalAnnotation] == "true")
+	if !isClusterIP && extLocalPol && !hasLocalEndpoints {
+		return false, nil
 	}
 
-	return advertiseIPList, unAdvertisedIPList, nil
+	return returnValue, nil
 }
 
-func (nrc *NetworkRoutingController) getAllVIPsForService(svc *v1core.Service) ([]string, []string) {
+func (nrc *NetworkRoutingController) getAllVIPsForService(svc *v1core.Service) ([]string, []string, error) {
 
 	advertisedIPList := make([]string, 0)
 	unAdvertisedIPList := make([]string, 0)
 
 	clusterIPs := nrc.getClusterIP(svc)
 	if len(clusterIPs) > 0 {
-		if nrc.shouldAdvertiseService(svc, svcAdvertiseClusterAnnotation, nrc.advertiseClusterIP) {
+		shouldAdvCIP, err := nrc.shouldAdvertiseService(svc, svcAdvertiseClusterAnnotation, nrc.advertiseClusterIP,
+			true)
+		if err != nil {
+			return advertisedIPList, unAdvertisedIPList, err
+		}
+		if shouldAdvCIP {
 			advertisedIPList = append(advertisedIPList, clusterIPs...)
 		} else {
 			unAdvertisedIPList = append(unAdvertisedIPList, clusterIPs...)
@@ -526,7 +534,12 @@ func (nrc *NetworkRoutingController) getAllVIPsForService(svc *v1core.Service) (
 
 	externalIPs := nrc.getExternalIPs(svc)
 	if len(externalIPs) > 0 {
-		if nrc.shouldAdvertiseService(svc, svcAdvertiseExternalAnnotation, nrc.advertiseExternalIP) {
+		shouldAdvEIP, err := nrc.shouldAdvertiseService(svc, svcAdvertiseExternalAnnotation, nrc.advertiseExternalIP,
+			false)
+		if err != nil {
+			return advertisedIPList, unAdvertisedIPList, err
+		}
+		if shouldAdvEIP {
 			advertisedIPList = append(advertisedIPList, externalIPs...)
 		} else {
 			unAdvertisedIPList = append(unAdvertisedIPList, externalIPs...)
@@ -537,16 +550,19 @@ func (nrc *NetworkRoutingController) getAllVIPsForService(svc *v1core.Service) (
 	lbIPs := nrc.getLoadBalancerIPs(svc)
 	if len(lbIPs) > 0 {
 		_, skiplbips := svc.Annotations[svcSkipLbIpsAnnotation]
-		advertiseLoadBalancer := nrc.shouldAdvertiseService(svc, svcAdvertiseLoadBalancerAnnotation,
-			nrc.advertiseLoadBalancerIP)
-		if advertiseLoadBalancer && !skiplbips {
+		shouldAdvLIP, err := nrc.shouldAdvertiseService(svc, svcAdvertiseLoadBalancerAnnotation,
+			nrc.advertiseLoadBalancerIP, false)
+		if err != nil {
+			return advertisedIPList, unAdvertisedIPList, err
+		}
+		if shouldAdvLIP && !skiplbips {
 			advertisedIPList = append(advertisedIPList, lbIPs...)
 		} else {
 			unAdvertisedIPList = append(unAdvertisedIPList, lbIPs...)
 		}
 	}
 
-	return advertisedIPList, unAdvertisedIPList
+	return advertisedIPList, unAdvertisedIPList, nil
 
 }
 
diff --git a/pkg/controllers/routing/network_routes_controller.go b/pkg/controllers/routing/network_routes_controller.go
index 2655c36e..93689c27 100644
--- a/pkg/controllers/routing/network_routes_controller.go
+++ b/pkg/controllers/routing/network_routes_controller.go
@@ -371,7 +371,7 @@ func (nrc *NetworkRoutingController) Run(healthChan chan<- *healthcheck.Controll
 		}
 
 		// advertise or withdraw IPs for the services to be reachable via host
-		toAdvertise, toWithdraw, err := nrc.getActiveVIPs()
+		toAdvertise, toWithdraw, err := nrc.getVIPs()
 		if err != nil {
 			klog.Errorf("failed to get routes to advertise/withdraw %s", err)
 		}


Test patch:
diff --git a/pkg/controllers/routing/bgp_policies_test.go b/pkg/controllers/routing/bgp_policies_test.go
index c58dab1a..5da30c47 100644
--- a/pkg/controllers/routing/bgp_policies_test.go
+++ b/pkg/controllers/routing/bgp_policies_test.go
@@ -21,6 +21,7 @@ type PolicyTestCase struct {
 	nrc                          *NetworkRoutingController
 	existingNodes                []*v1core.Node
 	existingServices             []*v1core.Service
+	existingEndpoints            []*v1core.Endpoints
 	podDefinedSet                *gobgpapi.DefinedSet
 	clusterIPDefinedSet          *gobgpapi.DefinedSet
 	externalPeerDefinedSet       *gobgpapi.DefinedSet
@@ -75,12 +76,32 @@ func Test_AddPolicies(t *testing.T) {
 			[]*v1core.Service{
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-1",
+						Name:      "svc-1",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:        ClusterIPST,
-						ClusterIP:   "10.1.0.1",
-						ExternalIPs: []string{"1.1.1.1"},
+						Type:                  ClusterIPST,
+						ClusterIP:             "10.1.0.1",
+						ExternalIPs:           []string{"1.1.1.1"},
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
+					},
+				},
+			},
+			[]*v1core.Endpoints{
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-1",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
 					},
 				},
 			},
@@ -205,12 +226,32 @@ func Test_AddPolicies(t *testing.T) {
 			[]*v1core.Service{
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-1",
+						Name:      "svc-1",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:        "ClusterIP",
-						ClusterIP:   "10.11.0.1",
-						ExternalIPs: []string{"1.11.1.1"},
+						Type:                  "ClusterIP",
+						ClusterIP:             "10.11.0.1",
+						ExternalIPs:           []string{"1.11.1.1"},
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
+					},
+				},
+			},
+			[]*v1core.Endpoints{
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-1",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
 					},
 				},
 			},
@@ -428,12 +469,32 @@ func Test_AddPolicies(t *testing.T) {
 			[]*v1core.Service{
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-1",
+						Name:      "svc-1",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:        ClusterIPST,
-						ClusterIP:   "10.12.0.1",
-						ExternalIPs: []string{"1.12.1.1"},
+						Type:                  ClusterIPST,
+						ClusterIP:             "10.12.0.1",
+						ExternalIPs:           []string{"1.12.1.1"},
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
+					},
+				},
+			},
+			[]*v1core.Endpoints{
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-1",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
 					},
 				},
 			},
@@ -613,12 +674,32 @@ func Test_AddPolicies(t *testing.T) {
 			[]*v1core.Service{
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-1",
+						Name:      "svc-1",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:        ClusterIPST,
-						ClusterIP:   "10.13.0.1",
-						ExternalIPs: []string{"1.13.1.1"},
+						Type:                  ClusterIPST,
+						ClusterIP:             "10.13.0.1",
+						ExternalIPs:           []string{"1.13.1.1"},
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
+					},
+				},
+			},
+			[]*v1core.Endpoints{
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-1",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
 					},
 				},
 			},
@@ -783,12 +864,32 @@ func Test_AddPolicies(t *testing.T) {
 			[]*v1core.Service{
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-1",
+						Name:      "svc-1",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:        ClusterIPST,
-						ClusterIP:   "10.14.0.1",
-						ExternalIPs: []string{"1.14.1.1"},
+						Type:                  ClusterIPST,
+						ClusterIP:             "10.14.0.1",
+						ExternalIPs:           []string{"1.14.1.1"},
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
+					},
+				},
+			},
+			[]*v1core.Endpoints{
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-1",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
 					},
 				},
 			},
@@ -973,12 +1074,32 @@ func Test_AddPolicies(t *testing.T) {
 			[]*v1core.Service{
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-1",
+						Name:      "svc-1",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:        ClusterIPST,
-						ClusterIP:   "10.15.0.1",
-						ExternalIPs: []string{"1.15.1.1"},
+						Type:                  ClusterIPST,
+						ClusterIP:             "10.15.0.1",
+						ExternalIPs:           []string{"1.15.1.1"},
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
+					},
+				},
+			},
+			[]*v1core.Endpoints{
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-1",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
 					},
 				},
 			},
@@ -1164,12 +1285,32 @@ func Test_AddPolicies(t *testing.T) {
 			[]*v1core.Service{
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-1",
+						Name:      "svc-1",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:        ClusterIPST,
-						ClusterIP:   "10.16.0.1",
-						ExternalIPs: []string{"1.16.1.1"},
+						Type:                  ClusterIPST,
+						ClusterIP:             "10.16.0.1",
+						ExternalIPs:           []string{"1.16.1.1"},
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
+					},
+				},
+			},
+			[]*v1core.Endpoints{
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-1",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
 					},
 				},
 			},
@@ -1309,7 +1450,11 @@ func Test_AddPolicies(t *testing.T) {
 			}
 
 			if err := createServices(testcase.nrc.clientset, testcase.existingServices); err != nil {
-				t.Errorf("failed to create existing nodes: %v", err)
+				t.Errorf("failed to create existing services: %v", err)
+			}
+
+			if err := createEndpoints(testcase.nrc.clientset, testcase.existingEndpoints); err != nil {
+				t.Errorf("failed to create existing endpoints: %v", err)
 			}
 
 			err := testcase.nrc.startBgpServer(false)
diff --git a/pkg/controllers/routing/ecmp_vip_test.go b/pkg/controllers/routing/ecmp_vip_test.go
index 7a10e181..e53da6e5 100644
--- a/pkg/controllers/routing/ecmp_vip_test.go
+++ b/pkg/controllers/routing/ecmp_vip_test.go
@@ -2,7 +2,9 @@ package routing
 
 import (
 	"context"
+	"net"
 	"testing"
+	"time"
 
 	v1core "k8s.io/api/core/v1"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -22,98 +24,67 @@ func Equal(a, b []string) bool {
 	return true
 }
 
+var (
+	testlocalExtTrafPol   = v1core.ServiceExternalTrafficPolicyLocal
+	testClusterExtTrafPol = v1core.ServiceExternalTrafficPolicyCluster
+	testLocalIntTrafPol   = v1core.ServiceInternalTrafficPolicyLocal
+	testClusterIntTrafPol = v1core.ServiceInternalTrafficPolicyCluster
+	testNodeIPv4          = "10.1.0.1"
+	testNodeIPv6          = "2001:db8:42:2::1"
+)
+
 type ServiceAdvertisedIPs struct {
-	service       *v1core.Service
-	advertisedIPs []string
-	withdrawnIPs  []string
-	annotations   map[string]string
+	service               *v1core.Service
+	endpoints             *v1core.Endpoints
+	internalTrafficPolicy *v1core.ServiceInternalTrafficPolicyType
+	externalTrafficPolicy *v1core.ServiceExternalTrafficPolicyType
+	advertisedIPs         []string
+	withdrawnIPs          []string
+	annotations           map[string]string
 }
 
 func Test_getVIPsForService(t *testing.T) {
-	services := map[string]*v1core.Service{
-		"cluster": {
-			ObjectMeta: metav1.ObjectMeta{
-				Name: "svc-cluster",
-			},
-			Spec: v1core.ServiceSpec{
-				Type:      ClusterIPST,
-				ClusterIP: "10.0.0.1",
-			},
-		},
-		"external": {
-			ObjectMeta: metav1.ObjectMeta{
-				Name: "svc-external",
-			},
-			Spec: v1core.ServiceSpec{
-				Type:        ClusterIPST,
-				ClusterIP:   "10.0.0.1",
-				ExternalIPs: []string{"1.1.1.1"},
-			},
-		},
-		"nodeport": {
-			ObjectMeta: metav1.ObjectMeta{
-				Name: "svc-nodeport",
-			},
-			Spec: v1core.ServiceSpec{
-				Type:        NodePortST,
-				ClusterIP:   "10.0.0.1",
-				ExternalIPs: []string{"1.1.1.1"},
-			},
-		},
-		"loadbalancer": {
-			ObjectMeta: metav1.ObjectMeta{
-				Name: "svc-loadbalancer",
-			},
-			Spec: v1core.ServiceSpec{
-				Type:        LoadBalancerST,
-				ClusterIP:   "10.0.0.1",
-				ExternalIPs: []string{"1.1.1.1"},
-			},
-			Status: v1core.ServiceStatus{
-				LoadBalancer: v1core.LoadBalancerStatus{
-					Ingress: []v1core.LoadBalancerIngress{
-						{
-							IP: "10.0.255.1",
-						},
-						{
-							IP: "10.0.255.2",
-						},
-					},
-				},
-			},
-		},
-	}
-
 	tests := []struct {
-		name string
-		// cluster, external, loadbalancer
-		advertiseSettings    [3]bool
+		name                 string
+		nrc                  *NetworkRoutingController
 		serviceAdvertisedIPs []*ServiceAdvertisedIPs
 	}{
 		{
-			name:              "advertise all IPs",
-			advertiseSettings: [3]bool{true, true, true},
+			name: "advertise all IPs",
+			nrc: &NetworkRoutingController{
+				advertiseClusterIP:      true,
+				advertiseExternalIP:     true,
+				advertiseLoadBalancerIP: true,
+				primaryIP:               net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
+			},
 			serviceAdvertisedIPs: []*ServiceAdvertisedIPs{
 				{
-					service:       services["cluster"],
+					service:       getClusterSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{"10.0.0.1"},
 					withdrawnIPs:  []string{},
 					annotations:   nil,
 				},
 				{
-					service:       services["external"],
+					service:       getExternalSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{"10.0.0.1", "1.1.1.1"},
 					withdrawnIPs:  []string{},
 					annotations:   nil,
 				},
 				{
-					service:       services["nodeport"],
+					service:       getNodePortSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{"10.0.0.1", "1.1.1.1"},
 					withdrawnIPs:  []string{},
 					annotations:   nil,
 				},
 				{
-					service:       services["loadbalancer"],
+					service:       getLoadBalancerSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{"10.0.0.1", "1.1.1.1", "10.0.255.1", "10.0.255.2"},
 					withdrawnIPs:  []string{},
 					annotations:   nil,
@@ -121,29 +92,41 @@ func Test_getVIPsForService(t *testing.T) {
 			},
 		},
 		{
-			name:              "do not advertise any IPs",
-			advertiseSettings: [3]bool{false, false, false},
+			name: "do not advertise any IPs",
+			nrc: &NetworkRoutingController{
+				advertiseClusterIP:      false,
+				advertiseExternalIP:     false,
+				advertiseLoadBalancerIP: false,
+				primaryIP:               net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
+			},
 			serviceAdvertisedIPs: []*ServiceAdvertisedIPs{
 				{
-					service:       services["cluster"],
+					service:       getClusterSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{},
 					withdrawnIPs:  []string{"10.0.0.1"},
 					annotations:   nil,
 				},
 				{
-					service:       services["external"],
+					service:       getExternalSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{},
 					withdrawnIPs:  []string{"10.0.0.1", "1.1.1.1"},
 					annotations:   nil,
 				},
 				{
-					service:       services["nodeport"],
+					service:       getNodePortSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{},
 					withdrawnIPs:  []string{"10.0.0.1", "1.1.1.1"},
 					annotations:   nil,
 				},
 				{
-					service:       services["loadbalancer"],
+					service:       getLoadBalancerSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{},
 					withdrawnIPs:  []string{"10.0.0.1", "1.1.1.1", "10.0.255.1", "10.0.255.2"},
 					annotations:   nil,
@@ -151,29 +134,41 @@ func Test_getVIPsForService(t *testing.T) {
 			},
 		},
 		{
-			name:              "advertise cluster IPs",
-			advertiseSettings: [3]bool{true, false, false},
+			name: "advertise cluster IPs",
+			nrc: &NetworkRoutingController{
+				advertiseClusterIP:      true,
+				advertiseExternalIP:     false,
+				advertiseLoadBalancerIP: false,
+				primaryIP:               net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
+			},
 			serviceAdvertisedIPs: []*ServiceAdvertisedIPs{
 				{
-					service:       services["cluster"],
+					service:       getClusterSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{"10.0.0.1"},
 					withdrawnIPs:  []string{},
 					annotations:   nil,
 				},
 				{
-					service:       services["external"],
+					service:       getExternalSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{"10.0.0.1"},
 					withdrawnIPs:  []string{"1.1.1.1"},
 					annotations:   nil,
 				},
 				{
-					service:       services["nodeport"],
+					service:       getNodePortSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{"10.0.0.1"},
 					withdrawnIPs:  []string{"1.1.1.1"},
 					annotations:   nil,
 				},
 				{
-					service:       services["loadbalancer"],
+					service:       getLoadBalancerSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{"10.0.0.1"},
 					withdrawnIPs:  []string{"1.1.1.1", "10.0.255.1", "10.0.255.2"},
 					annotations:   nil,
@@ -181,29 +176,41 @@ func Test_getVIPsForService(t *testing.T) {
 			},
 		},
 		{
-			name:              "advertise external IPs",
-			advertiseSettings: [3]bool{false, true, false},
+			name: "advertise external IPs",
+			nrc: &NetworkRoutingController{
+				advertiseClusterIP:      false,
+				advertiseExternalIP:     true,
+				advertiseLoadBalancerIP: false,
+				primaryIP:               net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
+			},
 			serviceAdvertisedIPs: []*ServiceAdvertisedIPs{
 				{
-					service:       services["cluster"],
+					service:       getClusterSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{},
 					withdrawnIPs:  []string{"10.0.0.1"},
 					annotations:   nil,
 				},
 				{
-					service:       services["external"],
+					service:       getExternalSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{"1.1.1.1"},
 					withdrawnIPs:  []string{"10.0.0.1"},
 					annotations:   nil,
 				},
 				{
-					service:       services["nodeport"],
+					service:       getNodePortSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{"1.1.1.1"},
 					withdrawnIPs:  []string{"10.0.0.1"},
 					annotations:   nil,
 				},
 				{
-					service:       services["loadbalancer"],
+					service:       getLoadBalancerSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{"1.1.1.1"},
 					withdrawnIPs:  []string{"10.0.0.1", "10.0.255.1", "10.0.255.2"},
 					annotations:   nil,
@@ -211,29 +218,41 @@ func Test_getVIPsForService(t *testing.T) {
 			},
 		},
 		{
-			name:              "advertise loadbalancer IPs",
-			advertiseSettings: [3]bool{false, false, true},
+			name: "advertise loadbalancer IPs",
+			nrc: &NetworkRoutingController{
+				advertiseClusterIP:      false,
+				advertiseExternalIP:     false,
+				advertiseLoadBalancerIP: true,
+				primaryIP:               net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
+			},
 			serviceAdvertisedIPs: []*ServiceAdvertisedIPs{
 				{
-					service:       services["cluster"],
+					service:       getClusterSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{},
 					withdrawnIPs:  []string{"10.0.0.1"},
 					annotations:   nil,
 				},
 				{
-					service:       services["external"],
+					service:       getExternalSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{},
 					withdrawnIPs:  []string{"10.0.0.1", "1.1.1.1"},
 					annotations:   nil,
 				},
 				{
-					service:       services["nodeport"],
+					service:       getNodePortSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{},
 					withdrawnIPs:  []string{"10.0.0.1", "1.1.1.1"},
 					annotations:   nil,
 				},
 				{
-					service:       services["loadbalancer"],
+					service:       getLoadBalancerSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{"10.0.255.1", "10.0.255.2"},
 					withdrawnIPs:  []string{"10.0.0.1", "1.1.1.1"},
 					annotations:   nil,
@@ -241,11 +260,20 @@ func Test_getVIPsForService(t *testing.T) {
 			},
 		},
 		{
-			name:              "opt in to advertise all IPs via annotations",
-			advertiseSettings: [3]bool{false, false, false},
+			name: "opt in to advertise all IPs via annotations",
+			nrc: &NetworkRoutingController{
+				advertiseClusterIP:      false,
+				advertiseExternalIP:     false,
+				advertiseLoadBalancerIP: false,
+				primaryIP:               net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
+			},
 			serviceAdvertisedIPs: []*ServiceAdvertisedIPs{
 				{
-					service:       services["cluster"],
+					service:       getClusterSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{"10.0.0.1"},
 					withdrawnIPs:  []string{},
 					annotations: map[string]string{
@@ -255,7 +283,8 @@ func Test_getVIPsForService(t *testing.T) {
 					},
 				},
 				{
-					service:       services["external"],
+					service:       getExternalSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{"10.0.0.1", "1.1.1.1"},
 					withdrawnIPs:  []string{},
 					annotations: map[string]string{
@@ -265,7 +294,8 @@ func Test_getVIPsForService(t *testing.T) {
 					},
 				},
 				{
-					service:       services["nodeport"],
+					service:       getNodePortSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{"10.0.0.1", "1.1.1.1"},
 					withdrawnIPs:  []string{},
 					annotations: map[string]string{
@@ -275,7 +305,8 @@ func Test_getVIPsForService(t *testing.T) {
 					},
 				},
 				{
-					service:       services["loadbalancer"],
+					service:       getLoadBalancerSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{"10.0.0.1", "1.1.1.1", "10.0.255.1", "10.0.255.2"},
 					withdrawnIPs:  []string{},
 					annotations: map[string]string{
@@ -286,7 +317,8 @@ func Test_getVIPsForService(t *testing.T) {
 				},
 				{
 					// Special case to test svcAdvertiseLoadBalancerAnnotation vs legacy svcSkipLbIpsAnnotation
-					service:       services["loadbalancer"],
+					service:       getLoadBalancerSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{"10.0.0.1", "1.1.1.1"},
 					withdrawnIPs:  []string{"10.0.255.1", "10.0.255.2"},
 					annotations: map[string]string{
@@ -299,11 +331,20 @@ func Test_getVIPsForService(t *testing.T) {
 			},
 		},
 		{
-			name:              "opt out to advertise any IPs via annotations",
-			advertiseSettings: [3]bool{true, true, true},
+			name: "opt out to advertise any IPs via annotations",
+			nrc: &NetworkRoutingController{
+				advertiseClusterIP:      true,
+				advertiseExternalIP:     true,
+				advertiseLoadBalancerIP: true,
+				primaryIP:               net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
+			},
 			serviceAdvertisedIPs: []*ServiceAdvertisedIPs{
 				{
-					service:       services["cluster"],
+					service:       getClusterSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{},
 					withdrawnIPs:  []string{"10.0.0.1"},
 					annotations: map[string]string{
@@ -313,7 +354,8 @@ func Test_getVIPsForService(t *testing.T) {
 					},
 				},
 				{
-					service:       services["external"],
+					service:       getExternalSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{},
 					withdrawnIPs:  []string{"10.0.0.1", "1.1.1.1"},
 					annotations: map[string]string{
@@ -323,7 +365,8 @@ func Test_getVIPsForService(t *testing.T) {
 					},
 				},
 				{
-					service:       services["nodeport"],
+					service:       getNodePortSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{},
 					withdrawnIPs:  []string{"10.0.0.1", "1.1.1.1"},
 					annotations: map[string]string{
@@ -333,7 +376,8 @@ func Test_getVIPsForService(t *testing.T) {
 					},
 				},
 				{
-					service:       services["loadbalancer"],
+					service:       getLoadBalancerSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
 					advertisedIPs: []string{},
 					withdrawnIPs:  []string{"10.0.0.1", "1.1.1.1", "10.0.255.1", "10.0.255.2"},
 					annotations: map[string]string{
@@ -344,23 +388,520 @@ func Test_getVIPsForService(t *testing.T) {
 				},
 			},
 		},
+		{
+			name: "check service local annotation with local IPv4 endpoints",
+			nrc: &NetworkRoutingController{
+				advertiseClusterIP:      true,
+				advertiseExternalIP:     true,
+				advertiseLoadBalancerIP: true,
+				primaryIP:               net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
+			},
+			serviceAdvertisedIPs: []*ServiceAdvertisedIPs{
+				{
+					service:       getClusterSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
+					advertisedIPs: []string{"10.0.0.1"},
+					withdrawnIPs:  []string{},
+					annotations: map[string]string{
+						svcLocalAnnotation: "true",
+					},
+				},
+				{
+					service:       getExternalSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
+					advertisedIPs: []string{"10.0.0.1", "1.1.1.1"},
+					withdrawnIPs:  []string{},
+					annotations: map[string]string{
+						svcLocalAnnotation: "true",
+					},
+				},
+				{
+					service:       getNodePortSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
+					advertisedIPs: []string{"10.0.0.1", "1.1.1.1"},
+					withdrawnIPs:  []string{},
+					annotations: map[string]string{
+						svcLocalAnnotation: "true",
+					},
+				},
+				{
+					service:       getLoadBalancerSvc(),
+					endpoints:     getContainsLocalIPv4EPs(),
+					advertisedIPs: []string{"10.0.0.1", "1.1.1.1", "10.0.255.1", "10.0.255.2"},
+					withdrawnIPs:  []string{},
+					annotations: map[string]string{
+						svcLocalAnnotation: "true",
+					},
+				},
+			},
+		},
+		{
+			name: "check service local annotation with local IPv6 endpoints",
+			nrc: &NetworkRoutingController{
+				advertiseClusterIP:      true,
+				advertiseExternalIP:     true,
+				advertiseLoadBalancerIP: true,
+				primaryIP:               net.ParseIP(testNodeIPv6),
+				nodeIPv6Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv6)},
+				},
+			},
+			serviceAdvertisedIPs: []*ServiceAdvertisedIPs{
+				{
+					service:       getClusterSvc(),
+					endpoints:     getContainsLocalIPv6EPs(),
+					advertisedIPs: []string{"10.0.0.1"},
+					withdrawnIPs:  []string{},
+					annotations: map[string]string{
+						svcLocalAnnotation: "true",
+					},
+				},
+				{
+					service:       getExternalSvc(),
+					endpoints:     getContainsLocalIPv6EPs(),
+					advertisedIPs: []string{"10.0.0.1", "1.1.1.1"},
+					withdrawnIPs:  []string{},
+					annotations: map[string]string{
+						svcLocalAnnotation: "true",
+					},
+				},
+				{
+					service:       getNodePortSvc(),
+					endpoints:     getContainsLocalIPv6EPs(),
+					advertisedIPs: []string{"10.0.0.1", "1.1.1.1"},
+					withdrawnIPs:  []string{},
+					annotations: map[string]string{
+						svcLocalAnnotation: "true",
+					},
+				},
+				{
+					service:       getLoadBalancerSvc(),
+					endpoints:     getContainsLocalIPv6EPs(),
+					advertisedIPs: []string{"10.0.0.1", "1.1.1.1", "10.0.255.1", "10.0.255.2"},
+					withdrawnIPs:  []string{},
+					annotations: map[string]string{
+						svcLocalAnnotation: "true",
+					},
+				},
+			},
+		},
+		{
+			name: "check local external traffic policy with local IPv4 endpoints",
+			nrc: &NetworkRoutingController{
+				advertiseClusterIP:      true,
+				advertiseExternalIP:     true,
+				advertiseLoadBalancerIP: true,
+				primaryIP:               net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
+			},
+			serviceAdvertisedIPs: []*ServiceAdvertisedIPs{
+				{
+					service:               getClusterSvc(),
+					endpoints:             getContainsLocalIPv4EPs(),
+					advertisedIPs:         []string{"10.0.0.1"},
+					withdrawnIPs:          []string{},
+					annotations:           nil,
+					externalTrafficPolicy: &testlocalExtTrafPol,
+				},
+				{
+					service:               getExternalSvc(),
+					endpoints:             getContainsLocalIPv4EPs(),
+					advertisedIPs:         []string{"10.0.0.1", "1.1.1.1"},
+					withdrawnIPs:          []string{},
+					annotations:           nil,
+					externalTrafficPolicy: &testlocalExtTrafPol,
+				},
+				{
+					service:               getNodePortSvc(),
+					endpoints:             getContainsLocalIPv4EPs(),
+					advertisedIPs:         []string{"10.0.0.1", "1.1.1.1"},
+					withdrawnIPs:          []string{},
+					annotations:           nil,
+					externalTrafficPolicy: &testlocalExtTrafPol,
+				},
+				{
+					service:               getLoadBalancerSvc(),
+					endpoints:             getContainsLocalIPv4EPs(),
+					advertisedIPs:         []string{"10.0.0.1", "1.1.1.1", "10.0.255.1", "10.0.255.2"},
+					withdrawnIPs:          []string{},
+					annotations:           nil,
+					externalTrafficPolicy: &testlocalExtTrafPol,
+				},
+			},
+		},
+		{
+			name: "check local external traffic policy with local IPv6 endpoints",
+			nrc: &NetworkRoutingController{
+				advertiseClusterIP:      true,
+				advertiseExternalIP:     true,
+				advertiseLoadBalancerIP: true,
+				primaryIP:               net.ParseIP(testNodeIPv6),
+				nodeIPv6Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv6)},
+				},
+			},
+			serviceAdvertisedIPs: []*ServiceAdvertisedIPs{
+				{
+					service:               getClusterSvc(),
+					endpoints:             getContainsLocalIPv6EPs(),
+					advertisedIPs:         []string{"10.0.0.1"},
+					withdrawnIPs:          []string{},
+					annotations:           nil,
+					externalTrafficPolicy: &testlocalExtTrafPol,
+				},
+				{
+					service:               getExternalSvc(),
+					endpoints:             getContainsLocalIPv6EPs(),
+					advertisedIPs:         []string{"10.0.0.1", "1.1.1.1"},
+					withdrawnIPs:          []string{},
+					annotations:           nil,
+					externalTrafficPolicy: &testlocalExtTrafPol,
+				},
+				{
+					service:               getNodePortSvc(),
+					endpoints:             getContainsLocalIPv6EPs(),
+					advertisedIPs:         []string{"10.0.0.1", "1.1.1.1"},
+					withdrawnIPs:          []string{},
+					annotations:           nil,
+					externalTrafficPolicy: &testlocalExtTrafPol,
+				},
+				{
+					service:               getLoadBalancerSvc(),
+					endpoints:             getContainsLocalIPv6EPs(),
+					advertisedIPs:         []string{"10.0.0.1", "1.1.1.1", "10.0.255.1", "10.0.255.2"},
+					withdrawnIPs:          []string{},
+					annotations:           nil,
+					externalTrafficPolicy: &testlocalExtTrafPol,
+				},
+			},
+		},
+		{
+			name: "check service local annotation WITHOUT local IPv4 endpoints",
+			nrc: &NetworkRoutingController{
+				advertiseClusterIP:      true,
+				advertiseExternalIP:     true,
+				advertiseLoadBalancerIP: true,
+				primaryIP:               net.ParseIP(testNodeIPv4),
+				nodeIPv6Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv6)},
+				},
+			},
+			serviceAdvertisedIPs: []*ServiceAdvertisedIPs{
+				{
+					service:       getClusterSvc(),
+					endpoints:     getNoLocalAddressesEPs(),
+					advertisedIPs: []string{},
+					withdrawnIPs:  []string{"10.0.0.1"},
+					annotations: map[string]string{
+						svcLocalAnnotation: "true",
+					},
+				},
+				{
+					service:       getExternalSvc(),
+					endpoints:     getNoLocalAddressesEPs(),
+					advertisedIPs: []string{},
+					withdrawnIPs:  []string{"10.0.0.1", "1.1.1.1"},
+					annotations: map[string]string{
+						svcLocalAnnotation: "true",
+					},
+				},
+				{
+					service:       getNodePortSvc(),
+					endpoints:     getNoLocalAddressesEPs(),
+					advertisedIPs: []string{},
+					withdrawnIPs:  []string{"10.0.0.1", "1.1.1.1"},
+					annotations: map[string]string{
+						svcLocalAnnotation: "true",
+					},
+				},
+				{
+					service:       getLoadBalancerSvc(),
+					endpoints:     getNoLocalAddressesEPs(),
+					advertisedIPs: []string{},
+					withdrawnIPs:  []string{"10.0.0.1", "1.1.1.1", "10.0.255.1", "10.0.255.2"},
+					annotations: map[string]string{
+						svcLocalAnnotation: "true",
+					},
+				},
+			},
+		},
+		{
+			name: "check service local annotation WITHOUT local IPv6 endpoints",
+			nrc: &NetworkRoutingController{
+				advertiseClusterIP:      true,
+				advertiseExternalIP:     true,
+				advertiseLoadBalancerIP: true,
+				primaryIP:               net.ParseIP(testNodeIPv6),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
+			},
+			serviceAdvertisedIPs: []*ServiceAdvertisedIPs{
+				{
+					service:       getClusterSvc(),
+					endpoints:     getNoLocalAddressesEPs(),
+					advertisedIPs: []string{},
+					withdrawnIPs:  []string{"10.0.0.1"},
+					annotations: map[string]string{
+						svcLocalAnnotation: "true",
+					},
+				},
+				{
+					service:       getExternalSvc(),
+					endpoints:     getNoLocalAddressesEPs(),
+					advertisedIPs: []string{},
+					withdrawnIPs:  []string{"10.0.0.1", "1.1.1.1"},
+					annotations: map[string]string{
+						svcLocalAnnotation: "true",
+					},
+				},
+				{
+					service:       getNodePortSvc(),
+					endpoints:     getNoLocalAddressesEPs(),
+					advertisedIPs: []string{},
+					withdrawnIPs:  []string{"10.0.0.1", "1.1.1.1"},
+					annotations: map[string]string{
+						svcLocalAnnotation: "true",
+					},
+				},
+				{
+					service:       getLoadBalancerSvc(),
+					endpoints:     getNoLocalAddressesEPs(),
+					advertisedIPs: []string{},
+					withdrawnIPs:  []string{"10.0.0.1", "1.1.1.1", "10.0.255.1", "10.0.255.2"},
+					annotations: map[string]string{
+						svcLocalAnnotation: "true",
+					},
+				},
+			},
+		},
+		{
+			name: "check local external traffic policy WITHOUT local IPv4 endpoints",
+			nrc: &NetworkRoutingController{
+				advertiseClusterIP:      true,
+				advertiseExternalIP:     true,
+				advertiseLoadBalancerIP: true,
+				primaryIP:               net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
+			},
+			serviceAdvertisedIPs: []*ServiceAdvertisedIPs{
+				{
+					service:               getClusterSvc(),
+					endpoints:             getNoLocalAddressesEPs(),
+					advertisedIPs:         []string{"10.0.0.1"},
+					withdrawnIPs:          []string{},
+					annotations:           nil,
+					externalTrafficPolicy: &testlocalExtTrafPol,
+				},
+				{
+					service:               getExternalSvc(),
+					endpoints:             getNoLocalAddressesEPs(),
+					advertisedIPs:         []string{"10.0.0.1"},
+					withdrawnIPs:          []string{"1.1.1.1"},
+					annotations:           nil,
+					externalTrafficPolicy: &testlocalExtTrafPol,
+				},
+				{
+					service:               getNodePortSvc(),
+					endpoints:             getNoLocalAddressesEPs(),
+					advertisedIPs:         []string{"10.0.0.1"},
+					withdrawnIPs:          []string{"1.1.1.1"},
+					annotations:           nil,
+					externalTrafficPolicy: &testlocalExtTrafPol,
+				},
+				{
+					service:               getLoadBalancerSvc(),
+					endpoints:             getNoLocalAddressesEPs(),
+					advertisedIPs:         []string{"10.0.0.1"},
+					withdrawnIPs:          []string{"1.1.1.1", "10.0.255.1", "10.0.255.2"},
+					annotations:           nil,
+					externalTrafficPolicy: &testlocalExtTrafPol,
+				},
+			},
+		},
+		{
+			name: "check local external traffic policy WITHOUT local IPv6 endpoints",
+			nrc: &NetworkRoutingController{
+				advertiseClusterIP:      true,
+				advertiseExternalIP:     true,
+				advertiseLoadBalancerIP: true,
+				primaryIP:               net.ParseIP(testNodeIPv6),
+				nodeIPv6Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv6)},
+				},
+			},
+			serviceAdvertisedIPs: []*ServiceAdvertisedIPs{
+				{
+					service:               getClusterSvc(),
+					endpoints:             getNoLocalAddressesEPs(),
+					advertisedIPs:         []string{"10.0.0.1"},
+					withdrawnIPs:          []string{},
+					annotations:           nil,
+					externalTrafficPolicy: &testlocalExtTrafPol,
+				},
+				{
+					service:               getExternalSvc(),
+					endpoints:             getNoLocalAddressesEPs(),
+					advertisedIPs:         []string{"10.0.0.1"},
+					withdrawnIPs:          []string{"1.1.1.1"},
+					annotations:           nil,
+					externalTrafficPolicy: &testlocalExtTrafPol,
+				},
+				{
+					service:               getNodePortSvc(),
+					endpoints:             getNoLocalAddressesEPs(),
+					advertisedIPs:         []string{"10.0.0.1"},
+					withdrawnIPs:          []string{"1.1.1.1"},
+					annotations:           nil,
+					externalTrafficPolicy: &testlocalExtTrafPol,
+				},
+				{
+					service:               getLoadBalancerSvc(),
+					endpoints:             getNoLocalAddressesEPs(),
+					advertisedIPs:         []string{"10.0.0.1"},
+					withdrawnIPs:          []string{"1.1.1.1", "10.0.255.1", "10.0.255.2"},
+					annotations:           nil,
+					externalTrafficPolicy: &testlocalExtTrafPol,
+				},
+			},
+		},
+		{
+			name: "check local internal traffic policy WITHOUT local IPv4 endpoints",
+			nrc: &NetworkRoutingController{
+				advertiseClusterIP:      true,
+				advertiseExternalIP:     true,
+				advertiseLoadBalancerIP: true,
+				primaryIP:               net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
+			},
+			serviceAdvertisedIPs: []*ServiceAdvertisedIPs{
+				{
+					service:               getClusterSvc(),
+					endpoints:             getNoLocalAddressesEPs(),
+					advertisedIPs:         []string{},
+					withdrawnIPs:          []string{"10.0.0.1"},
+					annotations:           nil,
+					internalTrafficPolicy: &testLocalIntTrafPol,
+				},
+				{
+					service:               getExternalSvc(),
+					endpoints:             getNoLocalAddressesEPs(),
+					advertisedIPs:         []string{"1.1.1.1"},
+					withdrawnIPs:          []string{"10.0.0.1"},
+					annotations:           nil,
+					internalTrafficPolicy: &testLocalIntTrafPol,
+				},
+				{
+					service:               getNodePortSvc(),
+					endpoints:             getNoLocalAddressesEPs(),
+					advertisedIPs:         []string{"1.1.1.1"},
+					withdrawnIPs:          []string{"10.0.0.1"},
+					annotations:           nil,
+					internalTrafficPolicy: &testLocalIntTrafPol,
+				},
+				{
+					service:               getLoadBalancerSvc(),
+					endpoints:             getNoLocalAddressesEPs(),
+					advertisedIPs:         []string{"1.1.1.1", "10.0.255.1", "10.0.255.2"},
+					withdrawnIPs:          []string{"10.0.0.1"},
+					annotations:           nil,
+					internalTrafficPolicy: &testLocalIntTrafPol,
+				},
+			},
+		},
+		{
+			name: "check local internal traffic policy WITHOUT local IPv6 endpoints",
+			nrc: &NetworkRoutingController{
+				advertiseClusterIP:      true,
+				advertiseExternalIP:     true,
+				advertiseLoadBalancerIP: true,
+				primaryIP:               net.ParseIP(testNodeIPv6),
+				nodeIPv6Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv6)},
+				},
+			},
+			serviceAdvertisedIPs: []*ServiceAdvertisedIPs{
+				{
+					service:               getClusterSvc(),
+					endpoints:             getNoLocalAddressesEPs(),
+					advertisedIPs:         []string{},
+					withdrawnIPs:          []string{"10.0.0.1"},
+					annotations:           nil,
+					internalTrafficPolicy: &testLocalIntTrafPol,
+				},
+				{
+					service:               getExternalSvc(),
+					endpoints:             getNoLocalAddressesEPs(),
+					advertisedIPs:         []string{"1.1.1.1"},
+					withdrawnIPs:          []string{"10.0.0.1"},
+					annotations:           nil,
+					internalTrafficPolicy: &testLocalIntTrafPol,
+				},
+				{
+					service:               getNodePortSvc(),
+					endpoints:             getNoLocalAddressesEPs(),
+					advertisedIPs:         []string{"1.1.1.1"},
+					withdrawnIPs:          []string{"10.0.0.1"},
+					annotations:           nil,
+					internalTrafficPolicy: &testLocalIntTrafPol,
+				},
+				{
+					service:               getLoadBalancerSvc(),
+					endpoints:             getNoLocalAddressesEPs(),
+					advertisedIPs:         []string{"1.1.1.1", "10.0.255.1", "10.0.255.2"},
+					withdrawnIPs:          []string{"10.0.0.1"},
+					annotations:           nil,
+					internalTrafficPolicy: &testLocalIntTrafPol,
+				},
+			},
+		},
 	}
 
 	for _, test := range tests {
-		nrc := NetworkRoutingController{}
 		t.Run(test.name, func(t *testing.T) {
-			nrc.advertiseClusterIP = test.advertiseSettings[0]
-			nrc.advertiseExternalIP = test.advertiseSettings[1]
-			nrc.advertiseLoadBalancerIP = test.advertiseSettings[2]
-
 			for _, serviceAdvertisedIP := range test.serviceAdvertisedIPs {
+				endpoints := serviceAdvertisedIP.endpoints
 				clientset := fake.NewSimpleClientset()
+				startInformersForRoutes(test.nrc, clientset)
 
+				// Take care of adding annotations
 				if serviceAdvertisedIP.annotations != nil {
 					serviceAdvertisedIP.service.ObjectMeta.Annotations = serviceAdvertisedIP.annotations
 				}
+
+				if serviceAdvertisedIP.internalTrafficPolicy != nil {
+					serviceAdvertisedIP.service.Spec.InternalTrafficPolicy = serviceAdvertisedIP.internalTrafficPolicy
+				}
+
+				if serviceAdvertisedIP.externalTrafficPolicy != nil {
+					serviceAdvertisedIP.service.Spec.ExternalTrafficPolicy = *serviceAdvertisedIP.externalTrafficPolicy
+				}
+
+				// Take care of adding endpoints if needed for test
+				if endpoints != nil {
+					endpoints.ObjectMeta.Name = serviceAdvertisedIP.service.Name
+					endpoints.ObjectMeta.Namespace = serviceAdvertisedIP.service.Namespace
+					if _, err := clientset.CoreV1().Endpoints(endpoints.GetObjectMeta().GetNamespace()).Create(
+						context.Background(), endpoints, metav1.CreateOptions{}); err != nil {
+						t.Fatalf("failed to create endpoints for test: %v", err)
+					}
+					waitForListerWithTimeout(test.nrc.epLister, time.Second*10, t)
+				}
+
 				svc, _ := clientset.CoreV1().Services("default").Create(context.Background(), serviceAdvertisedIP.service, metav1.CreateOptions{})
-				advertisedIPs, withdrawnIPs, _ := nrc.getVIPsForService(svc, false)
+				advertisedIPs, withdrawnIPs, err := test.nrc.getAllVIPsForService(svc)
+				if err != nil {
+					t.Errorf("We shouldn't get an error for any of these tests, failing due to: %v", err)
+				}
 				t.Logf("AdvertisedIPs: %v\n", advertisedIPs)
 				t.Logf("WithdrawnIPs: %v\n", withdrawnIPs)
 				if !Equal(serviceAdvertisedIP.advertisedIPs, advertisedIPs) {
@@ -373,3 +914,157 @@ func Test_getVIPsForService(t *testing.T) {
 		})
 	}
 }
+
+func getClusterSvc() *v1core.Service {
+	return &v1core.Service{
+		ObjectMeta: metav1.ObjectMeta{
+			Name:      "svc-cluster",
+			Namespace: "default",
+		},
+		Spec: v1core.ServiceSpec{
+			Type:                  ClusterIPST,
+			ClusterIP:             "10.0.0.1",
+			InternalTrafficPolicy: &testClusterIntTrafPol,
+			ExternalTrafficPolicy: testClusterExtTrafPol,
+		},
+	}
+}
+
+func getExternalSvc() *v1core.Service {
+	return &v1core.Service{
+		ObjectMeta: metav1.ObjectMeta{
+			Name:      "svc-external",
+			Namespace: "default",
+		},
+		Spec: v1core.ServiceSpec{
+			Type:                  ClusterIPST,
+			ClusterIP:             "10.0.0.1",
+			ExternalIPs:           []string{"1.1.1.1"},
+			InternalTrafficPolicy: &testClusterIntTrafPol,
+			ExternalTrafficPolicy: testClusterExtTrafPol,
+		},
+	}
+}
+
+func getNodePortSvc() *v1core.Service {
+	return &v1core.Service{
+		ObjectMeta: metav1.ObjectMeta{
+			Name:      "svc-nodeport",
+			Namespace: "default",
+		},
+		Spec: v1core.ServiceSpec{
+			Type:                  NodePortST,
+			ClusterIP:             "10.0.0.1",
+			ExternalIPs:           []string{"1.1.1.1"},
+			InternalTrafficPolicy: &testClusterIntTrafPol,
+			ExternalTrafficPolicy: testClusterExtTrafPol,
+		},
+	}
+}
+
+func getLoadBalancerSvc() *v1core.Service {
+	return &v1core.Service{
+		ObjectMeta: metav1.ObjectMeta{
+			Name:      "svc-loadbalancer",
+			Namespace: "default",
+		},
+		Spec: v1core.ServiceSpec{
+			Type:                  LoadBalancerST,
+			ClusterIP:             "10.0.0.1",
+			ExternalIPs:           []string{"1.1.1.1"},
+			InternalTrafficPolicy: &testClusterIntTrafPol,
+			ExternalTrafficPolicy: testClusterExtTrafPol,
+		},
+		Status: v1core.ServiceStatus{
+			LoadBalancer: v1core.LoadBalancerStatus{
+				Ingress: []v1core.LoadBalancerIngress{
+					{
+						IP: "10.0.255.1",
+					},
+					{
+						IP: "10.0.255.2",
+					},
+				},
+			},
+		},
+	}
+}
+
+func getContainsLocalIPv4EPs() *v1core.Endpoints {
+	return &v1core.Endpoints{
+		Subsets: []v1core.EndpointSubset{
+			{
+				Addresses: []v1core.EndpointAddress{
+					{
+						IP: testNodeIPv4,
+					},
+					{
+						IP: "10.1.0.2",
+					},
+				},
+			},
+			{
+				Addresses: []v1core.EndpointAddress{
+					{
+						IP: "10.1.1.1",
+					},
+				},
+			},
+		},
+	}
+}
+
+func getContainsLocalIPv6EPs() *v1core.Endpoints {
+	return &v1core.Endpoints{
+		Subsets: []v1core.EndpointSubset{
+			{
+				Addresses: []v1core.EndpointAddress{
+					{
+						IP: testNodeIPv6,
+					},
+					{
+						IP: "2001:db8:42:2::2",
+					},
+				},
+			},
+			{
+				Addresses: []v1core.EndpointAddress{
+					{
+						IP: "2001:db8:42:2::3",
+					},
+				},
+			},
+		},
+	}
+}
+
+func getNoLocalAddressesEPs() *v1core.Endpoints {
+	return &v1core.Endpoints{
+		Subsets: []v1core.EndpointSubset{
+			{
+				Addresses: []v1core.EndpointAddress{
+					{
+						IP: "2001:db8:42:2::3",
+					},
+					{
+						IP: "2001:db8:42:2::2",
+					},
+				},
+			},
+			{
+				Addresses: []v1core.EndpointAddress{
+					{
+						IP: "2001:db8:42:2::3",
+					},
+				},
+			},
+			{
+				Addresses: []v1core.EndpointAddress{
+					{
+						IP: "10.1.0.2",
+					},
+				},
+			},
+		},
+	}
+}
diff --git a/pkg/controllers/routing/network_routes_controller_test.go b/pkg/controllers/routing/network_routes_controller_test.go
index 95c0b236..82c8ca65 100644
--- a/pkg/controllers/routing/network_routes_controller_test.go
+++ b/pkg/controllers/routing/network_routes_controller_test.go
@@ -23,9 +23,10 @@ import (
 
 func Test_advertiseClusterIPs(t *testing.T) {
 	testcases := []struct {
-		name             string
-		nrc              *NetworkRoutingController
-		existingServices []*v1core.Service
+		name              string
+		nrc               *NetworkRoutingController
+		existingServices  []*v1core.Service
+		existingEndpoints []*v1core.Endpoints
 		// the key is the subnet from the watch event
 		watchEvents map[string]bool
 	}{
@@ -34,16 +35,39 @@ func Test_advertiseClusterIPs(t *testing.T) {
 			"add bgp path for service with ClusterIP",
 			&NetworkRoutingController{
 				bgpServer: gobgp.NewBgpServer(),
-				primaryIP: net.ParseIP("10.0.0.1"),
+				primaryIP: net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
 			},
 			[]*v1core.Service{
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-1",
+						Name:      "svc-1",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:      ClusterIPST,
-						ClusterIP: "10.0.0.1",
+						Type:                  ClusterIPST,
+						ClusterIP:             "10.0.0.1",
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
+					},
+				},
+			},
+			[]*v1core.Endpoints{
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-1",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
 					},
 				},
 			},
@@ -55,34 +79,93 @@ func Test_advertiseClusterIPs(t *testing.T) {
 			"add bgp path for service with ClusterIP/NodePort/LoadBalancer",
 			&NetworkRoutingController{
 				bgpServer: gobgp.NewBgpServer(),
-				primaryIP: net.ParseIP("10.0.0.1"),
+				primaryIP: net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
 			},
 			[]*v1core.Service{
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-1",
+						Name:      "svc-1",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:      ClusterIPST,
-						ClusterIP: "10.0.0.1",
+						Type:                  ClusterIPST,
+						ClusterIP:             "10.0.0.1",
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
 					},
 				},
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-2",
+						Name:      "svc-2",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:      LoadBalancerST,
-						ClusterIP: "10.0.0.2",
+						Type:                  LoadBalancerST,
+						ClusterIP:             "10.0.0.2",
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
 					},
 				},
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-3",
+						Name:      "svc-3",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:      NodePortST,
-						ClusterIP: "10.0.0.3",
+						Type:                  NodePortST,
+						ClusterIP:             "10.0.0.3",
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
+					},
+				},
+			},
+			[]*v1core.Endpoints{
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-1",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
+					},
+				},
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-2",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
+					},
+				},
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-3",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
 					},
 				},
 			},
@@ -96,16 +179,22 @@ func Test_advertiseClusterIPs(t *testing.T) {
 			"add bgp path for invalid service type",
 			&NetworkRoutingController{
 				bgpServer: gobgp.NewBgpServer(),
-				primaryIP: net.ParseIP("10.0.0.1"),
+				primaryIP: net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
 			},
 			[]*v1core.Service{
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-1",
+						Name:      "svc-1",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:      ClusterIPST,
-						ClusterIP: "10.0.0.1",
+						Type:                  ClusterIPST,
+						ClusterIP:             "10.0.0.1",
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
 					},
 				},
 				{
@@ -113,8 +202,42 @@ func Test_advertiseClusterIPs(t *testing.T) {
 						Name: "svc-2",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:      "AnotherType",
-						ClusterIP: "10.0.0.2",
+						Type:                  "AnotherType",
+						ClusterIP:             "10.0.0.2",
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
+					},
+				},
+			},
+			[]*v1core.Endpoints{
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-1",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
+					},
+				},
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-2",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
 					},
 				},
 			},
@@ -126,34 +249,93 @@ func Test_advertiseClusterIPs(t *testing.T) {
 			"add bgp path for headless service",
 			&NetworkRoutingController{
 				bgpServer: gobgp.NewBgpServer(),
-				primaryIP: net.ParseIP("10.0.0.1"),
+				primaryIP: net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
 			},
 			[]*v1core.Service{
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-1",
+						Name:      "svc-1",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:      ClusterIPST,
-						ClusterIP: "10.0.0.1",
+						Type:                  ClusterIPST,
+						ClusterIP:             "10.0.0.1",
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
 					},
 				},
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-2",
+						Name:      "svc-2",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:      ClusterIPST,
-						ClusterIP: "None",
+						Type:                  ClusterIPST,
+						ClusterIP:             "None",
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
 					},
 				},
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-3",
+						Name:      "svc-3",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:      ClusterIPST,
-						ClusterIP: "",
+						Type:                  ClusterIPST,
+						ClusterIP:             "",
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
+					},
+				},
+			},
+			[]*v1core.Endpoints{
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-1",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
+					},
+				},
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-2",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
+					},
+				},
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-3",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
 					},
 				},
 			},
@@ -168,7 +350,7 @@ func Test_advertiseClusterIPs(t *testing.T) {
 			go testcase.nrc.bgpServer.Serve()
 			global := &gobgpapi.Global{
 				Asn:        1,
-				RouterId:   "10.0.0.0",
+				RouterId:   testNodeIPv4,
 				ListenPort: 10000,
 			}
 			err := testcase.nrc.bgpServer.StartBgp(context.Background(), &gobgpapi.StartBgpRequest{Global: global})
@@ -189,6 +371,11 @@ func Test_advertiseClusterIPs(t *testing.T) {
 				t.Fatalf("failed to create existing services: %v", err)
 			}
 
+			err = createEndpoints(clientset, testcase.existingEndpoints)
+			if err != nil {
+				t.Fatalf("failed to create existing endpoints: %v", err)
+			}
+
 			waitForListerWithTimeout(testcase.nrc.svcLister, time.Second*10, t)
 
 			var events []*gobgpapi.Path
@@ -218,7 +405,7 @@ func Test_advertiseClusterIPs(t *testing.T) {
 			testcase.nrc.advertiseExternalIP = false
 			testcase.nrc.advertiseLoadBalancerIP = false
 
-			toAdvertise, toWithdraw, _ := testcase.nrc.getActiveVIPs()
+			toAdvertise, toWithdraw, _ := testcase.nrc.getVIPs()
 			testcase.nrc.advertiseVIPs(toAdvertise)
 			testcase.nrc.withdrawVIPs(toWithdraw)
 
@@ -253,9 +440,10 @@ func Test_advertiseClusterIPs(t *testing.T) {
 
 func Test_advertiseExternalIPs(t *testing.T) {
 	testcases := []struct {
-		name             string
-		nrc              *NetworkRoutingController
-		existingServices []*v1core.Service
+		name              string
+		nrc               *NetworkRoutingController
+		existingServices  []*v1core.Service
+		existingEndpoints []*v1core.Endpoints
 		// the key is the subnet from the watch event
 		watchEvents map[string]bool
 	}{
@@ -264,16 +452,39 @@ func Test_advertiseExternalIPs(t *testing.T) {
 			&NetworkRoutingController{
 				bgpServer: gobgp.NewBgpServer(),
 				primaryIP: net.ParseIP("10.0.0.1"),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
 			},
 			[]*v1core.Service{
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-1",
+						Name:      "svc-1",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:        ClusterIPST,
-						ClusterIP:   "10.0.0.1",
-						ExternalIPs: []string{"1.1.1.1", "2.2.2.2"},
+						Type:                  ClusterIPST,
+						ClusterIP:             "10.0.0.1",
+						ExternalIPs:           []string{"1.1.1.1", "2.2.2.2"},
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
+					},
+				},
+			},
+			[]*v1core.Endpoints{
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-1",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
 					},
 				},
 			},
@@ -286,37 +497,96 @@ func Test_advertiseExternalIPs(t *testing.T) {
 			"add bgp path for services with external IPs of type ClusterIP/NodePort/LoadBalancer",
 			&NetworkRoutingController{
 				bgpServer: gobgp.NewBgpServer(),
-				primaryIP: net.ParseIP("10.0.0.1"),
+				primaryIP: net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
 			},
 			[]*v1core.Service{
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-1",
+						Name:      "svc-1",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:        ClusterIPST,
-						ClusterIP:   "10.0.0.1",
-						ExternalIPs: []string{"1.1.1.1"},
+						Type:                  ClusterIPST,
+						ClusterIP:             "10.0.0.1",
+						ExternalIPs:           []string{"1.1.1.1"},
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
 					},
 				},
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-2",
+						Name:      "svc-2",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:        LoadBalancerST,
-						ClusterIP:   "10.0.0.2",
-						ExternalIPs: []string{"2.2.2.2"},
+						Type:                  LoadBalancerST,
+						ClusterIP:             "10.0.0.2",
+						ExternalIPs:           []string{"2.2.2.2"},
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
 					},
 				},
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-3",
+						Name:      "svc-3",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:        NodePortST,
-						ClusterIP:   "10.0.0.3",
-						ExternalIPs: []string{"3.3.3.3", "4.4.4.4"},
+						Type:                  NodePortST,
+						ClusterIP:             "10.0.0.3",
+						ExternalIPs:           []string{"3.3.3.3", "4.4.4.4"},
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
+					},
+				},
+			},
+			[]*v1core.Endpoints{
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-1",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
+					},
+				},
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-2",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
+					},
+				},
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-3",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
 					},
 				},
 			},
@@ -331,27 +601,68 @@ func Test_advertiseExternalIPs(t *testing.T) {
 			"add bgp path for invalid service type",
 			&NetworkRoutingController{
 				bgpServer: gobgp.NewBgpServer(),
-				primaryIP: net.ParseIP("10.0.0.1"),
+				primaryIP: net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
 			},
 			[]*v1core.Service{
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-1",
+						Name:      "svc-1",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:        ClusterIPST,
-						ClusterIP:   "10.0.0.1",
-						ExternalIPs: []string{"1.1.1.1"},
+						Type:                  ClusterIPST,
+						ClusterIP:             "10.0.0.1",
+						ExternalIPs:           []string{"1.1.1.1"},
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
 					},
 				},
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-2",
+						Name:      "svc-2",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:        "AnotherType",
-						ClusterIP:   "10.0.0.2",
-						ExternalIPs: []string{"2.2.2.2"},
+						Type:                  "AnotherType",
+						ClusterIP:             "10.0.0.2",
+						ExternalIPs:           []string{"2.2.2.2"},
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
+					},
+				},
+			},
+			[]*v1core.Endpoints{
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-1",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
+					},
+				},
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-2",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
 					},
 				},
 			},
@@ -363,37 +674,96 @@ func Test_advertiseExternalIPs(t *testing.T) {
 			"add bgp path for headless service",
 			&NetworkRoutingController{
 				bgpServer: gobgp.NewBgpServer(),
-				primaryIP: net.ParseIP("10.0.0.1"),
+				primaryIP: net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
 			},
 			[]*v1core.Service{
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-1",
+						Name:      "svc-1",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:        ClusterIPST,
-						ClusterIP:   "10.0.0.1",
-						ExternalIPs: []string{"1.1.1.1"},
+						Type:                  ClusterIPST,
+						ClusterIP:             "10.0.0.1",
+						ExternalIPs:           []string{"1.1.1.1"},
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
 					},
 				},
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-2",
+						Name:      "svc-2",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:        ClusterIPST,
-						ClusterIP:   "None",
-						ExternalIPs: []string{"2.2.2.2"},
+						Type:                  ClusterIPST,
+						ClusterIP:             "None",
+						ExternalIPs:           []string{"2.2.2.2"},
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
 					},
 				},
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-3",
+						Name:      "svc-3",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:        ClusterIPST,
-						ClusterIP:   "",
-						ExternalIPs: []string{"3.3.3.3"},
+						Type:                  ClusterIPST,
+						ClusterIP:             "",
+						ExternalIPs:           []string{"3.3.3.3"},
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
+					},
+				},
+			},
+			[]*v1core.Endpoints{
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-1",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
+					},
+				},
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-2",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
+					},
+				},
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-3",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
 					},
 				},
 			},
@@ -405,16 +775,22 @@ func Test_advertiseExternalIPs(t *testing.T) {
 			"skip bgp path to loadbalancerIP for service without LoadBalancer IP",
 			&NetworkRoutingController{
 				bgpServer: gobgp.NewBgpServer(),
-				primaryIP: net.ParseIP("10.0.0.1"),
+				primaryIP: net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
 			},
 			[]*v1core.Service{
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-1",
+						Name:      "svc-1",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:      LoadBalancerST,
-						ClusterIP: "10.0.0.1",
+						Type:                  LoadBalancerST,
+						ClusterIP:             "10.0.0.1",
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
 					},
 					Status: v1core.ServiceStatus{
 						LoadBalancer: v1core.LoadBalancerStatus{
@@ -427,22 +803,45 @@ func Test_advertiseExternalIPs(t *testing.T) {
 					},
 				},
 			},
+			[]*v1core.Endpoints{
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-1",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
+					},
+				},
+			},
 			map[string]bool{},
 		},
 		{
 			"add bgp path to loadbalancerIP for service with LoadBalancer IP",
 			&NetworkRoutingController{
 				bgpServer: gobgp.NewBgpServer(),
-				primaryIP: net.ParseIP("10.0.0.1"),
+				primaryIP: net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
 			},
 			[]*v1core.Service{
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-1",
+						Name:      "svc-1",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:      LoadBalancerST,
-						ClusterIP: "10.0.0.1",
+						Type:                  LoadBalancerST,
+						ClusterIP:             "10.0.0.1",
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
 					},
 					Status: v1core.ServiceStatus{
 						LoadBalancer: v1core.LoadBalancerStatus{
@@ -458,6 +857,23 @@ func Test_advertiseExternalIPs(t *testing.T) {
 					},
 				},
 			},
+			[]*v1core.Endpoints{
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-1",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
+					},
+				},
+			},
 			map[string]bool{
 				"10.0.255.1/32": true,
 				"10.0.255.2/32": true,
@@ -467,16 +883,22 @@ func Test_advertiseExternalIPs(t *testing.T) {
 			"no bgp path to nil loadbalancerIPs for service with LoadBalancer",
 			&NetworkRoutingController{
 				bgpServer: gobgp.NewBgpServer(),
-				primaryIP: net.ParseIP("10.0.0.1"),
+				primaryIP: net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
 			},
 			[]*v1core.Service{
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-1",
+						Name:      "svc-1",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:      LoadBalancerST,
-						ClusterIP: "10.0.0.1",
+						Type:                  LoadBalancerST,
+						ClusterIP:             "10.0.0.1",
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
 					},
 					Status: v1core.ServiceStatus{
 						LoadBalancer: v1core.LoadBalancerStatus{
@@ -485,25 +907,48 @@ func Test_advertiseExternalIPs(t *testing.T) {
 					},
 				},
 			},
+			[]*v1core.Endpoints{
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-1",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
+					},
+				},
+			},
 			map[string]bool{},
 		},
 		{
 			"no bgp path to loadbalancerIPs for service with LoadBalancer and skiplbips annotation",
 			&NetworkRoutingController{
 				bgpServer: gobgp.NewBgpServer(),
-				primaryIP: net.ParseIP("10.0.0.1"),
+				primaryIP: net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
 			},
 			[]*v1core.Service{
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-1",
+						Name:      "svc-1",
+						Namespace: "default",
 						Annotations: map[string]string{
 							svcSkipLbIpsAnnotation: "true",
 						},
 					},
 					Spec: v1core.ServiceSpec{
-						Type:      LoadBalancerST,
-						ClusterIP: "10.0.0.1",
+						Type:                  LoadBalancerST,
+						ClusterIP:             "10.0.0.1",
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
 					},
 					Status: v1core.ServiceStatus{
 						LoadBalancer: v1core.LoadBalancerStatus{
@@ -519,17 +964,33 @@ func Test_advertiseExternalIPs(t *testing.T) {
 					},
 				},
 			},
+			[]*v1core.Endpoints{
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-1",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
+					},
+				},
+			},
 			map[string]bool{},
 		},
 	}
 
-	//nolint:dupl // There is no need to spend a lot of time de-duplicating test code
 	for _, testcase := range testcases {
 		t.Run(testcase.name, func(t *testing.T) {
 			go testcase.nrc.bgpServer.Serve()
 			global := &gobgpapi.Global{
 				Asn:        1,
-				RouterId:   "10.0.0.0",
+				RouterId:   testNodeIPv4,
 				ListenPort: 10000,
 			}
 			err := testcase.nrc.bgpServer.StartBgp(context.Background(), &gobgpapi.StartBgpRequest{Global: global})
@@ -572,6 +1033,11 @@ func Test_advertiseExternalIPs(t *testing.T) {
 				t.Fatalf("failed to create existing services: %v", err)
 			}
 
+			err = createEndpoints(clientset, testcase.existingEndpoints)
+			if err != nil {
+				t.Fatalf("failed to create existing endpoints: %v", err)
+			}
+
 			waitForListerWithTimeout(testcase.nrc.svcLister, time.Second*10, t)
 
 			// ExternalIPs
@@ -579,7 +1045,7 @@ func Test_advertiseExternalIPs(t *testing.T) {
 			testcase.nrc.advertiseExternalIP = true
 			testcase.nrc.advertiseLoadBalancerIP = true
 
-			toAdvertise, toWithdraw, _ := testcase.nrc.getActiveVIPs()
+			toAdvertise, toWithdraw, _ := testcase.nrc.getVIPs()
 			testcase.nrc.advertiseVIPs(toAdvertise)
 			testcase.nrc.withdrawVIPs(toWithdraw)
 			timeoutCh := time.After(time.Second * 10)
@@ -614,9 +1080,10 @@ func Test_advertiseExternalIPs(t *testing.T) {
 
 func Test_advertiseAnnotationOptOut(t *testing.T) {
 	testcases := []struct {
-		name             string
-		nrc              *NetworkRoutingController
-		existingServices []*v1core.Service
+		name              string
+		nrc               *NetworkRoutingController
+		existingServices  []*v1core.Service
+		existingEndpoints []*v1core.Endpoints
 		// the key is the subnet from the watch event
 		watchEvents map[string]bool
 	}{
@@ -624,37 +1091,49 @@ func Test_advertiseAnnotationOptOut(t *testing.T) {
 			"add bgp paths for all service IPs",
 			&NetworkRoutingController{
 				bgpServer: gobgp.NewBgpServer(),
-				primaryIP: net.ParseIP("10.0.1.1"),
+				primaryIP: net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
 			},
 			[]*v1core.Service{
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-1",
+						Name:      "svc-1",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:        ClusterIPST,
-						ClusterIP:   "10.0.0.1",
-						ExternalIPs: []string{"1.1.1.1"},
+						Type:                  ClusterIPST,
+						ClusterIP:             "10.0.0.1",
+						ExternalIPs:           []string{"1.1.1.1"},
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
 					},
 				},
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-2",
+						Name:      "svc-2",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:        NodePortST,
-						ClusterIP:   "10.0.0.2",
-						ExternalIPs: []string{"2.2.2.2", "3.3.3.3"},
+						Type:                  NodePortST,
+						ClusterIP:             "10.0.0.2",
+						ExternalIPs:           []string{"2.2.2.2", "3.3.3.3"},
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
 					},
 				},
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-3",
+						Name:      "svc-3",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:        LoadBalancerST,
-						ClusterIP:   "10.0.0.3",
-						ExternalIPs: []string{"4.4.4.4"},
+						Type:                  LoadBalancerST,
+						ClusterIP:             "10.0.0.3",
+						ExternalIPs:           []string{"4.4.4.4"},
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
 					},
 					Status: v1core.ServiceStatus{
 						LoadBalancer: v1core.LoadBalancerStatus{
@@ -670,6 +1149,53 @@ func Test_advertiseAnnotationOptOut(t *testing.T) {
 					},
 				},
 			},
+			[]*v1core.Endpoints{
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-1",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
+					},
+				},
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-2",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
+					},
+				},
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-3",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
+					},
+				},
+			},
 			map[string]bool{
 				"10.0.0.1/32":   true,
 				"10.0.0.2/32":   true,
@@ -686,12 +1212,16 @@ func Test_advertiseAnnotationOptOut(t *testing.T) {
 			"opt out to advertise any IPs via annotations",
 			&NetworkRoutingController{
 				bgpServer: gobgp.NewBgpServer(),
-				primaryIP: net.ParseIP("10.0.1.1"),
+				primaryIP: net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
 			},
 			[]*v1core.Service{
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-1",
+						Name:      "svc-1",
+						Namespace: "default",
 						Annotations: map[string]string{
 							svcAdvertiseClusterAnnotation:      "false",
 							svcAdvertiseExternalAnnotation:     "false",
@@ -699,9 +1229,11 @@ func Test_advertiseAnnotationOptOut(t *testing.T) {
 						},
 					},
 					Spec: v1core.ServiceSpec{
-						Type:        LoadBalancerST,
-						ClusterIP:   "10.0.0.1",
-						ExternalIPs: []string{"1.1.1.1", "2.2.2.2"},
+						Type:                  LoadBalancerST,
+						ClusterIP:             "10.0.0.1",
+						ExternalIPs:           []string{"1.1.1.1", "2.2.2.2"},
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
 					},
 					Status: v1core.ServiceStatus{
 						LoadBalancer: v1core.LoadBalancerStatus{
@@ -717,11 +1249,27 @@ func Test_advertiseAnnotationOptOut(t *testing.T) {
 					},
 				},
 			},
+			[]*v1core.Endpoints{
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-1",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
+					},
+				},
+			},
 			map[string]bool{},
 		},
 	}
 
-	//nolint:dupl // There is no need to spend a lot of time de-duplicating test code
 	for _, testcase := range testcases {
 		t.Run(testcase.name, func(t *testing.T) {
 			go testcase.nrc.bgpServer.Serve()
@@ -771,6 +1319,11 @@ func Test_advertiseAnnotationOptOut(t *testing.T) {
 				t.Fatalf("failed to create existing services: %v", err)
 			}
 
+			err = createEndpoints(clientset, testcase.existingEndpoints)
+			if err != nil {
+				t.Fatalf("failed to create existing endpoints: %v", err)
+			}
+
 			waitForListerWithTimeout(testcase.nrc.svcLister, time.Second*10, t)
 
 			// By default advertise all IPs
@@ -778,7 +1331,7 @@ func Test_advertiseAnnotationOptOut(t *testing.T) {
 			testcase.nrc.advertiseExternalIP = true
 			testcase.nrc.advertiseLoadBalancerIP = true
 
-			toAdvertise, toWithdraw, _ := testcase.nrc.getActiveVIPs()
+			toAdvertise, toWithdraw, _ := testcase.nrc.getVIPs()
 			testcase.nrc.advertiseVIPs(toAdvertise)
 			testcase.nrc.withdrawVIPs(toWithdraw)
 			timeoutCh := time.After(time.Second * 10)
@@ -813,9 +1366,10 @@ func Test_advertiseAnnotationOptOut(t *testing.T) {
 
 func Test_advertiseAnnotationOptIn(t *testing.T) {
 	testcases := []struct {
-		name             string
-		nrc              *NetworkRoutingController
-		existingServices []*v1core.Service
+		name              string
+		nrc               *NetworkRoutingController
+		existingServices  []*v1core.Service
+		existingEndpoints []*v1core.Endpoints
 		// the key is the subnet from the watch event
 		watchEvents map[string]bool
 	}{
@@ -823,39 +1377,51 @@ func Test_advertiseAnnotationOptIn(t *testing.T) {
 			"no bgp paths for any service IPs",
 			&NetworkRoutingController{
 				bgpServer: gobgp.NewBgpServer(),
-				primaryIP: net.ParseIP("10.0.1.1"),
+				primaryIP: net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
 			},
 			[]*v1core.Service{
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-1",
+						Name:      "svc-1",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:        ClusterIPST,
-						ClusterIP:   "10.0.0.1",
-						ExternalIPs: []string{"1.1.1.1"},
+						Type:                  ClusterIPST,
+						ClusterIP:             "10.0.0.1",
+						ExternalIPs:           []string{"1.1.1.1"},
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
 					},
 				},
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-2",
+						Name:      "svc-2",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
-						Type:        NodePortST,
-						ClusterIP:   "10.0.0.2",
-						ExternalIPs: []string{"2.2.2.2", "3.3.3.3"},
+						Type:                  NodePortST,
+						ClusterIP:             "10.0.0.2",
+						ExternalIPs:           []string{"2.2.2.2", "3.3.3.3"},
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
 					},
 				},
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-3",
+						Name:      "svc-3",
+						Namespace: "default",
 					},
 					Spec: v1core.ServiceSpec{
 						Type:      LoadBalancerST,
 						ClusterIP: "10.0.0.3",
 						// ignored since LoadBalancer services don't
 						// advertise external IPs.
-						ExternalIPs: []string{"4.4.4.4"},
+						ExternalIPs:           []string{"4.4.4.4"},
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
 					},
 					Status: v1core.ServiceStatus{
 						LoadBalancer: v1core.LoadBalancerStatus{
@@ -871,18 +1437,69 @@ func Test_advertiseAnnotationOptIn(t *testing.T) {
 					},
 				},
 			},
+			[]*v1core.Endpoints{
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-1",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
+					},
+				},
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-2",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
+					},
+				},
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-3",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
+					},
+				},
+			},
 			map[string]bool{},
 		},
 		{
 			"opt in to advertise all IPs via annotations",
 			&NetworkRoutingController{
 				bgpServer: gobgp.NewBgpServer(),
-				primaryIP: net.ParseIP("10.0.1.1"),
+				primaryIP: net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
 			},
 			[]*v1core.Service{
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-1",
+						Name:      "svc-1",
+						Namespace: "default",
 						Annotations: map[string]string{
 							svcAdvertiseClusterAnnotation:      "true",
 							svcAdvertiseExternalAnnotation:     "true",
@@ -890,14 +1507,17 @@ func Test_advertiseAnnotationOptIn(t *testing.T) {
 						},
 					},
 					Spec: v1core.ServiceSpec{
-						Type:        ClusterIPST,
-						ClusterIP:   "10.0.0.1",
-						ExternalIPs: []string{"1.1.1.1"},
+						Type:                  ClusterIPST,
+						ClusterIP:             "10.0.0.1",
+						ExternalIPs:           []string{"1.1.1.1"},
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
 					},
 				},
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-2",
+						Name:      "svc-2",
+						Namespace: "default",
 						Annotations: map[string]string{
 							svcAdvertiseClusterAnnotation:      "true",
 							svcAdvertiseExternalAnnotation:     "true",
@@ -905,14 +1525,17 @@ func Test_advertiseAnnotationOptIn(t *testing.T) {
 						},
 					},
 					Spec: v1core.ServiceSpec{
-						Type:        NodePortST,
-						ClusterIP:   "10.0.0.2",
-						ExternalIPs: []string{"2.2.2.2", "3.3.3.3"},
+						Type:                  NodePortST,
+						ClusterIP:             "10.0.0.2",
+						ExternalIPs:           []string{"2.2.2.2", "3.3.3.3"},
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
 					},
 				},
 				{
 					ObjectMeta: metav1.ObjectMeta{
-						Name: "svc-3",
+						Name:      "svc-3",
+						Namespace: "default",
 						Annotations: map[string]string{
 							svcAdvertiseClusterAnnotation:      "true",
 							svcAdvertiseExternalAnnotation:     "true",
@@ -920,9 +1543,11 @@ func Test_advertiseAnnotationOptIn(t *testing.T) {
 						},
 					},
 					Spec: v1core.ServiceSpec{
-						Type:        LoadBalancerST,
-						ClusterIP:   "10.0.0.3",
-						ExternalIPs: []string{"4.4.4.4"},
+						Type:                  LoadBalancerST,
+						ClusterIP:             "10.0.0.3",
+						ExternalIPs:           []string{"4.4.4.4"},
+						InternalTrafficPolicy: &testClusterIntTrafPol,
+						ExternalTrafficPolicy: testClusterExtTrafPol,
 					},
 					Status: v1core.ServiceStatus{
 						LoadBalancer: v1core.LoadBalancerStatus{
@@ -938,6 +1563,53 @@ func Test_advertiseAnnotationOptIn(t *testing.T) {
 					},
 				},
 			},
+			[]*v1core.Endpoints{
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-1",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
+					},
+				},
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-2",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
+					},
+				},
+				{
+					ObjectMeta: metav1.ObjectMeta{
+						Name:      "svc-3",
+						Namespace: "default",
+					},
+					Subsets: []v1core.EndpointSubset{
+						{
+							Addresses: []v1core.EndpointAddress{
+								{
+									IP: testNodeIPv4,
+								},
+							},
+						},
+					},
+				},
+			},
 			map[string]bool{
 				"10.0.0.1/32":   true,
 				"10.0.0.2/32":   true,
@@ -952,7 +1624,6 @@ func Test_advertiseAnnotationOptIn(t *testing.T) {
 		},
 	}
 
-	//nolint:dupl // There is no need to spend a lot of time de-duplicating test code
 	for _, testcase := range testcases {
 		t.Run(testcase.name, func(t *testing.T) {
 			go testcase.nrc.bgpServer.Serve()
@@ -1002,6 +1673,11 @@ func Test_advertiseAnnotationOptIn(t *testing.T) {
 				t.Fatalf("failed to create existing services: %v", err)
 			}
 
+			err = createEndpoints(clientset, testcase.existingEndpoints)
+			if err != nil {
+				t.Fatalf("failed to create existing endpoints: %v", err)
+			}
+
 			waitForListerWithTimeout(testcase.nrc.svcLister, time.Second*10, t)
 
 			// By default do not advertise any IPs
@@ -1009,7 +1685,7 @@ func Test_advertiseAnnotationOptIn(t *testing.T) {
 			testcase.nrc.advertiseExternalIP = false
 			testcase.nrc.advertiseLoadBalancerIP = false
 
-			toAdvertise, toWithdraw, _ := testcase.nrc.getActiveVIPs()
+			toAdvertise, toWithdraw, _ := testcase.nrc.getVIPs()
 			testcase.nrc.advertiseVIPs(toAdvertise)
 			testcase.nrc.withdrawVIPs(toWithdraw)
 
@@ -1055,7 +1731,11 @@ func Test_nodeHasEndpointsForService(t *testing.T) {
 		{
 			"node has endpoints for service",
 			&NetworkRoutingController{
-				nodeName: "node-1",
+				nodeName:  "node-1",
+				primaryIP: net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
 			},
 			&v1core.Service{
 				ObjectMeta: metav1.ObjectMeta{
@@ -1063,9 +1743,11 @@ func Test_nodeHasEndpointsForService(t *testing.T) {
 					Namespace: "default",
 				},
 				Spec: v1core.ServiceSpec{
-					Type:        ClusterIPST,
-					ClusterIP:   "10.0.0.1",
-					ExternalIPs: []string{"1.1.1.1", "2.2.2.2"},
+					Type:                  ClusterIPST,
+					ClusterIP:             "10.0.0.1",
+					ExternalIPs:           []string{"1.1.1.1", "2.2.2.2"},
+					InternalTrafficPolicy: &testClusterIntTrafPol,
+					ExternalTrafficPolicy: testClusterExtTrafPol,
 				},
 			},
 			&v1core.Endpoints{
@@ -1094,7 +1776,11 @@ func Test_nodeHasEndpointsForService(t *testing.T) {
 		{
 			"node has no endpoints for service",
 			&NetworkRoutingController{
-				nodeName: "node-1",
+				nodeName:  "node-1",
+				primaryIP: net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
 			},
 			&v1core.Service{
 				ObjectMeta: metav1.ObjectMeta{
@@ -1102,9 +1788,11 @@ func Test_nodeHasEndpointsForService(t *testing.T) {
 					Namespace: "default",
 				},
 				Spec: v1core.ServiceSpec{
-					Type:        ClusterIPST,
-					ClusterIP:   "10.0.0.1",
-					ExternalIPs: []string{"1.1.1.1", "2.2.2.2"},
+					Type:                  ClusterIPST,
+					ClusterIP:             "10.0.0.1",
+					ExternalIPs:           []string{"1.1.1.1", "2.2.2.2"},
+					InternalTrafficPolicy: &testClusterIntTrafPol,
+					ExternalTrafficPolicy: testClusterExtTrafPol,
 				},
 			},
 			&v1core.Endpoints{
@@ -1183,7 +1871,10 @@ func Test_advertisePodRoute(t *testing.T) {
 				podCidr:       "172.20.0.0/24",
 				isIPv4Capable: true,
 				podIPv4CIDRs:  []string{"172.20.0.0/24"},
-				primaryIP:     net.ParseIP("10.0.0.1"),
+				primaryIP:     net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
 			},
 			"node-1",
 			&v1core.Node{
@@ -1210,7 +1901,10 @@ func Test_advertisePodRoute(t *testing.T) {
 				podCidr:          "172.20.0.0/24",
 				isIPv4Capable:    true,
 				podIPv4CIDRs:     []string{"172.20.0.0/24"},
-				primaryIP:        net.ParseIP("10.0.0.1"),
+				primaryIP:        net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
 			},
 			"",
 			&v1core.Node{
@@ -1240,7 +1934,10 @@ func Test_advertisePodRoute(t *testing.T) {
 					v1core.NodeInternalIP: {net.IPv6loopback},
 				},
 				isIPv6Capable: true,
-				primaryIP:     net.ParseIP("10.0.0.1"),
+				primaryIP:     net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
 			},
 			"",
 			&v1core.Node{
@@ -1303,7 +2000,7 @@ func Test_advertisePodRoute(t *testing.T) {
 			go testcase.nrc.bgpServer.Serve()
 			global := &gobgpapi.Global{
 				Asn:        1,
-				RouterId:   "10.0.0.0",
+				RouterId:   testNodeIPv4,
 				ListenPort: 10000,
 			}
 			err := testcase.nrc.bgpServer.StartBgp(context.Background(), &gobgpapi.StartBgpRequest{Global: global})
@@ -1398,9 +2095,12 @@ func Test_syncInternalPeers(t *testing.T) {
 			&NetworkRoutingController{
 				bgpFullMeshMode: true,
 				clientset:       fake.NewSimpleClientset(),
-				primaryIP:       net.ParseIP("10.0.0.0"),
-				bgpServer:       gobgp.NewBgpServer(),
-				activeNodes:     make(map[string]bool),
+				primaryIP:       net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
+				bgpServer:   gobgp.NewBgpServer(),
+				activeNodes: make(map[string]bool),
 			},
 			[]*v1core.Node{
 				{
@@ -1426,9 +2126,12 @@ func Test_syncInternalPeers(t *testing.T) {
 			&NetworkRoutingController{
 				bgpFullMeshMode: true,
 				clientset:       fake.NewSimpleClientset(),
-				primaryIP:       net.ParseIP("10.0.0.0"),
-				bgpServer:       gobgp.NewBgpServer(),
-				activeNodes:     make(map[string]bool),
+				primaryIP:       net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
+				bgpServer:   gobgp.NewBgpServer(),
+				activeNodes: make(map[string]bool),
 			},
 			[]*v1core.Node{
 				{
@@ -1468,8 +2171,11 @@ func Test_syncInternalPeers(t *testing.T) {
 			&NetworkRoutingController{
 				bgpFullMeshMode: true,
 				clientset:       fake.NewSimpleClientset(),
-				primaryIP:       net.ParseIP("10.0.0.0"),
-				bgpServer:       gobgp.NewBgpServer(),
+				primaryIP:       net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
+				bgpServer: gobgp.NewBgpServer(),
 				activeNodes: map[string]bool{
 					"10.0.0.2": true,
 				},
@@ -1498,10 +2204,13 @@ func Test_syncInternalPeers(t *testing.T) {
 			&NetworkRoutingController{
 				bgpFullMeshMode: false,
 				clientset:       fake.NewSimpleClientset(),
-				primaryIP:       net.ParseIP("10.0.0.0"),
-				bgpServer:       gobgp.NewBgpServer(),
-				activeNodes:     make(map[string]bool),
-				nodeAsnNumber:   100,
+				primaryIP:       net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
+				bgpServer:     gobgp.NewBgpServer(),
+				activeNodes:   make(map[string]bool),
+				nodeAsnNumber: 100,
 			},
 			[]*v1core.Node{
 				{
@@ -1545,7 +2254,7 @@ func Test_syncInternalPeers(t *testing.T) {
 			go testcase.nrc.bgpServer.Serve()
 			global := &gobgpapi.Global{
 				Asn:        1,
-				RouterId:   "10.0.0.0",
+				RouterId:   testNodeIPv4,
 				ListenPort: 10000,
 			}
 			err := testcase.nrc.bgpServer.StartBgp(context.Background(), &gobgpapi.StartBgpRequest{Global: global})
@@ -1604,11 +2313,14 @@ func Test_routeReflectorConfiguration(t *testing.T) {
 		{
 			"RR server with int cluster id",
 			&NetworkRoutingController{
-				bgpFullMeshMode:  false,
-				bgpPort:          10000,
-				clientset:        fake.NewSimpleClientset(),
-				primaryIP:        net.ParseIP("10.0.0.0"),
-				routerID:         "10.0.0.0",
+				bgpFullMeshMode: false,
+				bgpPort:         10000,
+				clientset:       fake.NewSimpleClientset(),
+				primaryIP:       net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
+				routerID:         testNodeIPv4,
 				bgpServer:        gobgp.NewBgpServer(),
 				activeNodes:      make(map[string]bool),
 				nodeAsnNumber:    100,
@@ -1631,11 +2343,14 @@ func Test_routeReflectorConfiguration(t *testing.T) {
 		{
 			"RR server with IPv4 cluster id",
 			&NetworkRoutingController{
-				bgpFullMeshMode:  false,
-				bgpPort:          10000,
-				clientset:        fake.NewSimpleClientset(),
-				primaryIP:        net.ParseIP("10.0.0.0"),
-				routerID:         "10.0.0.0",
+				bgpFullMeshMode: false,
+				bgpPort:         10000,
+				clientset:       fake.NewSimpleClientset(),
+				primaryIP:       net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
+				routerID:         testNodeIPv4,
 				bgpServer:        gobgp.NewBgpServer(),
 				activeNodes:      make(map[string]bool),
 				nodeAsnNumber:    100,
@@ -1658,11 +2373,14 @@ func Test_routeReflectorConfiguration(t *testing.T) {
 		{
 			"RR client with int cluster id",
 			&NetworkRoutingController{
-				bgpFullMeshMode:  false,
-				bgpPort:          10000,
-				clientset:        fake.NewSimpleClientset(),
-				primaryIP:        net.ParseIP("10.0.0.0"),
-				routerID:         "10.0.0.0",
+				bgpFullMeshMode: false,
+				bgpPort:         10000,
+				clientset:       fake.NewSimpleClientset(),
+				primaryIP:       net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
+				routerID:         testNodeIPv4,
 				bgpServer:        gobgp.NewBgpServer(),
 				activeNodes:      make(map[string]bool),
 				nodeAsnNumber:    100,
@@ -1685,11 +2403,14 @@ func Test_routeReflectorConfiguration(t *testing.T) {
 		{
 			"RR client with IPv4 cluster id",
 			&NetworkRoutingController{
-				bgpFullMeshMode:  false,
-				bgpPort:          10000,
-				clientset:        fake.NewSimpleClientset(),
-				primaryIP:        net.ParseIP("10.0.0.0"),
-				routerID:         "10.0.0.0",
+				bgpFullMeshMode: false,
+				bgpPort:         10000,
+				clientset:       fake.NewSimpleClientset(),
+				primaryIP:       net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
+				routerID:         testNodeIPv4,
 				bgpServer:        gobgp.NewBgpServer(),
 				activeNodes:      make(map[string]bool),
 				nodeAsnNumber:    100,
@@ -1712,10 +2433,13 @@ func Test_routeReflectorConfiguration(t *testing.T) {
 		{
 			"RR server with unparseable cluster id",
 			&NetworkRoutingController{
-				bgpFullMeshMode:  false,
-				bgpPort:          10000,
-				clientset:        fake.NewSimpleClientset(),
-				primaryIP:        net.ParseIP("10.0.0.0"),
+				bgpFullMeshMode: false,
+				bgpPort:         10000,
+				clientset:       fake.NewSimpleClientset(),
+				primaryIP:       net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
 				bgpServer:        gobgp.NewBgpServer(),
 				activeNodes:      make(map[string]bool),
 				nodeAsnNumber:    100,
@@ -1738,10 +2462,13 @@ func Test_routeReflectorConfiguration(t *testing.T) {
 		{
 			"RR client with unparseable cluster id",
 			&NetworkRoutingController{
-				bgpFullMeshMode:  false,
-				bgpPort:          10000,
-				clientset:        fake.NewSimpleClientset(),
-				primaryIP:        net.ParseIP("10.0.0.0"),
+				bgpFullMeshMode: false,
+				bgpPort:         10000,
+				clientset:       fake.NewSimpleClientset(),
+				primaryIP:       net.ParseIP(testNodeIPv4),
+				nodeIPv4Addrs: map[v1core.NodeAddressType][]net.IP{v1core.NodeInternalIP: {
+					net.ParseIP(testNodeIPv4)},
+				},
 				bgpServer:        gobgp.NewBgpServer(),
 				activeNodes:      make(map[string]bool),
 				nodeAsnNumber:    100,
@@ -2003,7 +2730,7 @@ func Test_generateTunnelName(t *testing.T) {
 
 func createServices(clientset kubernetes.Interface, svcs []*v1core.Service) error {
 	for _, svc := range svcs {
-		_, err := clientset.CoreV1().Services("default").Create(context.Background(), svc, metav1.CreateOptions{})
+		_, err := clientset.CoreV1().Services(svc.ObjectMeta.Namespace).Create(context.Background(), svc, metav1.CreateOptions{})
 		if err != nil {
 			return err
 		}
@@ -2023,6 +2750,18 @@ func createNodes(clientset kubernetes.Interface, nodes []*v1core.Node) error {
 	return nil
 }
 
+func createEndpoints(clientset kubernetes.Interface, endpoints []*v1core.Endpoints) error {
+	for _, eps := range endpoints {
+		_, err := clientset.CoreV1().Endpoints(eps.ObjectMeta.Namespace).Create(
+			context.Background(), eps, metav1.CreateOptions{})
+		if err != nil {
+			return err
+		}
+	}
+
+	return nil
+}
+
 func startInformersForRoutes(nrc *NetworkRoutingController, clientset kubernetes.Interface) {
 	informerFactory := informers.NewSharedInformerFactory(clientset, 0)
 	svcInformer := informerFactory.Core().V1().Services().Informer()