@@ -363,6 +363,21 @@ func TestBuildGraph(t *testing.T) {
363
363
},
364
364
}
365
365
366
+ gatewaySecret := & v1.Secret {
367
+ TypeMeta : metav1.TypeMeta {
368
+ Kind : "Secret" ,
369
+ },
370
+ ObjectMeta : metav1.ObjectMeta {
371
+ Namespace : testNs ,
372
+ Name : "gateway-secret" ,
373
+ },
374
+ Data : map [string ][]byte {
375
+ v1 .TLSCertKey : cert ,
376
+ v1 .TLSPrivateKeyKey : key ,
377
+ },
378
+ Type : v1 .SecretTypeTLS ,
379
+ }
380
+
366
381
ns := & v1.Namespace {
367
382
ObjectMeta : metav1.ObjectMeta {
368
383
Name : testNs ,
@@ -442,6 +457,13 @@ func TestBuildGraph(t *testing.T) {
442
457
TLS : & gatewayv1.GatewayTLSConfig {Mode : helpers .GetPointer (gatewayv1 .TLSModePassthrough )},
443
458
},
444
459
},
460
+ BackendTLS : & gatewayv1.GatewayBackendTLS {
461
+ ClientCertificateRef : & gatewayv1.SecretObjectReference {
462
+ Kind : helpers.GetPointer [gatewayv1.Kind ]("Secret" ),
463
+ Name : gatewayv1 .ObjectName (gatewaySecret .Name ),
464
+ Namespace : helpers .GetPointer (gatewayv1 .Namespace (gatewaySecret .Namespace )),
465
+ },
466
+ },
445
467
},
446
468
},
447
469
}
@@ -712,8 +734,9 @@ func TestBuildGraph(t *testing.T) {
712
734
client .ObjectKeyFromObject (grToServiceNsRefGrant ): grToServiceNsRefGrant ,
713
735
},
714
736
Secrets : map [types.NamespacedName ]* v1.Secret {
715
- client .ObjectKeyFromObject (secret ): secret ,
716
- client .ObjectKeyFromObject (plusSecret ): plusSecret ,
737
+ client .ObjectKeyFromObject (secret ): secret ,
738
+ client .ObjectKeyFromObject (plusSecret ): plusSecret ,
739
+ client .ObjectKeyFromObject (gatewaySecret ): gatewaySecret ,
717
740
},
718
741
BackendTLSPolicies : map [types.NamespacedName ]* v1alpha3.BackendTLSPolicy {
719
742
client .ObjectKeyFromObject (btp .Source ): btp .Source ,
@@ -1093,6 +1116,7 @@ func TestBuildGraph(t *testing.T) {
1093
1116
Namespace : "test" ,
1094
1117
Name : "gateway-1-my-class" ,
1095
1118
},
1119
+ SecretRef : helpers .GetPointer (client .ObjectKeyFromObject (gatewaySecret )),
1096
1120
},
1097
1121
{Namespace : testNs , Name : "gateway-2" }: {
1098
1122
Source : gw2 .Source ,
@@ -1169,6 +1193,7 @@ func TestBuildGraph(t *testing.T) {
1169
1193
Namespace : "test" ,
1170
1194
Name : "gateway-2-my-class" ,
1171
1195
},
1196
+ SecretRef : helpers .GetPointer (client .ObjectKeyFromObject (gatewaySecret )),
1172
1197
},
1173
1198
},
1174
1199
Routes : map [RouteKey ]* L7Route {
@@ -1188,6 +1213,13 @@ func TestBuildGraph(t *testing.T) {
1188
1213
TLSPrivateKey : key ,
1189
1214
}),
1190
1215
},
1216
+ client .ObjectKeyFromObject (gatewaySecret ): {
1217
+ Source : gatewaySecret ,
1218
+ CertBundle : NewCertificateBundle (client .ObjectKeyFromObject (gatewaySecret ), "Secret" , & Certificate {
1219
+ TLSCert : cert ,
1220
+ TLSPrivateKey : key ,
1221
+ }),
1222
+ },
1191
1223
},
1192
1224
ReferencedNamespaces : map [types.NamespacedName ]* v1.Namespace {
1193
1225
client .ObjectKeyFromObject (ns ): ns ,
@@ -1277,14 +1309,13 @@ func TestBuildGraph(t *testing.T) {
1277
1309
{
1278
1310
store : createStateWithGatewayClass (normalGC ),
1279
1311
expected : createExpectedGraphWithGatewayClass (normalGC ),
1280
- experimentalEnabled : false ,
1312
+ experimentalEnabled : true ,
1281
1313
name : "normal case" ,
1282
1314
},
1283
1315
{
1284
- store : createStateWithGatewayClass (differentControllerGC ),
1285
- expected : & Graph {},
1286
- experimentalEnabled : true ,
1287
- name : "gatewayclass belongs to a different controller" ,
1316
+ store : createStateWithGatewayClass (differentControllerGC ),
1317
+ expected : & Graph {},
1318
+ name : "gatewayclass belongs to a different controller" ,
1288
1319
},
1289
1320
}
1290
1321
0 commit comments