Skip to content

Commit 85c80f2

Browse files
committed
Fix failing e2e test
1 parent dd7d259 commit 85c80f2

File tree

7 files changed

+54
-2
lines changed

7 files changed

+54
-2
lines changed

.python-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
3.9

pkg/deploy/elbv2/target_group_binding_manager.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,7 @@ func buildK8sTargetGroupBindingSpec(ctx context.Context, resTGB *elbv2model.Targ
187187
}
188188
k8sTGBSpec.NodeSelector = resTGB.Spec.Template.Spec.NodeSelector
189189
k8sTGBSpec.IPAddressType = resTGB.Spec.Template.Spec.IPAddressType
190+
k8sTGBSpec.VpcId = resTGB.Spec.Template.Spec.VpcId
190191
return k8sTGBSpec, nil
191192
}
192193

pkg/ingress/model_build_target_group.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ func (t *defaultModelBuildTask) buildTargetGroupBindingSpec(ctx context.Context,
7777
Networking: tgbNetworking,
7878
NodeSelector: nodeSelector,
7979
IPAddressType: (*elbv2api.TargetGroupIPAddressType)(tg.Spec.IPAddressType),
80+
VpcId: t.vpcID,
8081
},
8182
},
8283
}

pkg/ingress/model_builder_test.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ const baseStackJSON = `
308308
"$ref":"#/resources/AWS::ElasticLoadBalancingV2::TargetGroup/ns-1/ing-1-svc-1:http/status/targetGroupARN"
309309
},
310310
"targetType":"instance",
311+
"vpcId": "vpc-dummy",
311312
"ipAddressType":"ipv4",
312313
"serviceRef":{
313314
"name":"svc-1",
@@ -350,6 +351,7 @@ const baseStackJSON = `
350351
},
351352
"targetType":"instance",
352353
"ipAddressType":"ipv4",
354+
"vpcId": "vpc-dummy",
353355
"serviceRef":{
354356
"name":"svc-2",
355357
"port":"http"
@@ -390,6 +392,7 @@ const baseStackJSON = `
390392
"$ref":"#/resources/AWS::ElasticLoadBalancingV2::TargetGroup/ns-1/ing-1-svc-3:https/status/targetGroupARN"
391393
},
392394
"targetType":"ip",
395+
"vpcId": "vpc-dummy",
393396
"ipAddressType":"ipv4",
394397
"serviceRef":{
395398
"name":"svc-3",
@@ -1131,7 +1134,7 @@ func Test_defaultModelBuilder_Build(t *testing.T) {
11311134
"port": 443,
11321135
"protocol": "HTTPS",
11331136
"sslPolicy": "ELBSecurityPolicy-2016-08",
1134-
"mutualAuthentication" : {
1137+
"mutualAuthentication" : {
11351138
"mode" : "off"
11361139
}
11371140
}
@@ -1442,6 +1445,7 @@ func Test_defaultModelBuilder_Build(t *testing.T) {
14421445
},
14431446
"spec": {
14441447
"ipAddressType": "ipv4",
1448+
"vpcId": "vpc-dummy",
14451449
"networking": {
14461450
"ingress": [
14471451
{
@@ -2429,6 +2433,7 @@ func Test_defaultModelBuilder_Build(t *testing.T) {
24292433
},
24302434
"spec": {
24312435
"ipAddressType": "ipv6",
2436+
"vpcId": "vpc-dummy",
24322437
"networking": {
24332438
"ingress": [
24342439
{
@@ -2695,6 +2700,7 @@ func Test_defaultModelBuilder_Build(t *testing.T) {
26952700
},
26962701
"spec": {
26972702
"ipAddressType": "ipv4",
2703+
"vpcId": "vpc-dummy",
26982704
"networking": {
26992705
"ingress": [
27002706
{
@@ -2854,6 +2860,7 @@ func Test_defaultModelBuilder_Build(t *testing.T) {
28542860
},
28552861
"spec": {
28562862
"ipAddressType": "ipv4",
2863+
"vpcId": "vpc-dummy",
28572864
"networking": {
28582865
"ingress": [
28592866
{

pkg/model/elbv2/target_group_binding.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ type TargetGroupBindingSpec struct {
103103
// ipAddressType specifies whether the target group is of type IPv4 or IPv6. If unspecified, it will be automatically inferred.
104104
// +optional
105105
IPAddressType *elbv2api.TargetGroupIPAddressType `json:"ipAddressType,omitempty"`
106+
107+
// VpcId is the VPC of the TargetGroup. If unspecified, it will be automatically inferred.
108+
// +optional
109+
VpcId string `json:"vpcId,omitempty"`
106110
}
107111

108112
// Template for TargetGroupBinding Custom Resource.

pkg/service/model_build_target_group.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,7 @@ func (t *defaultModelBuildTask) buildTargetGroupBindingSpec(ctx context.Context,
444444
Networking: tgbNetworking,
445445
NodeSelector: nodeSelector,
446446
IPAddressType: (*elbv2api.TargetGroupIPAddressType)(targetGroup.Spec.IPAddressType),
447+
VpcId: t.vpcID,
447448
},
448449
},
449450
}, nil

pkg/service/model_builder_test.go

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
233233
},
234234
"targetType":"ip",
235235
"ipAddressType":"ipv4",
236+
"vpcId": "vpc-xxx",
236237
"serviceRef":{
237238
"name":"nlb-ip-svc-tls",
238239
"port":80
@@ -380,6 +381,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
380381
},
381382
"targetType":"ip",
382383
"ipAddressType":"ipv4",
384+
"vpcId": "vpc-xxx",
383385
"serviceRef":{
384386
"name":"nlb-ip-svc-tls",
385387
"port":80
@@ -598,6 +600,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
598600
},
599601
"targetType":"ip",
600602
"ipAddressType":"ipv4",
603+
"vpcId": "vpc-xxx",
601604
"serviceRef":{
602605
"name":"nlb-ip-svc",
603606
"port":80
@@ -664,6 +667,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
664667
},
665668
"targetType":"ip",
666669
"ipAddressType":"ipv4",
670+
"vpcId": "vpc-xxx",
667671
"serviceRef":{
668672
"name":"nlb-ip-svc",
669673
"port":83
@@ -942,6 +946,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
942946
"$ref":"#/resources/AWS::ElasticLoadBalancingV2::TargetGroup/default/nlb-ip-svc-tls:80/status/targetGroupARN"
943947
},
944948
"targetType":"ip",
949+
"vpcId": "vpc-xxx",
945950
"ipAddressType":"ipv4",
946951
"serviceRef":{
947952
"name":"nlb-ip-svc-tls",
@@ -994,6 +999,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
994999
},
9951000
"targetType":"ip",
9961001
"ipAddressType":"ipv4",
1002+
"vpcId": "vpc-xxx",
9971003
"serviceRef":{
9981004
"name":"nlb-ip-svc-tls",
9991005
"port":83
@@ -1276,6 +1282,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
12761282
},
12771283
"targetType":"instance",
12781284
"ipAddressType":"ipv4",
1285+
"vpcId": "vpc-xxx",
12791286
"serviceRef":{
12801287
"name":"instance-mode",
12811288
"port":80
@@ -1317,6 +1324,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
13171324
},
13181325
"targetType":"instance",
13191326
"ipAddressType":"ipv4",
1327+
"vpcId": "vpc-xxx",
13201328
"serviceRef":{
13211329
"name":"instance-mode",
13221330
"port":83
@@ -1554,6 +1562,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
15541562
"$ref":"#/resources/AWS::ElasticLoadBalancingV2::TargetGroup/app/traffic-local:80/status/targetGroupARN"
15551563
},
15561564
"targetType":"instance",
1565+
"vpcId": "vpc-xxx",
15571566
"ipAddressType":"ipv4",
15581567
"serviceRef":{
15591568
"name":"traffic-local",
@@ -1626,6 +1635,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
16261635
},
16271636
"targetType":"instance",
16281637
"ipAddressType":"ipv4",
1638+
"vpcId": "vpc-xxx",
16291639
"serviceRef":{
16301640
"name":"traffic-local",
16311641
"port":83
@@ -1815,6 +1825,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
18151825
},
18161826
"targetType":"ip",
18171827
"ipAddressType":"ipv4",
1828+
"vpcId": "vpc-xxx",
18181829
"serviceRef":{
18191830
"name":"nlb-ip-svc-tls",
18201831
"port":80
@@ -1935,6 +1946,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
19351946
"spec": {
19361947
"targetType": "ip",
19371948
"ipAddressType":"ipv4",
1949+
"vpcId": "vpc-xxx",
19381950
"targetGroupARN": {
19391951
"$ref": "#/resources/AWS::ElasticLoadBalancingV2::TargetGroup/default/ip-target:80/status/targetGroupARN"
19401952
},
@@ -2108,6 +2120,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
21082120
"spec": {
21092121
"targetType": "ip",
21102122
"ipAddressType":"ipv4",
2123+
"vpcId": "vpc-xxx",
21112124
"targetGroupARN": {
21122125
"$ref": "#/resources/AWS::ElasticLoadBalancingV2::TargetGroup/default/default-ip-target:80/status/targetGroupARN"
21132126
},
@@ -2473,6 +2486,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
24732486
"$ref": "#/resources/AWS::ElasticLoadBalancingV2::TargetGroup/default/traffic-local:80/status/targetGroupARN"
24742487
},
24752488
"targetType": "instance",
2489+
"vpcId": "vpc-xxx",
24762490
"serviceRef": {
24772491
"name": "traffic-local",
24782492
"port": 80
@@ -2622,6 +2636,8 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
26222636
"$ref": "#/resources/AWS::ElasticLoadBalancingV2::TargetGroup/default/traffic-local:80/status/targetGroupARN"
26232637
},
26242638
"targetType": "instance",
2639+
"vpcId": "vpc-xxx",
2640+
"vpcId": "vpc-xxx",
26252641
"serviceRef": {
26262642
"name": "traffic-local",
26272643
"port": 80
@@ -2824,6 +2840,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
28242840
"$ref": "#/resources/AWS::ElasticLoadBalancingV2::TargetGroup/awesome/lb-with-class:80/status/targetGroupARN"
28252841
},
28262842
"targetType": "instance",
2843+
"vpcId": "vpc-xxx",
28272844
"serviceRef": {
28282845
"name": "lb-with-class",
28292846
"port": 80
@@ -2992,6 +3009,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
29923009
},
29933010
"targetType":"ip",
29943011
"ipAddressType":"ipv4",
3012+
"vpcId": "vpc-xxx",
29953013
"serviceRef":{
29963014
"name":"manual-sg-rule",
29973015
"port":80
@@ -3145,6 +3163,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
31453163
},
31463164
"targetType":"ip",
31473165
"ipAddressType":"ipv4",
3166+
"vpcId": "vpc-xxx",
31483167
"serviceRef":{
31493168
"name":"nlb-ip-svc-tls",
31503169
"port":80
@@ -3326,6 +3345,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
33263345
"$ref":"#/resources/AWS::ElasticLoadBalancingV2::TargetGroup/default/nlb-ip-svc-tls:80/status/targetGroupARN"
33273346
},
33283347
"targetType":"ip",
3348+
"vpcId": "vpc-xxx",
33293349
"ipAddressType":"ipv4",
33303350
"serviceRef":{
33313351
"name":"nlb-ip-svc-tls",
@@ -3580,6 +3600,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
35803600
},
35813601
"targetType":"ip",
35823602
"ipAddressType":"ipv4",
3603+
"vpcId": "vpc-xxx",
35833604
"serviceRef":{
35843605
"name":"nlb-ip-svc",
35853606
"port":80
@@ -3624,6 +3645,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
36243645
"$ref":"#/resources/AWS::ElasticLoadBalancingV2::TargetGroup/default/nlb-ip-svc:83/status/targetGroupARN"
36253646
},
36263647
"targetType":"ip",
3648+
"vpcId": "vpc-xxx",
36273649
"ipAddressType":"ipv4",
36283650
"serviceRef":{
36293651
"name":"nlb-ip-svc",
@@ -3917,6 +3939,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
39173939
"$ref":"#/resources/AWS::ElasticLoadBalancingV2::TargetGroup/default/nlb-ip-svc-tls:80/status/targetGroupARN"
39183940
},
39193941
"targetType":"ip",
3942+
"vpcId": "vpc-xxx",
39203943
"ipAddressType":"ipv4",
39213944
"serviceRef":{
39223945
"name":"nlb-ip-svc-tls",
@@ -3958,6 +3981,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
39583981
"$ref":"#/resources/AWS::ElasticLoadBalancingV2::TargetGroup/default/nlb-ip-svc-tls:83/status/targetGroupARN"
39593982
},
39603983
"targetType":"ip",
3984+
"vpcId": "vpc-xxx",
39613985
"ipAddressType":"ipv4",
39623986
"serviceRef":{
39633987
"name":"nlb-ip-svc-tls",
@@ -4220,6 +4244,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
42204244
},
42214245
"targetType":"instance",
42224246
"ipAddressType":"ipv4",
4247+
"vpcId": "vpc-xxx",
42234248
"serviceRef":{
42244249
"name":"instance-mode",
42254250
"port":80
@@ -4262,6 +4287,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
42624287
},
42634288
"targetType":"instance",
42644289
"ipAddressType":"ipv4",
4290+
"vpcId": "vpc-xxx",
42654291
"serviceRef":{
42664292
"name":"instance-mode",
42674293
"port":83
@@ -4557,6 +4583,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
45574583
"$ref":"#/resources/AWS::ElasticLoadBalancingV2::TargetGroup/app/traffic-local:80/status/targetGroupARN"
45584584
},
45594585
"targetType":"instance",
4586+
"vpcId": "vpc-xxx",
45604587
"ipAddressType":"ipv4",
45614588
"serviceRef":{
45624589
"name":"traffic-local",
@@ -4605,6 +4632,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
46054632
},
46064633
"targetType":"instance",
46074634
"ipAddressType":"ipv4",
4635+
"vpcId": "vpc-xxx",
46084636
"serviceRef":{
46094637
"name":"traffic-local",
46104638
"port":83
@@ -4906,6 +4934,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
49064934
},
49074935
"targetType":"instance",
49084936
"ipAddressType":"ipv4",
4937+
"vpcId": "vpc-xxx",
49094938
"serviceRef":{
49104939
"name":"traffic-local",
49114940
"port":80
@@ -4953,6 +4982,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
49534982
},
49544983
"targetType":"instance",
49554984
"ipAddressType":"ipv4",
4985+
"vpcId": "vpc-xxx",
49564986
"serviceRef":{
49574987
"name":"traffic-local",
49584988
"port":83
@@ -5135,6 +5165,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
51355165
"$ref":"#/resources/AWS::ElasticLoadBalancingV2::TargetGroup/default/nlb-ip-svc-tls:80/status/targetGroupARN"
51365166
},
51375167
"targetType":"ip",
5168+
"vpcId": "vpc-xxx",
51385169
"ipAddressType":"ipv4",
51395170
"serviceRef":{
51405171
"name":"nlb-ip-svc-tls",
@@ -5275,6 +5306,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
52755306
"spec": {
52765307
"targetType": "ip",
52775308
"ipAddressType":"ipv4",
5309+
"vpcId": "vpc-xxx",
52785310
"targetGroupARN": {
52795311
"$ref": "#/resources/AWS::ElasticLoadBalancingV2::TargetGroup/default/ip-target:80/status/targetGroupARN"
52805312
},
@@ -5526,6 +5558,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
55265558
"$ref": "#/resources/AWS::ElasticLoadBalancingV2::TargetGroup/default/traffic-local:80/status/targetGroupARN"
55275559
},
55285560
"targetType": "instance",
5561+
"vpcId": "vpc-xxx",
55295562
"serviceRef": {
55305563
"name": "traffic-local",
55315564
"port": 80
@@ -5709,6 +5742,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
57095742
"$ref": "#/resources/AWS::ElasticLoadBalancingV2::TargetGroup/default/traffic-local:80/status/targetGroupARN"
57105743
},
57115744
"targetType": "instance",
5745+
"vpcId": "vpc-xxx",
57125746
"serviceRef": {
57135747
"name": "traffic-local",
57145748
"port": 80
@@ -5891,6 +5925,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
58915925
"$ref": "#/resources/AWS::ElasticLoadBalancingV2::TargetGroup/awesome/lb-with-class:80/status/targetGroupARN"
58925926
},
58935927
"targetType": "instance",
5928+
"vpcId": "vpc-xxx",
58945929
"serviceRef": {
58955930
"name": "lb-with-class",
58965931
"port": 80
@@ -6085,6 +6120,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
60856120
"$ref": "#/resources/AWS::ElasticLoadBalancingV2::TargetGroup/default/manual-security-groups:80/status/targetGroupARN"
60866121
},
60876122
"targetType": "ip",
6123+
"vpcId": "vpc-xxx",
60886124
"serviceRef": {
60896125
"name": "manual-security-groups",
60906126
"port": 80
@@ -6224,6 +6260,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
62246260
"$ref": "#/resources/AWS::ElasticLoadBalancingV2::TargetGroup/default/manual-security-groups:80/status/targetGroupARN"
62256261
},
62266262
"targetType": "ip",
6263+
"vpcId": "vpc-xxx",
62276264
"serviceRef": {
62286265
"name": "manual-security-groups",
62296266
"port": 80
@@ -6252,7 +6289,7 @@ func Test_defaultModelBuilderTask_Build(t *testing.T) {
62526289
}
62536290
}
62546291
}
6255-
}
6292+
}
62566293
}
62576294
}
62586295
`,

0 commit comments

Comments
 (0)