/
egress_services.go
1428 lines (1249 loc) · 61.5 KB
/
egress_services.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package e2e
import (
"context"
"encoding/json"
"fmt"
"net"
"os"
"strings"
"time"
"github.com/onsi/ginkgo/v2"
"github.com/onsi/gomega"
"golang.org/x/sync/errgroup"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/kubernetes"
"k8s.io/kubernetes/test/e2e/framework"
e2ekubectl "k8s.io/kubernetes/test/e2e/framework/kubectl"
e2enode "k8s.io/kubernetes/test/e2e/framework/node"
e2epodoutput "k8s.io/kubernetes/test/e2e/framework/pod/output"
utilnet "k8s.io/utils/net"
)
var _ = ginkgo.Describe("EgressService", func() {
const (
egressServiceYAML = "egress_service.yaml"
externalKindContainerName = "kind-external-container-for-egress-service"
podHTTPPort = 8080
serviceName = "test-egress-service"
blackholeRoutingTable = "100"
)
command := []string{"/agnhost", "netexec", fmt.Sprintf("--http-port=%d", podHTTPPort)}
pods := []string{"pod1", "pod2", "pod3"}
podsLabels := map[string]string{"egress": "please"}
var (
externalKindIPv4 string
externalKindIPv6 string
nodes []v1.Node
)
f := wrappedTestFramework("egress-services")
ginkgo.BeforeEach(func() {
var err error
clientSet := f.ClientSet
n, err := e2enode.GetBoundedReadySchedulableNodes(context.TODO(), clientSet, 3)
framework.ExpectNoError(err)
if len(n.Items) < 3 {
framework.Failf(
"Test requires >= 3 Ready nodes, but there are only %v nodes",
len(n.Items))
}
nodes = n.Items
ginkgo.By("Creating the external kind container to send the traffic to/from")
externalKindIPv4, externalKindIPv6 = createClusterExternalContainer(externalKindContainerName, agnhostImage,
[]string{"--privileged", "--network", "kind"}, []string{"netexec", fmt.Sprintf("--http-port=%d", podHTTPPort)})
})
ginkgo.AfterEach(func() {
deleteClusterExternalContainer(externalKindContainerName)
flushCustomRoutingTablesOnNodes(nodes, blackholeRoutingTable)
})
ginkgo.DescribeTable("Should validate pods' egress is SNATed to the LB's ingress ip without selectors",
func(protocol v1.IPFamily, dstIP *string) {
ginkgo.By("Creating the backend pods")
podsCreateSync := errgroup.Group{}
for i, name := range pods {
name := name
i := i
podsCreateSync.Go(func() error {
p, err := createGenericPodWithLabel(f, name, nodes[i].Name, f.Namespace.Name, command, podsLabels)
if p != nil {
framework.Logf("%s podIPs are: %v", p.Name, p.Status.PodIPs)
}
return err
})
}
err := podsCreateSync.Wait()
framework.ExpectNoError(err, "failed to create backend pods")
ginkgo.By("Creating an egress service without node selectors")
egressServiceConfig := fmt.Sprintf(`
apiVersion: k8s.ovn.org/v1
kind: EgressService
metadata:
name: ` + serviceName + `
namespace: ` + f.Namespace.Name + `
spec:
sourceIPBy: "LoadBalancerIP"
`)
if err := os.WriteFile(egressServiceYAML, []byte(egressServiceConfig), 0644); err != nil {
framework.Failf("Unable to write CRD config to disk: %v", err)
}
defer func() {
if err := os.Remove(egressServiceYAML); err != nil {
framework.Logf("Unable to remove the CRD config from disk: %v", err)
}
}()
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "create", "-f", egressServiceYAML)
svc := createLBServiceWithIngressIP(f.ClientSet, f.Namespace.Name, serviceName, protocol, podsLabels, podHTTPPort)
svcIP := svc.Status.LoadBalancer.Ingress[0].IP
ginkgo.By("Getting the IPs of the node in charge of the service")
_, egressHostV4IP, egressHostV6IP := getEgressSVCHost(f.ClientSet, f.Namespace.Name, serviceName)
ginkgo.By("Setting the static route on the external container for the service via the egress host ip")
setSVCRouteOnContainer(externalKindContainerName, svcIP, egressHostV4IP, egressHostV6IP)
ginkgo.By("Verifying the pods reach the external container with the service's ingress ip")
for _, pod := range pods {
gomega.Eventually(func() error {
return curlAgnHostClientIPFromPod(f.Namespace.Name, pod, svcIP, *dstIP, podHTTPPort)
}, 5*time.Second, 500*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "failed to reach external container with loadbalancer's ingress ip")
}
gomega.Consistently(func() error {
for _, pod := range pods {
if err := curlAgnHostClientIPFromPod(f.Namespace.Name, pod, svcIP, *dstIP, podHTTPPort); err != nil {
return err
}
}
return nil
}, 2*time.Second, 400*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "failed to reach external container with loadbalancer's ingress ip")
ginkgo.By("Verifying the external container can reach all of the service's backend pods")
// This is to be sure we did not break ingress traffic for the service
reachAllServiceBackendsFromExternalContainer(externalKindContainerName, svcIP, podHTTPPort, pods)
ginkgo.By("Creating the custom network")
setBlackholeRoutingTableOnNodes(nodes, blackholeRoutingTable, externalKindIPv4, externalKindIPv6, protocol == v1.IPv4Protocol)
ginkgo.By("Updating the resource to contain a Network")
egressServiceConfig = fmt.Sprintf(`
apiVersion: k8s.ovn.org/v1
kind: EgressService
metadata:
name: ` + serviceName + `
namespace: ` + f.Namespace.Name + `
spec:
sourceIPBy: "LoadBalancerIP"
network: "100"
`)
if err := os.WriteFile(egressServiceYAML, []byte(egressServiceConfig), 0644); err != nil {
framework.Failf("Unable to write CRD config to disk: %v", err)
}
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-f", egressServiceYAML)
ginkgo.By("Verifying the pods can't reach the external container due to the blackhole in the custom network")
gomega.Consistently(func() error {
for _, pod := range pods {
err := curlAgnHostClientIPFromPod(f.Namespace.Name, pod, svcIP, *dstIP, podHTTPPort)
if err != nil && !strings.Contains(err.Error(), "exit code 28") {
return fmt.Errorf("expected err to be a connection timed out due to blackhole, got: %w", err)
}
if err == nil {
return fmt.Errorf("pod %s managed to reach external client despite blackhole", pod)
}
}
return nil
}, 2*time.Second, 400*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "managed to reach external container despite blackhole")
ginkgo.By("Removing the blackhole to the external container the pods should be able to reach it with the loadbalancer's ingress ip")
delExternalClientBlackholeFromNodes(nodes, blackholeRoutingTable, externalKindIPv4, externalKindIPv6, protocol == v1.IPv4Protocol)
gomega.Consistently(func() error {
for _, pod := range pods {
if err := curlAgnHostClientIPFromPod(f.Namespace.Name, pod, svcIP, *dstIP, podHTTPPort); err != nil {
return err
}
}
return nil
}, 2*time.Second, 400*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "failed to reach external container with loadbalancer's ingress ip")
ginkgo.By("Deleting the EgressService the backend pods should exit with their node's IP")
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "delete", "-f", egressServiceYAML)
for i, pod := range pods {
node := &nodes[i]
v4, v6 := getNodeAddresses(node)
expected := v4
if utilnet.IsIPv6String(svcIP) {
expected = v6
}
gomega.Eventually(func() error {
return curlAgnHostClientIPFromPod(f.Namespace.Name, pod, expected, *dstIP, podHTTPPort)
}, 3*time.Second, 500*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "failed to reach external container with node's ip")
gomega.Consistently(func() error {
return curlAgnHostClientIPFromPod(f.Namespace.Name, pod, expected, *dstIP, podHTTPPort)
}, 1*time.Second, 200*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "failed to reach external container with node's ip")
}
},
ginkgo.Entry("ipv4 pods", v1.IPv4Protocol, &externalKindIPv4),
ginkgo.Entry("ipv6 pods", v1.IPv6Protocol, &externalKindIPv6),
)
ginkgo.DescribeTable("[LGW] Should validate pods' egress uses node's IP when setting Network without SNAT",
func(protocol v1.IPFamily, dstIP *string) {
ginkgo.By("Creating the backend pods")
podsCreateSync := errgroup.Group{}
for i, name := range pods {
name := name
i := i
podsCreateSync.Go(func() error {
p, err := createGenericPodWithLabel(f, name, nodes[i].Name, f.Namespace.Name, command, podsLabels)
if p != nil {
framework.Logf("%s podIPs are: %v", p.Name, p.Status.PodIPs)
}
return err
})
}
err := podsCreateSync.Wait()
framework.ExpectNoError(err, "failed to create backend pods")
ginkgo.By("Creating an egress service with custom network without SNAT")
egressServiceConfig := fmt.Sprintf(`
apiVersion: k8s.ovn.org/v1
kind: EgressService
metadata:
name: ` + serviceName + `
namespace: ` + f.Namespace.Name + `
spec:
sourceIPBy: "Network"
network: "100"
`)
if err := os.WriteFile(egressServiceYAML, []byte(egressServiceConfig), 0644); err != nil {
framework.Failf("Unable to write CRD config to disk: %v", err)
}
defer func() {
if err := os.Remove(egressServiceYAML); err != nil {
framework.Logf("Unable to remove the CRD config from disk: %v", err)
}
}()
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "create", "-f", egressServiceYAML)
svc := createLBServiceWithIngressIP(f.ClientSet, f.Namespace.Name, serviceName, protocol, podsLabels, podHTTPPort)
svcIP := svc.Status.LoadBalancer.Ingress[0].IP
ginkgo.By("Creating the custom network")
setBlackholeRoutingTableOnNodes(nodes, blackholeRoutingTable, externalKindIPv4, externalKindIPv6, protocol == v1.IPv4Protocol)
ginkgo.By("Verifying the pods can't reach the external container due to the blackhole in the custom network")
gomega.Consistently(func() error {
for _, pod := range pods {
err := curlAgnHostClientIPFromPod(f.Namespace.Name, pod, svcIP, *dstIP, podHTTPPort)
if err != nil && !strings.Contains(err.Error(), "exit code 28") {
return fmt.Errorf("expected err to be a connection timed out due to blackhole, got: %w", err)
}
if err == nil {
return fmt.Errorf("pod %s managed to reach external client despite blackhole", pod)
}
}
return nil
}, 2*time.Second, 400*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "managed to reach external container despite blackhole")
ginkgo.By("Removing the blackhole to the external container the pods should be able to reach it with the node's IP")
delExternalClientBlackholeFromNodes(nodes, blackholeRoutingTable, externalKindIPv4, externalKindIPv6, protocol == v1.IPv4Protocol)
for i, pod := range pods {
node := &nodes[i]
v4, v6 := getNodeAddresses(node)
expected := v4
if utilnet.IsIPv6String(svcIP) {
expected = v6
}
gomega.Eventually(func() error {
return curlAgnHostClientIPFromPod(f.Namespace.Name, pod, expected, *dstIP, podHTTPPort)
}, 3*time.Second, 500*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "failed to reach external container with node's ip")
gomega.Consistently(func() error {
return curlAgnHostClientIPFromPod(f.Namespace.Name, pod, expected, *dstIP, podHTTPPort)
}, 1*time.Second, 200*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "failed to reach external container with node's ip")
}
// Re-adding the blackhole and deleting the EgressService to verify that the pods go back to use the main network.
ginkgo.By("Re-adding the blackhole the pods should not be able to reach the external container")
setBlackholeRoutingTableOnNodes(nodes, blackholeRoutingTable, externalKindIPv4, externalKindIPv6, protocol == v1.IPv4Protocol)
ginkgo.By("Verifying the pods can't reach the external container due to the blackhole in the custom network")
gomega.Consistently(func() error {
for _, pod := range pods {
err := curlAgnHostClientIPFromPod(f.Namespace.Name, pod, svcIP, *dstIP, podHTTPPort)
if err != nil && !strings.Contains(err.Error(), "exit code 28") {
return fmt.Errorf("expected err to be a connection timed out due to blackhole, got: %w", err)
}
if err == nil {
return fmt.Errorf("pod %s managed to reach external client despite blackhole", pod)
}
}
return nil
}, 2*time.Second, 400*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "managed to reach external container despite blackhole")
ginkgo.By("Deleting the EgressService the backend pods should exit with their node's IP (via the main network)")
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "delete", "-f", egressServiceYAML)
for i, pod := range pods {
node := &nodes[i]
v4, v6 := getNodeAddresses(node)
expected := v4
if utilnet.IsIPv6String(svcIP) {
expected = v6
}
gomega.Eventually(func() error {
return curlAgnHostClientIPFromPod(f.Namespace.Name, pod, expected, *dstIP, podHTTPPort)
}, 3*time.Second, 500*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "failed to reach external container with node's ip")
gomega.Consistently(func() error {
return curlAgnHostClientIPFromPod(f.Namespace.Name, pod, expected, *dstIP, podHTTPPort)
}, 1*time.Second, 200*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "failed to reach external container with node's ip")
}
},
ginkgo.Entry("ipv4 pods", v1.IPv4Protocol, &externalKindIPv4),
ginkgo.Entry("ipv6 pods", v1.IPv6Protocol, &externalKindIPv6),
)
ginkgo.DescribeTable("Should validate the egress SVC SNAT functionality against host-networked pods",
func(protocol v1.IPFamily) {
ginkgo.By("Creating the backend pods")
podsCreateSync := errgroup.Group{}
podsToNodeMapping := make(map[string]v1.Node, 3)
for i, name := range pods {
name := name
i := i
podsCreateSync.Go(func() error {
p, err := createGenericPodWithLabel(f, name, nodes[i].Name, f.Namespace.Name, command, podsLabels)
framework.Logf("%s podIPs are: %v", p.Name, p.Status.PodIPs)
return err
})
podsToNodeMapping[name] = nodes[i]
}
err := podsCreateSync.Wait()
framework.ExpectNoError(err, "failed to create backend pods")
ginkgo.By("Creating an egress service without node selectors")
egressServiceConfig := fmt.Sprintf(`
apiVersion: k8s.ovn.org/v1
kind: EgressService
metadata:
name: ` + serviceName + `
namespace: ` + f.Namespace.Name + `
spec:
sourceIPBy: "LoadBalancerIP"
`)
if err := os.WriteFile(egressServiceYAML, []byte(egressServiceConfig), 0644); err != nil {
framework.Failf("Unable to write CRD config to disk: %v", err)
}
defer func() {
if err := os.Remove(egressServiceYAML); err != nil {
framework.Logf("Unable to remove the CRD config from disk: %v", err)
}
}()
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "create", "-f", egressServiceYAML)
_ = createLBServiceWithIngressIP(f.ClientSet, f.Namespace.Name, serviceName, protocol, podsLabels, podHTTPPort)
ginkgo.By("Getting the IPs of the node in charge of the service")
egressHost, _, _ := getEgressSVCHost(f.ClientSet, f.Namespace.Name, serviceName)
framework.Logf("Egress node is %s", egressHost.Name)
var dstNode v1.Node
hostNetPod := "host-net-pod"
for i := range nodes {
if nodes[i].Name != egressHost.Name { // note that we deliberately pick a non-egress-host as dst node
dstNode = nodes[i]
break
}
}
ginkgo.By("By setting a secondary IP on non-egress node acting as \"another node\"")
var otherDstIP string
if protocol == v1.IPv6Protocol {
otherDstIP = "fc00:f853:ccd:e793:ffff::1"
} else {
// TODO(mk): replace with non-repeating IP allocator
otherDstIP = "172.18.1.1"
}
_, err = runCommand(containerRuntime, "exec", dstNode.Name, "ip", "addr", "add", otherDstIP, "dev", "breth0")
if err != nil {
framework.Failf("failed to add address to node %s: %v", dstNode.Name, err)
}
defer func() {
_, err = runCommand(containerRuntime, "exec", dstNode.Name, "ip", "addr", "delete", otherDstIP, "dev", "breth0")
if err != nil {
framework.Failf("failed to remove address from node %s: %v", dstNode.Name, err)
}
}()
ginkgo.By("Creating host-networked pod on non-egress node acting as \"another node\"")
_, err = createPod(f, hostNetPod, dstNode.Name, f.Namespace.Name, []string{"/agnhost", "netexec", fmt.Sprintf("--http-port=%d", podHTTPPort)}, map[string]string{}, func(p *v1.Pod) {
p.Spec.HostNetwork = true
})
framework.ExpectNoError(err)
framework.Logf("Created pod %s on node %s", hostNetPod, dstNode.Name)
v4, v6 := getNodeAddresses(&dstNode)
dstIP := v4
if protocol == v1.IPv6Protocol {
dstIP = v6
}
ginkgo.By("Verifying traffic from all the 3 backend pods should exit with their node's IP when going towards other nodes in cluster")
for _, pod := range pods { // loop through all the pods, ensure the curl to other node is always going via nodeIP of the node where the pod lives
srcNode := podsToNodeMapping[pod]
if srcNode.Name == dstNode.Name {
framework.Logf("Skipping check for pod %s because its on the destination node; srcIP will be podIP", pod)
continue // traffic flow is pod -> mp0 -> local host: This won't have nodeIP as SNAT
}
v4, v6 = getNodeAddresses(&srcNode)
expectedsrcIP := v4
if protocol == v1.IPv6Protocol {
expectedsrcIP = v6
}
gomega.Consistently(func() error {
return curlAgnHostClientIPFromPod(f.Namespace.Name, pod, expectedsrcIP, dstIP, podHTTPPort)
}, 1*time.Second, 200*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "failed to reach other node with node's primary ip")
gomega.Consistently(func() error {
return curlAgnHostClientIPFromPod(f.Namespace.Name, pod, expectedsrcIP, otherDstIP, podHTTPPort)
}, 1*time.Second, 200*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "failed to reach other node with node's secondary ip")
}
},
ginkgo.Entry("ipv4 pods", v1.IPv4Protocol),
ginkgo.Entry("ipv6 pods", v1.IPv6Protocol),
)
ginkgo.DescribeTable("Should validate pods' egress is SNATed to the LB's ingress ip with selectors",
func(protocol v1.IPFamily, dstIP *string) {
ginkgo.By("Creating the backend pods")
podsCreateSync := errgroup.Group{}
index := 0
for i, name := range pods {
name := name
i := i
podsCreateSync.Go(func() error {
_, err := createGenericPodWithLabel(f, name, nodes[i].Name, f.Namespace.Name, command, podsLabels)
return err
})
index++
}
err := podsCreateSync.Wait()
framework.ExpectNoError(err, "failed to create backend pods")
ginkgo.By("Creating an egress service selecting the first node")
firstNode := nodes[0].Name
egressServiceConfig := fmt.Sprintf(`
apiVersion: k8s.ovn.org/v1
kind: EgressService
metadata:
name: ` + serviceName + `
namespace: ` + f.Namespace.Name + `
spec:
sourceIPBy: "LoadBalancerIP"
nodeSelector:
matchLabels:
kubernetes.io/hostname: ` + firstNode + `
`)
if err := os.WriteFile(egressServiceYAML, []byte(egressServiceConfig), 0644); err != nil {
framework.Failf("Unable to write CRD config to disk: %v", err)
}
defer func() {
if err := os.Remove(egressServiceYAML); err != nil {
framework.Logf("Unable to remove the CRD config from disk: %v", err)
}
}()
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "create", "-f", egressServiceYAML)
svc := createLBServiceWithIngressIP(f.ClientSet, f.Namespace.Name, serviceName, protocol, podsLabels, podHTTPPort)
svcIP := svc.Status.LoadBalancer.Ingress[0].IP
ginkgo.By("Verifying the first node was picked for handling the service's egress traffic")
node, egressHostV4IP, egressHostV6IP := getEgressSVCHost(f.ClientSet, f.Namespace.Name, serviceName)
gomega.Expect(node.Name).To(gomega.Equal(firstNode), "the wrong node got selected for egress service")
ginkgo.By("Setting the static route on the external container for the service via the first node's ip")
setSVCRouteOnContainer(externalKindContainerName, svcIP, egressHostV4IP, egressHostV6IP)
ginkgo.By("Verifying the pods reach the external container with the service's ingress ip")
for _, pod := range pods {
gomega.Eventually(func() error {
return curlAgnHostClientIPFromPod(f.Namespace.Name, pod, svcIP, *dstIP, podHTTPPort)
}, 5*time.Second, 500*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "failed to reach external container with loadbalancer's ingress ip")
}
gomega.Consistently(func() error {
for _, pod := range pods {
if err := curlAgnHostClientIPFromPod(f.Namespace.Name, pod, svcIP, *dstIP, podHTTPPort); err != nil {
return err
}
}
return nil
}, 2*time.Second, 400*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "failed to reach external container with loadbalancer's ingress ip")
ginkgo.By("Verifying the external container can reach all of the service's backend pods")
// This is to be sure we did not break ingress traffic for the service
reachAllServiceBackendsFromExternalContainer(externalKindContainerName, svcIP, podHTTPPort, pods)
ginkgo.By("Updating the egress service to select the second node")
secondNode := nodes[1].Name
egressServiceConfig = fmt.Sprintf(`
apiVersion: k8s.ovn.org/v1
kind: EgressService
metadata:
name: ` + serviceName + `
namespace: ` + f.Namespace.Name + `
spec:
sourceIPBy: "LoadBalancerIP"
nodeSelector:
matchLabels:
kubernetes.io/hostname: ` + secondNode + `
`)
if err := os.WriteFile(egressServiceYAML, []byte(egressServiceConfig), 0644); err != nil {
framework.Failf("Unable to write CRD config to disk: %v", err)
}
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-f", egressServiceYAML)
ginkgo.By("Verifying the second node now handles the service's egress traffic")
node, egressHostV4IP, egressHostV6IP = getEgressSVCHost(f.ClientSet, f.Namespace.Name, serviceName)
gomega.Expect(node.Name).To(gomega.Equal(secondNode), "the wrong node got selected for egress service")
nodeList, err := f.ClientSet.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{LabelSelector: fmt.Sprintf("egress-service.k8s.ovn.org/%s-%s=", f.Namespace.Name, serviceName)})
framework.ExpectNoError(err, "failed to list nodes")
gomega.Expect(len(nodeList.Items)).To(gomega.Equal(1), fmt.Sprintf("expected only one node labeled for the service, got %v", nodeList.Items))
ginkgo.By("Setting the static route on the external container for the service via the second node's ip")
setSVCRouteOnContainer(externalKindContainerName, svcIP, egressHostV4IP, egressHostV6IP)
ginkgo.By("Verifying the pods reach the external container with the service's ingress ip again")
for _, pod := range pods {
gomega.Eventually(func() error {
return curlAgnHostClientIPFromPod(f.Namespace.Name, pod, svcIP, *dstIP, podHTTPPort)
}, 5*time.Second, 500*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "failed to reach external container with loadbalancer's ingress ip")
}
gomega.Consistently(func() error {
for _, pod := range pods {
if err := curlAgnHostClientIPFromPod(f.Namespace.Name, pod, svcIP, *dstIP, podHTTPPort); err != nil {
return err
}
}
return nil
}, 2*time.Second, 400*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "failed to reach external container with loadbalancer's ingress ip")
ginkgo.By("Verifying the external container can reach all of the service's backend pods")
reachAllServiceBackendsFromExternalContainer(externalKindContainerName, svcIP, podHTTPPort, pods)
ginkgo.By("Updating the egress service selector to match no node")
egressServiceConfig = fmt.Sprintf(`
apiVersion: k8s.ovn.org/v1
kind: EgressService
metadata:
name: ` + serviceName + `
namespace: ` + f.Namespace.Name + `
spec:
sourceIPBy: "LoadBalancerIP"
nodeSelector:
matchLabels:
perfect: match
`)
if err := os.WriteFile(egressServiceYAML, []byte(egressServiceConfig), 0644); err != nil {
framework.Failf("Unable to write CRD config to disk: %v", err)
}
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "apply", "-f", egressServiceYAML)
gomega.Eventually(func() error {
nodeList, err := f.ClientSet.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{LabelSelector: fmt.Sprintf("egress-service.k8s.ovn.org/%s-%s=", f.Namespace.Name, serviceName)})
if err != nil {
return err
}
if len(nodeList.Items) != 0 {
return fmt.Errorf("expected no nodes to be labeled for the service, got %v", nodeList.Items)
}
return nil
}, 3*time.Second, 500*time.Millisecond).ShouldNot(gomega.HaveOccurred())
ginkgo.By("Verifying the backend pods exit with their node's IP")
for i, pod := range pods {
node := nodes[i]
v4, v6 := getNodeAddresses(&node)
expected := v4
if utilnet.IsIPv6String(svcIP) {
expected = v6
}
gomega.Eventually(func() error {
return curlAgnHostClientIPFromPod(f.Namespace.Name, pod, expected, *dstIP, podHTTPPort)
}, 3*time.Second, 500*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "failed to reach external container with node's ip")
gomega.Consistently(func() error {
return curlAgnHostClientIPFromPod(f.Namespace.Name, pod, expected, *dstIP, podHTTPPort)
}, 1*time.Second, 200*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "failed to reach external container with node's ip")
}
ginkgo.By("Updating the third node to match the service's selector")
thirdNode := nodes[2].Name
node, err = f.ClientSet.CoreV1().Nodes().Get(context.TODO(), thirdNode, metav1.GetOptions{})
framework.ExpectNoError(err, "failed to get node")
oldLabels := map[string]string{}
for k, v := range node.Labels {
oldLabels[k] = v
}
node.Labels["perfect"] = "match"
_, err = f.ClientSet.CoreV1().Nodes().Update(context.TODO(), node, metav1.UpdateOptions{})
framework.ExpectNoError(err, "failed to update node's labels")
defer func() {
node, err = f.ClientSet.CoreV1().Nodes().Get(context.TODO(), thirdNode, metav1.GetOptions{})
framework.ExpectNoError(err, "failed to get node")
node.Labels = oldLabels
_, err = f.ClientSet.CoreV1().Nodes().Update(context.TODO(), node, metav1.UpdateOptions{})
framework.ExpectNoError(err, "failed to revert node's labels")
}()
ginkgo.By("Verifying the third node now handles the service's egress traffic")
node, egressHostV4IP, egressHostV6IP = getEgressSVCHost(f.ClientSet, f.Namespace.Name, serviceName)
gomega.Expect(node.Name).To(gomega.Equal(thirdNode), "the wrong node got selected for egress service")
nodeList, err = f.ClientSet.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{LabelSelector: fmt.Sprintf("egress-service.k8s.ovn.org/%s-%s=", f.Namespace.Name, serviceName)})
framework.ExpectNoError(err, "failed to list nodes")
gomega.Expect(len(nodeList.Items)).To(gomega.Equal(1), fmt.Sprintf("expected only one node labeled for the service, got %v", nodeList.Items))
ginkgo.By("Setting the static route on the external container for the service via the third node's ip")
setSVCRouteOnContainer(externalKindContainerName, svcIP, egressHostV4IP, egressHostV6IP)
ginkgo.By("Verifying the pods reach the external container with the service's ingress ip again")
for _, pod := range pods {
gomega.Eventually(func() error {
return curlAgnHostClientIPFromPod(f.Namespace.Name, pod, svcIP, *dstIP, podHTTPPort)
}, 5*time.Second, 500*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "failed to reach external container with loadbalancer's ingress ip")
}
gomega.Consistently(func() error {
for _, pod := range pods {
if err := curlAgnHostClientIPFromPod(f.Namespace.Name, pod, svcIP, *dstIP, podHTTPPort); err != nil {
return err
}
}
return nil
}, 2*time.Second, 400*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "failed to reach external container with loadbalancer's ingress ip")
reachAllServiceBackendsFromExternalContainer(externalKindContainerName, svcIP, podHTTPPort, pods)
},
ginkgo.Entry("ipv4 pods", v1.IPv4Protocol, &externalKindIPv4),
ginkgo.Entry("ipv6 pods", v1.IPv6Protocol, &externalKindIPv6),
)
ginkgo.DescribeTable("Should validate egress service has higher priority than EgressIP when not assigned to the same node",
func(protocol v1.IPFamily, dstIP *string) {
labels := map[string]string{"wants": "egress"}
ginkgo.By("Creating the backend pods")
podsCreateSync := errgroup.Group{}
for i, name := range pods {
name := name
i := i
podsCreateSync.Go(func() error {
p, err := createGenericPodWithLabel(f, name, nodes[i].Name, f.Namespace.Name, command, labels)
if p != nil {
framework.Logf("%s podIPs are: %v", p.Name, p.Status.PodIPs)
}
return err
})
}
err := podsCreateSync.Wait()
framework.ExpectNoError(err, "failed to create backend pods")
ginkgo.By("Creating an egress service with node selector")
egressServiceConfig := fmt.Sprintf(`
apiVersion: k8s.ovn.org/v1
kind: EgressService
metadata:
name: ` + serviceName + `
namespace: ` + f.Namespace.Name + `
spec:
sourceIPBy: "LoadBalancerIP"
nodeSelector:
matchLabels:
kubernetes.io/hostname: ` + nodes[1].Name)
if err := os.WriteFile(egressServiceYAML, []byte(egressServiceConfig), 0644); err != nil {
framework.Failf("Unable to write CRD config to disk: %v", err)
}
defer func() {
if err := os.Remove(egressServiceYAML); err != nil {
framework.Logf("Unable to remove the CRD config from disk: %v", err)
}
}()
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "create", "-f", egressServiceYAML)
svc := createLBServiceWithIngressIP(f.ClientSet, f.Namespace.Name, serviceName, protocol, labels, podHTTPPort)
svcIP := svc.Status.LoadBalancer.Ingress[0].IP
ginkgo.By("Getting the IPs of the node in charge of the service")
_, egressHostV4IP, egressHostV6IP := getEgressSVCHost(f.ClientSet, f.Namespace.Name, serviceName)
ginkgo.By("Setting the static route on the external container for the service via the egress host ip")
setSVCRouteOnContainer(externalKindContainerName, svcIP, egressHostV4IP, egressHostV6IP)
// Assign the egress IP without conflicting with any node IP,
// the kind subnet is /16 or /64 so the following should be fine.
ginkgo.By("Assigning the EgressIP to a different node")
eipNode := nodes[0]
e2enode.AddOrUpdateLabelOnNode(f.ClientSet, eipNode.Name, "k8s.ovn.org/egress-assignable", "dummy")
defer func() {
e2ekubectl.RunKubectlOrDie("default", "label", "node", eipNode.Name, "k8s.ovn.org/egress-assignable-")
}()
nodev4IP, nodev6IP := getNodeAddresses(&eipNode)
egressNodeIP := net.ParseIP(nodev4IP)
if utilnet.IsIPv6String(svcIP) {
egressNodeIP = net.ParseIP(nodev6IP)
}
egressIP := make(net.IP, len(egressNodeIP))
copy(egressIP, egressNodeIP)
egressIP[len(egressIP)-2]++
egressIPYaml := "egressip.yaml"
egressIPConfig := fmt.Sprintf(`apiVersion: k8s.ovn.org/v1
kind: EgressIP
metadata:
name: egress-svc-test-eip
spec:
egressIPs:
- ` + egressIP.String() + `
podSelector:
matchLabels:
wants: egress
namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: ` + f.Namespace.Name + `
`)
if err := os.WriteFile(egressIPYaml, []byte(egressIPConfig), 0644); err != nil {
framework.Failf("Unable to write CRD config to disk: %v", err)
}
defer func() {
if err := os.Remove(egressIPYaml); err != nil {
framework.Logf("Unable to remove the CRD config from disk: %v", err)
}
}()
framework.Logf("Create the EgressIP configuration")
e2ekubectl.RunKubectlOrDie("default", "create", "-f", egressIPYaml)
defer func() {
e2ekubectl.RunKubectlOrDie("default", "delete", "eip", "egress-svc-test-eip")
}()
ginkgo.By("Verifying the pods reach the external container with the service's ingress ip")
for _, pod := range pods {
gomega.Eventually(func() error {
return curlAgnHostClientIPFromPod(f.Namespace.Name, pod, svcIP, *dstIP, podHTTPPort)
}, 5*time.Second, 500*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "failed to reach external container with loadbalancer's ingress ip")
}
gomega.Consistently(func() error {
for _, pod := range pods {
if err := curlAgnHostClientIPFromPod(f.Namespace.Name, pod, svcIP, *dstIP, podHTTPPort); err != nil {
return err
}
}
return nil
}, 2*time.Second, 400*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "failed to reach external container with loadbalancer's ingress ip")
ginkgo.By("Verifying the external container can reach all of the service's backend pods")
// This is to be sure we did not break ingress traffic for the service
reachAllServiceBackendsFromExternalContainer(externalKindContainerName, svcIP, podHTTPPort, pods)
ginkgo.By("Deleting the EgressService the backend pods should exit with the EgressIP")
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "delete", "-f", egressServiceYAML)
for _, pod := range pods {
gomega.Eventually(func() error {
return curlAgnHostClientIPFromPod(f.Namespace.Name, pod, egressIP.String(), *dstIP, podHTTPPort)
}, 3*time.Second, 500*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "failed to reach external container with eip")
gomega.Consistently(func() error {
return curlAgnHostClientIPFromPod(f.Namespace.Name, pod, egressIP.String(), *dstIP, podHTTPPort)
}, 1*time.Second, 200*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "failed to reach external container with eip")
}
},
ginkgo.Entry("ipv4 pods", v1.IPv4Protocol, &externalKindIPv4),
ginkgo.Entry("ipv6 pods", v1.IPv6Protocol, &externalKindIPv6),
)
ginkgo.DescribeTable("Should validate a node with a local ep is selected when ETP=Local",
func(protocol v1.IPFamily, dstIP *string) {
ginkgo.By("Creating two backend pods on the second node")
firstNode := nodes[0].Name
secondNode := nodes[1].Name
podsCreateSync := errgroup.Group{}
for _, name := range pods[:2] {
name := name
podsCreateSync.Go(func() error {
p, err := createGenericPodWithLabel(f, name, secondNode, f.Namespace.Name, command, podsLabels)
if p != nil {
framework.Logf("%s podIPs are: %v", p.Name, p.Status.PodIPs)
}
return err
})
}
err := podsCreateSync.Wait()
framework.ExpectNoError(err, "failed to create backend pods")
ginkgo.By("Creating an ETP=Local egress service selecting the first node")
egressServiceConfig := fmt.Sprintf(`
apiVersion: k8s.ovn.org/v1
kind: EgressService
metadata:
name: ` + serviceName + `
namespace: ` + f.Namespace.Name + `
spec:
sourceIPBy: "LoadBalancerIP"
nodeSelector:
matchLabels:
kubernetes.io/hostname: ` + firstNode + `
`)
if err := os.WriteFile(egressServiceYAML, []byte(egressServiceConfig), 0644); err != nil {
framework.Failf("Unable to write CRD config to disk: %v", err)
}
defer func() {
if err := os.Remove(egressServiceYAML); err != nil {
framework.Logf("Unable to remove the CRD config from disk: %v", err)
}
}()
e2ekubectl.RunKubectlOrDie(f.Namespace.Name, "create", "-f", egressServiceYAML)
svc := createLBServiceWithIngressIP(f.ClientSet, f.Namespace.Name, serviceName, protocol, podsLabels, podHTTPPort,
func(svc *v1.Service) {
svc.Spec.ExternalTrafficPolicy = v1.ServiceExternalTrafficPolicyTypeLocal
})
svcIP := svc.Status.LoadBalancer.Ingress[0].IP
gomega.Consistently(func() error {
nodeList, err := f.ClientSet.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{LabelSelector: fmt.Sprintf("egress-service.k8s.ovn.org/%s-%s=", svc.Namespace, svc.Name)})
if err != nil {
return err
}
if len(nodeList.Items) != 0 {
return fmt.Errorf("expected no nodes to be labeled for the service, got %v", nodeList.Items)
}
status, err := getEgressServiceStatus(f.Namespace.Name, serviceName)
if err != nil {
return err
}
if status.Host != "" {
return fmt.Errorf("expected no host for egress service %s/%s got: %v", f.Namespace.Name, serviceName, status.Host)
}
return nil
}, 3*time.Second, 500*time.Millisecond).ShouldNot(gomega.HaveOccurred())
ginkgo.By("Creating the third backend pod on the first node")
p, err := createGenericPodWithLabel(f, pods[2], firstNode, f.Namespace.Name, command, podsLabels)
if p != nil {
framework.Logf("%s podIPs are: %v", p.Name, p.Status.PodIPs)
}
framework.ExpectNoError(err)
ginkgo.By("Verifying the first node was selected for the service")
node, egressHostV4IP, egressHostV6IP := getEgressSVCHost(f.ClientSet, f.Namespace.Name, serviceName)
gomega.Expect(node.Name).To(gomega.Equal(firstNode), "the wrong node got selected for egress service")
ginkgo.By("Setting the static route on the external container for the service via the first node's ip")
setSVCRouteOnContainer(externalKindContainerName, svcIP, egressHostV4IP, egressHostV6IP)
ginkgo.By("Verifying the pods reach the external container with the service's ingress ip")
for _, pod := range pods {
gomega.Eventually(func() error {
return curlAgnHostClientIPFromPod(f.Namespace.Name, pod, svcIP, *dstIP, podHTTPPort)
}, 5*time.Second, 500*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "failed to reach external container with loadbalancer's ingress ip")
}
gomega.Consistently(func() error {
for _, pod := range pods {
if err := curlAgnHostClientIPFromPod(f.Namespace.Name, pod, svcIP, *dstIP, podHTTPPort); err != nil {
return err
}
}
return nil
}, 2*time.Second, 400*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "failed to reach external container with loadbalancer's ingress ip")
ginkgo.By("Deleting the third pod the service should stop being an egress service")
err = f.ClientSet.CoreV1().Pods(f.Namespace.Name).Delete(context.TODO(), p.Name, metav1.DeleteOptions{})
framework.ExpectNoError(err)
gomega.Eventually(func() error {
nodeList, err := f.ClientSet.CoreV1().Nodes().List(context.TODO(), metav1.ListOptions{LabelSelector: fmt.Sprintf("egress-service.k8s.ovn.org/%s-%s=", svc.Namespace, svc.Name)})
if err != nil {
return err
}
if len(nodeList.Items) != 0 {
return fmt.Errorf("expected no nodes to be labeled for the service, got %v", nodeList.Items)
}
status, err := getEgressServiceStatus(f.Namespace.Name, serviceName)
if err != nil {
return err
}
if status.Host != "" {
return fmt.Errorf("expected no host for egress service %s/%s got: %v", f.Namespace.Name, serviceName, status.Host)
}
return nil
}, 3*time.Second, 500*time.Millisecond).ShouldNot(gomega.HaveOccurred())
ginkgo.By("Verifying the two backend pods left exit with their node's IP")
for _, pod := range pods[:2] {
node := nodes[1]
v4, v6 := getNodeAddresses(&node)
expected := v4
if utilnet.IsIPv6String(svcIP) {
expected = v6
}
gomega.Eventually(func() error {
return curlAgnHostClientIPFromPod(f.Namespace.Name, pod, expected, *dstIP, podHTTPPort)
}, 3*time.Second, 500*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "failed to reach external container with node's ip")
gomega.Consistently(func() error {
return curlAgnHostClientIPFromPod(f.Namespace.Name, pod, expected, *dstIP, podHTTPPort)
}, 1*time.Second, 200*time.Millisecond).ShouldNot(gomega.HaveOccurred(), "failed to reach external container with node's ip")
}
},
ginkgo.Entry("ipv4 pods", v1.IPv4Protocol, &externalKindIPv4),
ginkgo.Entry("ipv6 pods", v1.IPv6Protocol, &externalKindIPv6),
)
ginkgo.Describe("Multiple Networks, external clients sharing ip", func() {
/*
Here we test the scenario in which we have two different networks (net1,net2), each having
an external client, both sharing(serving) the same IP (e.g 1.2.3.4).
We expect to see that the endpoints of different EgressServices (each using a different network)
reach their "correct" external client when using the shared IP - that is when endpoints that back
the "net1" EgressService target the shared IP they reach the "net1" external client and when endpoints
that back the "net2" EgressService target the shared IP they reach the "net2" external client.
We do that by creating the container networks, attaching them to the nodes and creating routing tables
on the nodes that route the shared IP through the attached interface (for each network).
*/
const (
sharedIPv4 = "1.2.3.4"
sharedIPv6 = "1111:2222:3333:4444:5555:6666:7777:8888"
)
// netSettings contain the network parameters and is populated when the relevant container and k8s objects are created.
type netSettings struct {
name string // Name of the network
IPv4CIDR string // IPv4CIDR for the container network
IPv6CIDR string // IPv6CIDR for the container network
containerName string // Container name to create on the network
containerIPv4 string // IPv4 assigned to the created container
containerIPv6 string // IPv6 assigned to the created container
routingTable string // Routing table ID to set on nodes/EgressService
nodesV4IPs map[string]string // The v4 IPs of the nodes corresponding to this network
nodesV6IPs map[string]string // The v6 IPs of the nodes corresponding to this network
podLabels map[string]string // Labels to set on the pods for the network's Service
serviceName string // Name of the LB service corresponding to this network
serviceIP string // LoadBalancer ingress IP assigned to the Service
egressServiceYAML string // YAML file that holds the relevant EgressService
createdPods []string // Pods that were created for the Service
}
var (
net1 *netSettings
net2 *netSettings
)
ginkgo.BeforeEach(func() {
net1 = &netSettings{
name: "net1",
IPv4CIDR: "172.41.0.0/16",
IPv6CIDR: "fc00:f853:ccd:e401::/64",
containerName: "net1-external-container-for-egress-service",
routingTable: "101",
nodesV4IPs: map[string]string{},
nodesV6IPs: map[string]string{},
podLabels: map[string]string{"network": "net1"},
serviceName: "net1-service",
egressServiceYAML: "net1-egress_service.yaml",
createdPods: []string{},
}
net2 = &netSettings{
name: "net2",
IPv4CIDR: "172.42.0.0/16",
IPv6CIDR: "fc00:f853:ccd:e402::/64",
containerName: "net2-external-container-for-egress-service",
routingTable: "102",
nodesV4IPs: map[string]string{},
nodesV6IPs: map[string]string{},
podLabels: map[string]string{"network": "net2"},
serviceName: "net2-service",
egressServiceYAML: "net2-egress_service.yaml",
createdPods: []string{},
}