@@ -68,7 +68,7 @@ func Test_buildTargetGroupSpec(t *testing.T) {
6868 },
6969 },
7070 expectedTgSpec : elbv2model.TargetGroupSpec {
71- Name : "k8s-myrouten-myroute-d02da2803b " ,
71+ Name : "k8s-myrouten-myroute-8d8111f6ac " ,
7272 TargetType : elbv2model .TargetTypeInstance ,
7373 Port : awssdk .Int32 (8080 ),
7474 Protocol : elbv2model .ProtocolTCP ,
@@ -123,7 +123,7 @@ func Test_buildTargetGroupSpec(t *testing.T) {
123123 },
124124 },
125125 expectedTgSpec : elbv2model.TargetGroupSpec {
126- Name : "k8s-myrouten-myroute-d146029dfb " ,
126+ Name : "k8s-myrouten-myroute-224f4b6ea6 " ,
127127 TargetType : elbv2model .TargetTypeInstance ,
128128 Port : awssdk .Int32 (8080 ),
129129 Protocol : elbv2model .ProtocolHTTP ,
@@ -183,7 +183,7 @@ func Test_buildTargetGroupSpec(t *testing.T) {
183183 },
184184 },
185185 expectedTgSpec : elbv2model.TargetGroupSpec {
186- Name : "k8s-myrouten-myroute-d9d6c4e6eb " ,
186+ Name : "k8s-myrouten-myroute-3bce8b0f70 " ,
187187 TargetType : elbv2model .TargetTypeIP ,
188188 Port : awssdk .Int32 (80 ),
189189 Protocol : elbv2model .ProtocolTCP ,
@@ -238,7 +238,7 @@ func Test_buildTargetGroupSpec(t *testing.T) {
238238 },
239239 },
240240 expectedTgSpec : elbv2model.TargetGroupSpec {
241- Name : "k8s-myrouten-myroute-400113e816 " ,
241+ Name : "k8s-myrouten-myroute-a44a20bcbf " ,
242242 TargetType : elbv2model .TargetTypeIP ,
243243 Port : awssdk .Int32 (80 ),
244244 Protocol : elbv2model .ProtocolHTTP ,
@@ -448,7 +448,7 @@ func Test_buildTargetGroupBindingSpec(t *testing.T) {
448448 },
449449 },
450450 expectedTgSpec : elbv2model.TargetGroupSpec {
451- Name : "k8s-myrouten-myroute-d146029dfb " ,
451+ Name : "k8s-myrouten-myroute-224f4b6ea6 " ,
452452 TargetType : elbv2model .TargetTypeInstance ,
453453 Port : awssdk .Int32 (8080 ),
454454 Protocol : elbv2model .ProtocolHTTP ,
@@ -476,7 +476,7 @@ func Test_buildTargetGroupBindingSpec(t *testing.T) {
476476 Template : elbv2model.TargetGroupBindingTemplate {
477477 ObjectMeta : metav1.ObjectMeta {
478478 Namespace : "my-svc-ns" ,
479- Name : "k8s-myrouten-myroute-d146029dfb " ,
479+ Name : "k8s-myrouten-myroute-224f4b6ea6 " ,
480480 Annotations : make (map [string ]string ),
481481 Labels : make (map [string ]string ),
482482 },
@@ -527,7 +527,7 @@ func Test_buildTargetGroupBindingSpec(t *testing.T) {
527527 },
528528 },
529529 expectedTgSpec : elbv2model.TargetGroupSpec {
530- Name : "k8s-myrouten-myroute-d9d6c4e6eb " ,
530+ Name : "k8s-myrouten-myroute-3bce8b0f70 " ,
531531 TargetType : elbv2model .TargetTypeIP ,
532532 Port : awssdk .Int32 (80 ),
533533 Protocol : elbv2model .ProtocolTCP ,
@@ -550,7 +550,7 @@ func Test_buildTargetGroupBindingSpec(t *testing.T) {
550550 Template : elbv2model.TargetGroupBindingTemplate {
551551 ObjectMeta : metav1.ObjectMeta {
552552 Namespace : "my-svc-ns" ,
553- Name : "k8s-myrouten-myroute-d9d6c4e6eb " ,
553+ Name : "k8s-myrouten-myroute-3bce8b0f70 " ,
554554 Annotations : make (map [string ]string ),
555555 Labels : make (map [string ]string ),
556556 },
@@ -601,7 +601,7 @@ func Test_buildTargetGroupBindingSpec(t *testing.T) {
601601 },
602602 },
603603 expectedTgSpec : elbv2model.TargetGroupSpec {
604- Name : "k8s-myrouten-myroute-400113e816 " ,
604+ Name : "k8s-myrouten-myroute-a44a20bcbf " ,
605605 TargetType : elbv2model .TargetTypeIP ,
606606 Port : awssdk .Int32 (80 ),
607607 Protocol : elbv2model .ProtocolHTTP ,
@@ -629,7 +629,7 @@ func Test_buildTargetGroupBindingSpec(t *testing.T) {
629629 Template : elbv2model.TargetGroupBindingTemplate {
630630 ObjectMeta : metav1.ObjectMeta {
631631 Namespace : "my-svc-ns" ,
632- Name : "k8s-myrouten-myroute-400113e816 " ,
632+ Name : "k8s-myrouten-myroute-a44a20bcbf " ,
633633 Annotations : make (map [string ]string ),
634634 Labels : make (map [string ]string ),
635635 },
@@ -690,7 +690,7 @@ func Test_buildTargetGroupBindingSpec(t *testing.T) {
690690 },
691691 },
692692 expectedTgSpec : elbv2model.TargetGroupSpec {
693- Name : "k8s-myrouten-myroute-400113e816 " ,
693+ Name : "k8s-myrouten-myroute-a44a20bcbf " ,
694694 TargetType : elbv2model .TargetTypeIP ,
695695 Port : awssdk .Int32 (80 ),
696696 Protocol : elbv2model .ProtocolHTTP ,
@@ -718,7 +718,7 @@ func Test_buildTargetGroupBindingSpec(t *testing.T) {
718718 Template : elbv2model.TargetGroupBindingTemplate {
719719 ObjectMeta : metav1.ObjectMeta {
720720 Namespace : "my-svc-ns" ,
721- Name : "k8s-myrouten-myroute-400113e816 " ,
721+ Name : "k8s-myrouten-myroute-a44a20bcbf " ,
722722 Annotations : map [string ]string {
723723 "foo" : "bar" ,
724724 },
@@ -771,7 +771,7 @@ func Test_buildTargetGroupBindingNetworking(t *testing.T) {
771771
772772 targetPort intstr.IntOrString
773773 healthCheckPort intstr.IntOrString
774- svcPort corev1. ServicePort
774+ tgProtocol elbv2model. Protocol
775775 backendSGIDToken core.StringToken
776776
777777 expected * elbv2model.TargetGroupBindingNetworking
@@ -804,9 +804,7 @@ func Test_buildTargetGroupBindingNetworking(t *testing.T) {
804804 name : "disable restricted sg rules - with udp" ,
805805 disableRestrictedSGRules : true ,
806806 backendSGIDToken : core .LiteralStringToken ("foo" ),
807- svcPort : corev1.ServicePort {
808- Protocol : corev1 .ProtocolUDP ,
809- },
807+ tgProtocol : elbv2model .ProtocolUDP ,
810808 expected : & elbv2model.TargetGroupBindingNetworking {
811809 Ingress : []elbv2model.NetworkingIngressRule {
812810 {
@@ -834,11 +832,9 @@ func Test_buildTargetGroupBindingNetworking(t *testing.T) {
834832 {
835833 name : "use restricted sg rules - int hc port" ,
836834 backendSGIDToken : core .LiteralStringToken ("foo" ),
837- svcPort : corev1.ServicePort {
838- Protocol : corev1 .ProtocolTCP ,
839- },
840- targetPort : intstr80 ,
841- healthCheckPort : intstr80 ,
835+ tgProtocol : elbv2model .ProtocolTCP ,
836+ targetPort : intstr80 ,
837+ healthCheckPort : intstr80 ,
842838 expected : & elbv2model.TargetGroupBindingNetworking {
843839 Ingress : []elbv2model.NetworkingIngressRule {
844840 {
@@ -862,11 +858,9 @@ func Test_buildTargetGroupBindingNetworking(t *testing.T) {
862858 {
863859 name : "use restricted sg rules - int hc port - udp traffic" ,
864860 backendSGIDToken : core .LiteralStringToken ("foo" ),
865- svcPort : corev1.ServicePort {
866- Protocol : corev1 .ProtocolUDP ,
867- },
868- targetPort : intstr80 ,
869- healthCheckPort : intstr80 ,
861+ tgProtocol : elbv2model .ProtocolUDP ,
862+ targetPort : intstr80 ,
863+ healthCheckPort : intstr80 ,
870864 expected : & elbv2model.TargetGroupBindingNetworking {
871865 Ingress : []elbv2model.NetworkingIngressRule {
872866 {
@@ -905,11 +899,9 @@ func Test_buildTargetGroupBindingNetworking(t *testing.T) {
905899 {
906900 name : "use restricted sg rules - str hc port" ,
907901 backendSGIDToken : core .LiteralStringToken ("foo" ),
908- svcPort : corev1.ServicePort {
909- Protocol : corev1 .ProtocolTCP ,
910- },
911- targetPort : intstr80 ,
912- healthCheckPort : intstrTrafficPort ,
902+ tgProtocol : elbv2model .ProtocolHTTP ,
903+ targetPort : intstr80 ,
904+ healthCheckPort : intstrTrafficPort ,
913905 expected : & elbv2model.TargetGroupBindingNetworking {
914906 Ingress : []elbv2model.NetworkingIngressRule {
915907 {
@@ -933,11 +925,9 @@ func Test_buildTargetGroupBindingNetworking(t *testing.T) {
933925 {
934926 name : "use restricted sg rules - str hc port - udp" ,
935927 backendSGIDToken : core .LiteralStringToken ("foo" ),
936- svcPort : corev1.ServicePort {
937- Protocol : corev1 .ProtocolUDP ,
938- },
939- targetPort : intstr80 ,
940- healthCheckPort : intstrTrafficPort ,
928+ tgProtocol : elbv2model .ProtocolUDP ,
929+ targetPort : intstr80 ,
930+ healthCheckPort : intstrTrafficPort ,
941931 expected : & elbv2model.TargetGroupBindingNetworking {
942932 Ingress : []elbv2model.NetworkingIngressRule {
943933 {
@@ -976,11 +966,9 @@ func Test_buildTargetGroupBindingNetworking(t *testing.T) {
976966 {
977967 name : "use restricted sg rules - diff hc port" ,
978968 backendSGIDToken : core .LiteralStringToken ("foo" ),
979- svcPort : corev1.ServicePort {
980- Protocol : corev1 .ProtocolTCP ,
981- },
982- targetPort : intstr80 ,
983- healthCheckPort : intstr85 ,
969+ tgProtocol : elbv2model .ProtocolHTTP ,
970+ targetPort : intstr80 ,
971+ healthCheckPort : intstr85 ,
984972 expected : & elbv2model.TargetGroupBindingNetworking {
985973 Ingress : []elbv2model.NetworkingIngressRule {
986974 {
@@ -1019,11 +1007,9 @@ func Test_buildTargetGroupBindingNetworking(t *testing.T) {
10191007 {
10201008 name : "use restricted sg rules - str hc port - udp" ,
10211009 backendSGIDToken : core .LiteralStringToken ("foo" ),
1022- svcPort : corev1.ServicePort {
1023- Protocol : corev1 .ProtocolUDP ,
1024- },
1025- targetPort : intstr80 ,
1026- healthCheckPort : intstr85 ,
1010+ tgProtocol : elbv2model .ProtocolUDP ,
1011+ targetPort : intstr80 ,
1012+ healthCheckPort : intstr85 ,
10271013 expected : & elbv2model.TargetGroupBindingNetworking {
10281014 Ingress : []elbv2model.NetworkingIngressRule {
10291015 {
@@ -1066,7 +1052,7 @@ func Test_buildTargetGroupBindingNetworking(t *testing.T) {
10661052 disableRestrictedSGRules : tc .disableRestrictedSGRules ,
10671053 }
10681054
1069- result := builder .buildTargetGroupBindingNetworking (tc .targetPort , tc .healthCheckPort , tc .svcPort , tc .backendSGIDToken )
1055+ result := builder .buildTargetGroupBindingNetworking (tc .targetPort , tc .healthCheckPort , tc .tgProtocol , tc .backendSGIDToken )
10701056 assert .Equal (t , tc .expected , result )
10711057 })
10721058 }
@@ -1101,16 +1087,16 @@ func Test_buildTargetGroupName(t *testing.T) {
11011087 {
11021088 name : "no name in props" ,
11031089 targetGroupProps : & elbv2gw.TargetGroupProps {},
1104- expected : "k8s-myns-myroute-719950e570 " ,
1090+ expected : "k8s-myns-myroute-27d98b9190 " ,
11051091 },
11061092 {
11071093 name : "no props" ,
1108- expected : "k8s-myns-myroute-719950e570 " ,
1094+ expected : "k8s-myns-myroute-27d98b9190 " ,
11091095 },
11101096 {
11111097 name : "protocol specified props" ,
11121098 protocolVersion : & http2 ,
1113- expected : "k8s-myns-myroute-ce262fa9fe " ,
1099+ expected : "k8s-myns-myroute-d2bd5deaa7 " ,
11141100 },
11151101 }
11161102
@@ -1120,7 +1106,7 @@ func Test_buildTargetGroupName(t *testing.T) {
11201106 clusterName : clusterName ,
11211107 }
11221108
1123- result := builder .buildTargetGroupName (tc .targetGroupProps , gwKey , routeKey , svcKey , 80 , elbv2model .TargetTypeIP , elbv2model .ProtocolTCP , tc .protocolVersion )
1109+ result := builder .buildTargetGroupName (tc .targetGroupProps , gwKey , routeKey , routeutils . HTTPRouteKind , svcKey , 80 , elbv2model .TargetTypeIP , elbv2model .ProtocolTCP , tc .protocolVersion )
11241110 assert .Equal (t , tc .expected , result )
11251111 })
11261112 }
0 commit comments