@@ -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 ,
@@ -413,7 +413,7 @@ func Test_buildTargetGroupBindingSpec(t *testing.T) {
413
413
},
414
414
},
415
415
expectedTgSpec : elbv2model.TargetGroupSpec {
416
- Name : "k8s-myrouten-myroute-d146029dfb " ,
416
+ Name : "k8s-myrouten-myroute-224f4b6ea6 " ,
417
417
TargetType : elbv2model .TargetTypeInstance ,
418
418
Port : awssdk .Int32 (8080 ),
419
419
Protocol : elbv2model .ProtocolHTTP ,
@@ -441,7 +441,7 @@ func Test_buildTargetGroupBindingSpec(t *testing.T) {
441
441
Template : elbv2model.TargetGroupBindingTemplate {
442
442
ObjectMeta : metav1.ObjectMeta {
443
443
Namespace : "my-svc-ns" ,
444
- Name : "k8s-myrouten-myroute-d146029dfb " ,
444
+ Name : "k8s-myrouten-myroute-224f4b6ea6 " ,
445
445
Annotations : make (map [string ]string ),
446
446
Labels : make (map [string ]string ),
447
447
},
@@ -492,7 +492,7 @@ func Test_buildTargetGroupBindingSpec(t *testing.T) {
492
492
},
493
493
},
494
494
expectedTgSpec : elbv2model.TargetGroupSpec {
495
- Name : "k8s-myrouten-myroute-d9d6c4e6eb " ,
495
+ Name : "k8s-myrouten-myroute-3bce8b0f70 " ,
496
496
TargetType : elbv2model .TargetTypeIP ,
497
497
Port : awssdk .Int32 (80 ),
498
498
Protocol : elbv2model .ProtocolTCP ,
@@ -515,7 +515,7 @@ func Test_buildTargetGroupBindingSpec(t *testing.T) {
515
515
Template : elbv2model.TargetGroupBindingTemplate {
516
516
ObjectMeta : metav1.ObjectMeta {
517
517
Namespace : "my-svc-ns" ,
518
- Name : "k8s-myrouten-myroute-d9d6c4e6eb " ,
518
+ Name : "k8s-myrouten-myroute-3bce8b0f70 " ,
519
519
Annotations : make (map [string ]string ),
520
520
Labels : make (map [string ]string ),
521
521
},
@@ -566,7 +566,7 @@ func Test_buildTargetGroupBindingSpec(t *testing.T) {
566
566
},
567
567
},
568
568
expectedTgSpec : elbv2model.TargetGroupSpec {
569
- Name : "k8s-myrouten-myroute-400113e816 " ,
569
+ Name : "k8s-myrouten-myroute-a44a20bcbf " ,
570
570
TargetType : elbv2model .TargetTypeIP ,
571
571
Port : awssdk .Int32 (80 ),
572
572
Protocol : elbv2model .ProtocolHTTP ,
@@ -594,7 +594,7 @@ func Test_buildTargetGroupBindingSpec(t *testing.T) {
594
594
Template : elbv2model.TargetGroupBindingTemplate {
595
595
ObjectMeta : metav1.ObjectMeta {
596
596
Namespace : "my-svc-ns" ,
597
- Name : "k8s-myrouten-myroute-400113e816 " ,
597
+ Name : "k8s-myrouten-myroute-a44a20bcbf " ,
598
598
Annotations : make (map [string ]string ),
599
599
Labels : make (map [string ]string ),
600
600
},
@@ -655,7 +655,7 @@ func Test_buildTargetGroupBindingSpec(t *testing.T) {
655
655
},
656
656
},
657
657
expectedTgSpec : elbv2model.TargetGroupSpec {
658
- Name : "k8s-myrouten-myroute-400113e816 " ,
658
+ Name : "k8s-myrouten-myroute-a44a20bcbf " ,
659
659
TargetType : elbv2model .TargetTypeIP ,
660
660
Port : awssdk .Int32 (80 ),
661
661
Protocol : elbv2model .ProtocolHTTP ,
@@ -683,7 +683,7 @@ func Test_buildTargetGroupBindingSpec(t *testing.T) {
683
683
Template : elbv2model.TargetGroupBindingTemplate {
684
684
ObjectMeta : metav1.ObjectMeta {
685
685
Namespace : "my-svc-ns" ,
686
- Name : "k8s-myrouten-myroute-400113e816 " ,
686
+ Name : "k8s-myrouten-myroute-a44a20bcbf " ,
687
687
Annotations : map [string ]string {
688
688
"foo" : "bar" ,
689
689
},
@@ -736,7 +736,7 @@ func Test_buildTargetGroupBindingNetworking(t *testing.T) {
736
736
737
737
targetPort intstr.IntOrString
738
738
healthCheckPort intstr.IntOrString
739
- svcPort corev1. ServicePort
739
+ tgProtocol elbv2model. Protocol
740
740
backendSGIDToken core.StringToken
741
741
742
742
expected * elbv2model.TargetGroupBindingNetworking
@@ -769,9 +769,7 @@ func Test_buildTargetGroupBindingNetworking(t *testing.T) {
769
769
name : "disable restricted sg rules - with udp" ,
770
770
disableRestrictedSGRules : true ,
771
771
backendSGIDToken : core .LiteralStringToken ("foo" ),
772
- svcPort : corev1.ServicePort {
773
- Protocol : corev1 .ProtocolUDP ,
774
- },
772
+ tgProtocol : elbv2model .ProtocolUDP ,
775
773
expected : & elbv2model.TargetGroupBindingNetworking {
776
774
Ingress : []elbv2model.NetworkingIngressRule {
777
775
{
@@ -799,11 +797,9 @@ func Test_buildTargetGroupBindingNetworking(t *testing.T) {
799
797
{
800
798
name : "use restricted sg rules - int hc port" ,
801
799
backendSGIDToken : core .LiteralStringToken ("foo" ),
802
- svcPort : corev1.ServicePort {
803
- Protocol : corev1 .ProtocolTCP ,
804
- },
805
- targetPort : intstr80 ,
806
- healthCheckPort : intstr80 ,
800
+ tgProtocol : elbv2model .ProtocolTCP ,
801
+ targetPort : intstr80 ,
802
+ healthCheckPort : intstr80 ,
807
803
expected : & elbv2model.TargetGroupBindingNetworking {
808
804
Ingress : []elbv2model.NetworkingIngressRule {
809
805
{
@@ -827,11 +823,9 @@ func Test_buildTargetGroupBindingNetworking(t *testing.T) {
827
823
{
828
824
name : "use restricted sg rules - int hc port - udp traffic" ,
829
825
backendSGIDToken : core .LiteralStringToken ("foo" ),
830
- svcPort : corev1.ServicePort {
831
- Protocol : corev1 .ProtocolUDP ,
832
- },
833
- targetPort : intstr80 ,
834
- healthCheckPort : intstr80 ,
826
+ tgProtocol : elbv2model .ProtocolUDP ,
827
+ targetPort : intstr80 ,
828
+ healthCheckPort : intstr80 ,
835
829
expected : & elbv2model.TargetGroupBindingNetworking {
836
830
Ingress : []elbv2model.NetworkingIngressRule {
837
831
{
@@ -870,11 +864,9 @@ func Test_buildTargetGroupBindingNetworking(t *testing.T) {
870
864
{
871
865
name : "use restricted sg rules - str hc port" ,
872
866
backendSGIDToken : core .LiteralStringToken ("foo" ),
873
- svcPort : corev1.ServicePort {
874
- Protocol : corev1 .ProtocolTCP ,
875
- },
876
- targetPort : intstr80 ,
877
- healthCheckPort : intstrTrafficPort ,
867
+ tgProtocol : elbv2model .ProtocolHTTP ,
868
+ targetPort : intstr80 ,
869
+ healthCheckPort : intstrTrafficPort ,
878
870
expected : & elbv2model.TargetGroupBindingNetworking {
879
871
Ingress : []elbv2model.NetworkingIngressRule {
880
872
{
@@ -898,11 +890,9 @@ func Test_buildTargetGroupBindingNetworking(t *testing.T) {
898
890
{
899
891
name : "use restricted sg rules - str hc port - udp" ,
900
892
backendSGIDToken : core .LiteralStringToken ("foo" ),
901
- svcPort : corev1.ServicePort {
902
- Protocol : corev1 .ProtocolUDP ,
903
- },
904
- targetPort : intstr80 ,
905
- healthCheckPort : intstrTrafficPort ,
893
+ tgProtocol : elbv2model .ProtocolUDP ,
894
+ targetPort : intstr80 ,
895
+ healthCheckPort : intstrTrafficPort ,
906
896
expected : & elbv2model.TargetGroupBindingNetworking {
907
897
Ingress : []elbv2model.NetworkingIngressRule {
908
898
{
@@ -941,11 +931,9 @@ func Test_buildTargetGroupBindingNetworking(t *testing.T) {
941
931
{
942
932
name : "use restricted sg rules - diff hc port" ,
943
933
backendSGIDToken : core .LiteralStringToken ("foo" ),
944
- svcPort : corev1.ServicePort {
945
- Protocol : corev1 .ProtocolTCP ,
946
- },
947
- targetPort : intstr80 ,
948
- healthCheckPort : intstr85 ,
934
+ tgProtocol : elbv2model .ProtocolHTTP ,
935
+ targetPort : intstr80 ,
936
+ healthCheckPort : intstr85 ,
949
937
expected : & elbv2model.TargetGroupBindingNetworking {
950
938
Ingress : []elbv2model.NetworkingIngressRule {
951
939
{
@@ -984,11 +972,9 @@ func Test_buildTargetGroupBindingNetworking(t *testing.T) {
984
972
{
985
973
name : "use restricted sg rules - str hc port - udp" ,
986
974
backendSGIDToken : core .LiteralStringToken ("foo" ),
987
- svcPort : corev1.ServicePort {
988
- Protocol : corev1 .ProtocolUDP ,
989
- },
990
- targetPort : intstr80 ,
991
- healthCheckPort : intstr85 ,
975
+ tgProtocol : elbv2model .ProtocolUDP ,
976
+ targetPort : intstr80 ,
977
+ healthCheckPort : intstr85 ,
992
978
expected : & elbv2model.TargetGroupBindingNetworking {
993
979
Ingress : []elbv2model.NetworkingIngressRule {
994
980
{
@@ -1031,7 +1017,7 @@ func Test_buildTargetGroupBindingNetworking(t *testing.T) {
1031
1017
disableRestrictedSGRules : tc .disableRestrictedSGRules ,
1032
1018
}
1033
1019
1034
- result := builder .buildTargetGroupBindingNetworking (tc .targetPort , tc .healthCheckPort , tc .svcPort , tc .backendSGIDToken )
1020
+ result := builder .buildTargetGroupBindingNetworking (tc .targetPort , tc .healthCheckPort , tc .tgProtocol , tc .backendSGIDToken )
1035
1021
assert .Equal (t , tc .expected , result )
1036
1022
})
1037
1023
}
@@ -1066,16 +1052,16 @@ func Test_buildTargetGroupName(t *testing.T) {
1066
1052
{
1067
1053
name : "no name in props" ,
1068
1054
targetGroupProps : & elbv2gw.TargetGroupProps {},
1069
- expected : "k8s-myns-myroute-719950e570 " ,
1055
+ expected : "k8s-myns-myroute-27d98b9190 " ,
1070
1056
},
1071
1057
{
1072
1058
name : "no props" ,
1073
- expected : "k8s-myns-myroute-719950e570 " ,
1059
+ expected : "k8s-myns-myroute-27d98b9190 " ,
1074
1060
},
1075
1061
{
1076
1062
name : "protocol specified props" ,
1077
1063
protocolVersion : & http2 ,
1078
- expected : "k8s-myns-myroute-ce262fa9fe " ,
1064
+ expected : "k8s-myns-myroute-d2bd5deaa7 " ,
1079
1065
},
1080
1066
}
1081
1067
@@ -1085,7 +1071,7 @@ func Test_buildTargetGroupName(t *testing.T) {
1085
1071
clusterName : clusterName ,
1086
1072
}
1087
1073
1088
- result := builder .buildTargetGroupName (tc .targetGroupProps , gwKey , routeKey , svcKey , 80 , elbv2model .TargetTypeIP , elbv2model .ProtocolTCP , tc .protocolVersion )
1074
+ result := builder .buildTargetGroupName (tc .targetGroupProps , gwKey , routeKey , routeutils . HTTPRouteKind , svcKey , 80 , elbv2model .TargetTypeIP , elbv2model .ProtocolTCP , tc .protocolVersion )
1089
1075
assert .Equal (t , tc .expected , result )
1090
1076
})
1091
1077
}
0 commit comments