@@ -717,6 +717,136 @@ var updateEndpointsWithChangedHosts = &testEnvironment{
717717 },
718718 },
719719}
720+
721+ var multiNamespaceHeadlessMirrorEndpointsWithSameServiceName = & testEnvironment {
722+ events : []interface {}{
723+ & OnUpdateEndpointsCalled {
724+ ep : remoteHeadlessEndpoints (
725+ "service-one" ,
726+ "ns1" ,
727+ "999" ,
728+ "192.0.0.1" ,
729+ []corev1.EndpointPort {
730+ {Name : "port1" , Protocol : "TCP" , Port : 555 },
731+ {Name : "port2" , Protocol : "TCP" , Port : 666 },
732+ },
733+ ),
734+ },
735+ },
736+ remoteResources : []string {
737+ asYaml (gateway ("gateway" , "gateway-ns" , "currentGatewayResVersion" , "192.0.2.127" , "mc-gateway" , 888 , "" , defaultProbePort , defaultProbePath , defaultProbePeriod )),
738+ asYaml (remoteHeadlessService ("service-one" , "ns1" , "111" , map [string ]string {consts .DefaultExportedServiceSelector : "true" }, []corev1.ServicePort {
739+ {Name : "port1" , Protocol : "TCP" , Port : 555 },
740+ {Name : "port2" , Protocol : "TCP" , Port : 666 },
741+ })),
742+ asYaml (remoteHeadlessService ("service-one" , "ns2" , "222" , map [string ]string {consts .DefaultExportedServiceSelector : "true" }, []corev1.ServicePort {
743+ {Name : "port1" , Protocol : "TCP" , Port : 555 },
744+ {Name : "port2" , Protocol : "TCP" , Port : 666 },
745+ })),
746+ asYaml (remoteHeadlessEndpoints ("service-one" , "ns1" , "998" , "192.0.0.1" , []corev1.EndpointPort {
747+ {Name : "port1" , Protocol : "TCP" , Port : 555 },
748+ {Name : "port2" , Protocol : "TCP" , Port : 666 },
749+ })),
750+ asYaml (remoteHeadlessEndpointsUpdate ("service-one" , "ns2" , "997" , "192.0.0.2" , []corev1.EndpointPort {
751+ {Name : "port1" , Protocol : "TCP" , Port : 555 },
752+ {Name : "port2" , Protocol : "TCP" , Port : 666 },
753+ })),
754+ },
755+ localResources : []string {
756+ asYaml (namespace ("ns1" )),
757+ asYaml (namespace ("ns2" )),
758+ asYaml (headlessMirrorService ("service-one-remote" , "ns1" , "111" , nil , []corev1.ServicePort {
759+ {Name : "port1" , Protocol : "TCP" , Port : 555 },
760+ {Name : "port2" , Protocol : "TCP" , Port : 666 },
761+ })),
762+ asYaml (endpointMirrorService ("pod-0" , "service-one-remote" , "ns1" , "333" , nil , []corev1.ServicePort {
763+ {Name : "port1" , Protocol : "TCP" , Port : 555 },
764+ {Name : "port2" , Protocol : "TCP" , Port : 666 },
765+ })),
766+ asYaml (headlessMirrorEndpoints (
767+ "service-one-remote" ,
768+ "ns1" ,
769+ nil ,
770+ "gateway-identity" ,
771+ []corev1.EndpointPort {
772+ {Name : "port1" , Protocol : "TCP" , Port : 555 },
773+ {Name : "port2" , Protocol : "TCP" , Port : 666 },
774+ },
775+ )),
776+ asYaml (endpointMirrorEndpoints (
777+ "service-one-remote" ,
778+ "ns1" ,
779+ nil ,
780+ "pod-0" ,
781+ "192.0.2.127" ,
782+ "gateway-identity" ,
783+ []corev1.EndpointPort {
784+ {Name : "port1" , Protocol : "TCP" , Port : 888 },
785+ {Name : "port2" , Protocol : "TCP" , Port : 888 },
786+ },
787+ )),
788+ asYaml (headlessMirrorService ("service-one-remote" , "ns2" , "222" , nil , []corev1.ServicePort {
789+ {Name : "port1" , Protocol : "TCP" , Port : 555 },
790+ {Name : "port2" , Protocol : "TCP" , Port : 666 },
791+ })),
792+ asYaml (endpointMirrorService ("pod-0" , "service-one-remote" , "ns2" , "444" , nil , []corev1.ServicePort {
793+ {Name : "port1" , Protocol : "TCP" , Port : 555 },
794+ {Name : "port2" , Protocol : "TCP" , Port : 666 },
795+ })),
796+ asYaml (endpointMirrorService ("pod-1" , "service-one-remote" , "ns2" , "555" , nil , []corev1.ServicePort {
797+ {Name : "port1" , Protocol : "TCP" , Port : 555 },
798+ {Name : "port2" , Protocol : "TCP" , Port : 666 },
799+ })),
800+ asYaml (headlessMirrorEndpointsUpdated (
801+ "service-one-remote" ,
802+ "ns2" ,
803+ []string {"pod-0" , "pod-1" },
804+ []string {"" , "" },
805+ "gateway-identity" ,
806+ []corev1.EndpointPort {
807+ {Name : "port1" , Protocol : "TCP" , Port : 555 },
808+ {Name : "port2" , Protocol : "TCP" , Port : 666 },
809+ },
810+ )),
811+ asYaml (endpointMirrorEndpoints (
812+ "service-one-remote" ,
813+ "ns2" ,
814+ nil ,
815+ "pod-0" ,
816+ "192.0.2.127" ,
817+ "gateway-identity" ,
818+ []corev1.EndpointPort {
819+ {Name : "port1" , Protocol : "TCP" , Port : 888 },
820+ {Name : "port2" , Protocol : "TCP" , Port : 888 },
821+ },
822+ )),
823+ asYaml (endpointMirrorEndpoints (
824+ "service-one-remote" ,
825+ "ns2" ,
826+ nil ,
827+ "pod-1" ,
828+ "192.0.2.127" ,
829+ "gateway-identity" ,
830+ []corev1.EndpointPort {
831+ {Name : "port1" , Protocol : "TCP" , Port : 888 },
832+ {Name : "port2" , Protocol : "TCP" , Port : 888 },
833+ },
834+ )),
835+ },
836+ link : v1alpha3.Link {
837+ Spec : v1alpha3.LinkSpec {
838+ TargetClusterName : clusterName ,
839+ TargetClusterDomain : clusterDomain ,
840+ GatewayIdentity : "gateway-identity" ,
841+ GatewayAddress : "192.0.2.127" ,
842+ GatewayPort : "888" ,
843+ ProbeSpec : defaultProbeSpec ,
844+ Selector : defaultSelector ,
845+ RemoteDiscoverySelector : defaultRemoteDiscoverySelector ,
846+ },
847+ },
848+ }
849+
720850var clusterUnregistered = & testEnvironment {
721851 events : []interface {}{
722852 & ClusterUnregistered {},
0 commit comments