@@ -68,7 +68,7 @@ func Test_buildTargetGroupSpec(t *testing.T) {
68
68
},
69
69
},
70
70
expectedTgSpec : elbv2model.TargetGroupSpec {
71
- Name : "k8s-myrouten-myroute-d02da2803b " ,
71
+ Name : "k8s-myrouten-myroute-8d8111f6ac " ,
72
72
TargetType : elbv2model .TargetTypeInstance ,
73
73
Port : awssdk .Int32 (8080 ),
74
74
Protocol : elbv2model .ProtocolTCP ,
@@ -123,7 +123,7 @@ func Test_buildTargetGroupSpec(t *testing.T) {
123
123
},
124
124
},
125
125
expectedTgSpec : elbv2model.TargetGroupSpec {
126
- Name : "k8s-myrouten-myroute-d146029dfb " ,
126
+ Name : "k8s-myrouten-myroute-224f4b6ea6 " ,
127
127
TargetType : elbv2model .TargetTypeInstance ,
128
128
Port : awssdk .Int32 (8080 ),
129
129
Protocol : elbv2model .ProtocolHTTP ,
@@ -183,7 +183,7 @@ func Test_buildTargetGroupSpec(t *testing.T) {
183
183
},
184
184
},
185
185
expectedTgSpec : elbv2model.TargetGroupSpec {
186
- Name : "k8s-myrouten-myroute-d9d6c4e6eb " ,
186
+ Name : "k8s-myrouten-myroute-3bce8b0f70 " ,
187
187
TargetType : elbv2model .TargetTypeIP ,
188
188
Port : awssdk .Int32 (80 ),
189
189
Protocol : elbv2model .ProtocolTCP ,
@@ -238,7 +238,7 @@ func Test_buildTargetGroupSpec(t *testing.T) {
238
238
},
239
239
},
240
240
expectedTgSpec : elbv2model.TargetGroupSpec {
241
- Name : "k8s-myrouten-myroute-400113e816 " ,
241
+ Name : "k8s-myrouten-myroute-a44a20bcbf " ,
242
242
TargetType : elbv2model .TargetTypeIP ,
243
243
Port : awssdk .Int32 (80 ),
244
244
Protocol : elbv2model .ProtocolHTTP ,
@@ -448,7 +448,7 @@ func Test_buildTargetGroupBindingSpec(t *testing.T) {
448
448
},
449
449
},
450
450
expectedTgSpec : elbv2model.TargetGroupSpec {
451
- Name : "k8s-myrouten-myroute-d146029dfb " ,
451
+ Name : "k8s-myrouten-myroute-224f4b6ea6 " ,
452
452
TargetType : elbv2model .TargetTypeInstance ,
453
453
Port : awssdk .Int32 (8080 ),
454
454
Protocol : elbv2model .ProtocolHTTP ,
@@ -476,7 +476,7 @@ func Test_buildTargetGroupBindingSpec(t *testing.T) {
476
476
Template : elbv2model.TargetGroupBindingTemplate {
477
477
ObjectMeta : metav1.ObjectMeta {
478
478
Namespace : "my-svc-ns" ,
479
- Name : "k8s-myrouten-myroute-d146029dfb " ,
479
+ Name : "k8s-myrouten-myroute-224f4b6ea6 " ,
480
480
Annotations : make (map [string ]string ),
481
481
Labels : make (map [string ]string ),
482
482
},
@@ -527,7 +527,7 @@ func Test_buildTargetGroupBindingSpec(t *testing.T) {
527
527
},
528
528
},
529
529
expectedTgSpec : elbv2model.TargetGroupSpec {
530
- Name : "k8s-myrouten-myroute-d9d6c4e6eb " ,
530
+ Name : "k8s-myrouten-myroute-3bce8b0f70 " ,
531
531
TargetType : elbv2model .TargetTypeIP ,
532
532
Port : awssdk .Int32 (80 ),
533
533
Protocol : elbv2model .ProtocolTCP ,
@@ -550,7 +550,7 @@ func Test_buildTargetGroupBindingSpec(t *testing.T) {
550
550
Template : elbv2model.TargetGroupBindingTemplate {
551
551
ObjectMeta : metav1.ObjectMeta {
552
552
Namespace : "my-svc-ns" ,
553
- Name : "k8s-myrouten-myroute-d9d6c4e6eb " ,
553
+ Name : "k8s-myrouten-myroute-3bce8b0f70 " ,
554
554
Annotations : make (map [string ]string ),
555
555
Labels : make (map [string ]string ),
556
556
},
@@ -601,7 +601,7 @@ func Test_buildTargetGroupBindingSpec(t *testing.T) {
601
601
},
602
602
},
603
603
expectedTgSpec : elbv2model.TargetGroupSpec {
604
- Name : "k8s-myrouten-myroute-400113e816 " ,
604
+ Name : "k8s-myrouten-myroute-a44a20bcbf " ,
605
605
TargetType : elbv2model .TargetTypeIP ,
606
606
Port : awssdk .Int32 (80 ),
607
607
Protocol : elbv2model .ProtocolHTTP ,
@@ -629,7 +629,7 @@ func Test_buildTargetGroupBindingSpec(t *testing.T) {
629
629
Template : elbv2model.TargetGroupBindingTemplate {
630
630
ObjectMeta : metav1.ObjectMeta {
631
631
Namespace : "my-svc-ns" ,
632
- Name : "k8s-myrouten-myroute-400113e816 " ,
632
+ Name : "k8s-myrouten-myroute-a44a20bcbf " ,
633
633
Annotations : make (map [string ]string ),
634
634
Labels : make (map [string ]string ),
635
635
},
@@ -690,7 +690,7 @@ func Test_buildTargetGroupBindingSpec(t *testing.T) {
690
690
},
691
691
},
692
692
expectedTgSpec : elbv2model.TargetGroupSpec {
693
- Name : "k8s-myrouten-myroute-400113e816 " ,
693
+ Name : "k8s-myrouten-myroute-a44a20bcbf " ,
694
694
TargetType : elbv2model .TargetTypeIP ,
695
695
Port : awssdk .Int32 (80 ),
696
696
Protocol : elbv2model .ProtocolHTTP ,
@@ -718,7 +718,7 @@ func Test_buildTargetGroupBindingSpec(t *testing.T) {
718
718
Template : elbv2model.TargetGroupBindingTemplate {
719
719
ObjectMeta : metav1.ObjectMeta {
720
720
Namespace : "my-svc-ns" ,
721
- Name : "k8s-myrouten-myroute-400113e816 " ,
721
+ Name : "k8s-myrouten-myroute-a44a20bcbf " ,
722
722
Annotations : map [string ]string {
723
723
"foo" : "bar" ,
724
724
},
@@ -771,7 +771,7 @@ func Test_buildTargetGroupBindingNetworking(t *testing.T) {
771
771
772
772
targetPort intstr.IntOrString
773
773
healthCheckPort intstr.IntOrString
774
- svcPort corev1. ServicePort
774
+ tgProtocol elbv2model. Protocol
775
775
backendSGIDToken core.StringToken
776
776
777
777
expected * elbv2model.TargetGroupBindingNetworking
@@ -804,9 +804,7 @@ func Test_buildTargetGroupBindingNetworking(t *testing.T) {
804
804
name : "disable restricted sg rules - with udp" ,
805
805
disableRestrictedSGRules : true ,
806
806
backendSGIDToken : core .LiteralStringToken ("foo" ),
807
- svcPort : corev1.ServicePort {
808
- Protocol : corev1 .ProtocolUDP ,
809
- },
807
+ tgProtocol : elbv2model .ProtocolUDP ,
810
808
expected : & elbv2model.TargetGroupBindingNetworking {
811
809
Ingress : []elbv2model.NetworkingIngressRule {
812
810
{
@@ -834,11 +832,9 @@ func Test_buildTargetGroupBindingNetworking(t *testing.T) {
834
832
{
835
833
name : "use restricted sg rules - int hc port" ,
836
834
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 ,
842
838
expected : & elbv2model.TargetGroupBindingNetworking {
843
839
Ingress : []elbv2model.NetworkingIngressRule {
844
840
{
@@ -862,11 +858,9 @@ func Test_buildTargetGroupBindingNetworking(t *testing.T) {
862
858
{
863
859
name : "use restricted sg rules - int hc port - udp traffic" ,
864
860
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 ,
870
864
expected : & elbv2model.TargetGroupBindingNetworking {
871
865
Ingress : []elbv2model.NetworkingIngressRule {
872
866
{
@@ -905,11 +899,9 @@ func Test_buildTargetGroupBindingNetworking(t *testing.T) {
905
899
{
906
900
name : "use restricted sg rules - str hc port" ,
907
901
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 ,
913
905
expected : & elbv2model.TargetGroupBindingNetworking {
914
906
Ingress : []elbv2model.NetworkingIngressRule {
915
907
{
@@ -933,11 +925,9 @@ func Test_buildTargetGroupBindingNetworking(t *testing.T) {
933
925
{
934
926
name : "use restricted sg rules - str hc port - udp" ,
935
927
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 ,
941
931
expected : & elbv2model.TargetGroupBindingNetworking {
942
932
Ingress : []elbv2model.NetworkingIngressRule {
943
933
{
@@ -976,11 +966,9 @@ func Test_buildTargetGroupBindingNetworking(t *testing.T) {
976
966
{
977
967
name : "use restricted sg rules - diff hc port" ,
978
968
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 ,
984
972
expected : & elbv2model.TargetGroupBindingNetworking {
985
973
Ingress : []elbv2model.NetworkingIngressRule {
986
974
{
@@ -1019,11 +1007,9 @@ func Test_buildTargetGroupBindingNetworking(t *testing.T) {
1019
1007
{
1020
1008
name : "use restricted sg rules - str hc port - udp" ,
1021
1009
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 ,
1027
1013
expected : & elbv2model.TargetGroupBindingNetworking {
1028
1014
Ingress : []elbv2model.NetworkingIngressRule {
1029
1015
{
@@ -1066,7 +1052,7 @@ func Test_buildTargetGroupBindingNetworking(t *testing.T) {
1066
1052
disableRestrictedSGRules : tc .disableRestrictedSGRules ,
1067
1053
}
1068
1054
1069
- result := builder .buildTargetGroupBindingNetworking (tc .targetPort , tc .healthCheckPort , tc .svcPort , tc .backendSGIDToken )
1055
+ result := builder .buildTargetGroupBindingNetworking (tc .targetPort , tc .healthCheckPort , tc .tgProtocol , tc .backendSGIDToken )
1070
1056
assert .Equal (t , tc .expected , result )
1071
1057
})
1072
1058
}
@@ -1101,16 +1087,16 @@ func Test_buildTargetGroupName(t *testing.T) {
1101
1087
{
1102
1088
name : "no name in props" ,
1103
1089
targetGroupProps : & elbv2gw.TargetGroupProps {},
1104
- expected : "k8s-myns-myroute-719950e570 " ,
1090
+ expected : "k8s-myns-myroute-27d98b9190 " ,
1105
1091
},
1106
1092
{
1107
1093
name : "no props" ,
1108
- expected : "k8s-myns-myroute-719950e570 " ,
1094
+ expected : "k8s-myns-myroute-27d98b9190 " ,
1109
1095
},
1110
1096
{
1111
1097
name : "protocol specified props" ,
1112
1098
protocolVersion : & http2 ,
1113
- expected : "k8s-myns-myroute-ce262fa9fe " ,
1099
+ expected : "k8s-myns-myroute-d2bd5deaa7 " ,
1114
1100
},
1115
1101
}
1116
1102
@@ -1120,7 +1106,7 @@ func Test_buildTargetGroupName(t *testing.T) {
1120
1106
clusterName : clusterName ,
1121
1107
}
1122
1108
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 )
1124
1110
assert .Equal (t , tc .expected , result )
1125
1111
})
1126
1112
}
0 commit comments