@@ -185,8 +185,8 @@ func TestPodSource(t *testing.T) {
185
185
"" ,
186
186
"" ,
187
187
[]* endpoint.Endpoint {
188
- {DNSName : "a.foo.example.org" , Targets : endpoint.Targets {"2001:DB8::1" , "2001:DB8::2" }, RecordType : endpoint .RecordTypeAAAA },
189
- {DNSName : "internal.a.foo.example.org" , Targets : endpoint.Targets {"2001:DB8::1" , "2001:DB8::2" }, RecordType : endpoint .RecordTypeAAAA },
188
+ {DNSName : "a.foo.example.org" , Targets : endpoint.Targets {"2001:DB8::1" , "2001:DB8::2" , "2001:DB8::2" }, RecordType : endpoint .RecordTypeAAAA },
189
+ {DNSName : "internal.a.foo.example.org" , Targets : endpoint.Targets {"2001:DB8::1" , "2001:DB8::2" , "2001:DB8::3" , "2001:DB8::4" }, RecordType : endpoint .RecordTypeAAAA },
190
190
},
191
191
false ,
192
192
[]* corev1.Node {
@@ -196,7 +196,7 @@ func TestPodSource(t *testing.T) {
196
196
},
197
197
Status : corev1.NodeStatus {
198
198
Addresses : []corev1.NodeAddress {
199
- {Type : corev1 .NodeInternalIP , Address : "2001:DB8::1" },
199
+ {Type : corev1 .NodeExternalIP , Address : "2001:DB8::1" },
200
200
},
201
201
},
202
202
},
@@ -206,7 +206,18 @@ func TestPodSource(t *testing.T) {
206
206
},
207
207
Status : corev1.NodeStatus {
208
208
Addresses : []corev1.NodeAddress {
209
- {Type : corev1 .NodeInternalIP , Address : "2001:DB8::2" },
209
+ {Type : corev1 .NodeExternalIP , Address : "2001:DB8::2" },
210
+ {Type : corev1 .NodeInternalIP , Address : "2001:DB8::3" },
211
+ },
212
+ },
213
+ },
214
+ {
215
+ ObjectMeta : metav1.ObjectMeta {
216
+ Name : "my-node3" ,
217
+ },
218
+ Status : corev1.NodeStatus {
219
+ Addresses : []corev1.NodeAddress {
220
+ {Type : corev1 .NodeInternalIP , Address : "2001:DB8::4" },
210
221
},
211
222
},
212
223
},
@@ -246,15 +257,49 @@ func TestPodSource(t *testing.T) {
246
257
PodIP : "2001:DB8::2" ,
247
258
},
248
259
},
260
+ {
261
+ ObjectMeta : metav1.ObjectMeta {
262
+ Name : "my-pod3" ,
263
+ Namespace : "kube-system" ,
264
+ Annotations : map [string ]string {
265
+ internalHostnameAnnotationKey : "internal.a.foo.example.org" ,
266
+ hostnameAnnotationKey : "a.foo.example.org" ,
267
+ },
268
+ },
269
+ Spec : corev1.PodSpec {
270
+ HostNetwork : true ,
271
+ NodeName : "my-node2" ,
272
+ },
273
+ Status : corev1.PodStatus {
274
+ PodIP : "2001:DB8::3" ,
275
+ },
276
+ },
277
+ {
278
+ ObjectMeta : metav1.ObjectMeta {
279
+ Name : "my-pod4" ,
280
+ Namespace : "kube-system" ,
281
+ Annotations : map [string ]string {
282
+ internalHostnameAnnotationKey : "internal.a.foo.example.org" ,
283
+ hostnameAnnotationKey : "a.foo.example.org" ,
284
+ },
285
+ },
286
+ Spec : corev1.PodSpec {
287
+ HostNetwork : true ,
288
+ NodeName : "my-node3" ,
289
+ },
290
+ Status : corev1.PodStatus {
291
+ PodIP : "2001:DB8::4" ,
292
+ },
293
+ },
249
294
},
250
295
},
251
296
{
252
297
"create IPv6 records based on pod's external and internal IPs using DNS Controller annotations" ,
253
298
"" ,
254
299
"kops-dns-controller" ,
255
300
[]* endpoint.Endpoint {
256
- {DNSName : "a.foo.example.org" , Targets : endpoint.Targets {"2001:DB8::1" , "2001:DB8::2" }, RecordType : endpoint .RecordTypeAAAA },
257
- {DNSName : "internal.a.foo.example.org" , Targets : endpoint.Targets {"2001:DB8::1" , "2001:DB8::2" }, RecordType : endpoint .RecordTypeAAAA },
301
+ {DNSName : "a.foo.example.org" , Targets : endpoint.Targets {"2001:DB8::1" , "2001:DB8::2" , "2001:DB8::2" }, RecordType : endpoint .RecordTypeAAAA },
302
+ {DNSName : "internal.a.foo.example.org" , Targets : endpoint.Targets {"2001:DB8::1" , "2001:DB8::2" , "2001:DB8::3" , "2001:DB8::4" }, RecordType : endpoint .RecordTypeAAAA },
258
303
},
259
304
false ,
260
305
[]* corev1.Node {
@@ -264,7 +309,7 @@ func TestPodSource(t *testing.T) {
264
309
},
265
310
Status : corev1.NodeStatus {
266
311
Addresses : []corev1.NodeAddress {
267
- {Type : corev1 .NodeInternalIP , Address : "2001:DB8::1" },
312
+ {Type : corev1 .NodeExternalIP , Address : "2001:DB8::1" },
268
313
},
269
314
},
270
315
},
@@ -274,7 +319,18 @@ func TestPodSource(t *testing.T) {
274
319
},
275
320
Status : corev1.NodeStatus {
276
321
Addresses : []corev1.NodeAddress {
277
- {Type : corev1 .NodeInternalIP , Address : "2001:DB8::2" },
322
+ {Type : corev1 .NodeExternalIP , Address : "2001:DB8::2" },
323
+ {Type : corev1 .NodeInternalIP , Address : "2001:DB8::3" },
324
+ },
325
+ },
326
+ },
327
+ {
328
+ ObjectMeta : metav1.ObjectMeta {
329
+ Name : "my-node3" ,
330
+ },
331
+ Status : corev1.NodeStatus {
332
+ Addresses : []corev1.NodeAddress {
333
+ {Type : corev1 .NodeInternalIP , Address : "2001:DB8::4" },
278
334
},
279
335
},
280
336
},
@@ -314,6 +370,40 @@ func TestPodSource(t *testing.T) {
314
370
PodIP : "2001:DB8::2" ,
315
371
},
316
372
},
373
+ {
374
+ ObjectMeta : metav1.ObjectMeta {
375
+ Name : "my-pod3" ,
376
+ Namespace : "kube-system" ,
377
+ Annotations : map [string ]string {
378
+ kopsDNSControllerInternalHostnameAnnotationKey : "internal.a.foo.example.org" ,
379
+ kopsDNSControllerHostnameAnnotationKey : "a.foo.example.org" ,
380
+ },
381
+ },
382
+ Spec : corev1.PodSpec {
383
+ HostNetwork : true ,
384
+ NodeName : "my-node2" ,
385
+ },
386
+ Status : corev1.PodStatus {
387
+ PodIP : "2001:DB8::3" ,
388
+ },
389
+ },
390
+ {
391
+ ObjectMeta : metav1.ObjectMeta {
392
+ Name : "my-pod4" ,
393
+ Namespace : "kube-system" ,
394
+ Annotations : map [string ]string {
395
+ kopsDNSControllerInternalHostnameAnnotationKey : "internal.a.foo.example.org" ,
396
+ kopsDNSControllerHostnameAnnotationKey : "a.foo.example.org" ,
397
+ },
398
+ },
399
+ Spec : corev1.PodSpec {
400
+ HostNetwork : true ,
401
+ NodeName : "my-node3" ,
402
+ },
403
+ Status : corev1.PodStatus {
404
+ PodIP : "2001:DB8::4" ,
405
+ },
406
+ },
317
407
},
318
408
},
319
409
{
@@ -406,7 +496,7 @@ func TestPodSource(t *testing.T) {
406
496
Status : corev1.NodeStatus {
407
497
Addresses : []corev1.NodeAddress {
408
498
{Type : corev1 .NodeExternalIP , Address : "54.10.11.1" },
409
- {Type : corev1 .NodeInternalIP , Address : "2001:DB8::1" },
499
+ {Type : corev1 .NodeExternalIP , Address : "2001:DB8::1" },
410
500
{Type : corev1 .NodeInternalIP , Address : "10.0.1.1" },
411
501
},
412
502
},
0 commit comments