1- #!
1+ #! --lb-test-fault-probability=0.0
22
33# Start the test application
44hive start
55
66# Create a LoadBalancer service with Local traffic policies and associate two backends
77# to it, one of them on this node ("testnode") and one on another node.
8- k8s/add service_tp_local .yaml endpointslice.yaml
9- db/cmp services services.table
10- db/cmp frontends frontends.table
11- db/cmp backends backends.table
8+ k8s/add service-local .yaml endpointslice.yaml
9+ db/cmp services services-local .table
10+ db/cmp frontends frontends-local .table
11+ db/cmp backends backends.table
1212
13- # Check the BPF maps
14- lb/maps-dump lbmaps.actual
15- * cmp lbmaps.actual lbmaps.expected
13+ lb/maps-dump lbmaps-local.actual
14+ * cmp lbmaps-local.actual lbmaps-local.expected
1615
17- # Update service to have mixed traffic policy
18- k8s/update service_tp_mixed.yaml
19- db/cmp services services_tp_mixed.table
16+ # Update service to have mixed traffic policy, with eTP=Cluster, iTP=Local
17+ k8s/update service-mixed1.yaml
18+ db/cmp services services-mixed1.table
19+ db/cmp frontends frontends-mixed1.table
2020
21- # Check the BPF maps. We should now have an external and internal frontends
22- # with matching traffic policies.
23- lb/maps-dump lbmaps.actual
24- * cmp lbmaps.actual lbmaps_tp_mixed.expected
21+ lb/maps-dump lbmaps-mixed1.actual
22+ * cmp lbmaps-mixed1.actual lbmaps-mixed1.expected
23+
24+ # Update service so the mixed traffic policy is reversed, with eTP=Local, iTP=Cluster
25+ k8s/update service-mixed2.yaml
26+ db/cmp services services-mixed2.table
27+ db/cmp frontends frontends-mixed2.table
28+
29+ lb/maps-dump lbmaps-mixed2.actual
30+ * cmp lbmaps-mixed2.actual lbmaps-mixed2.expected
31+
32+ # Update service so we now have a consistent policy of eTP/iTP=Cluster
33+ k8s/update service-cluster.yaml
34+ db/cmp services services-cluster.table
35+ db/cmp frontends frontends-cluster.table
36+
37+ lb/maps-dump lbmaps-cluster.actual
38+ * cmp lbmaps-cluster.actual lbmaps-cluster.expected
2539
2640#####
2741
28- -- services.table --
42+ -- services-local .table --
2943Name Source PortNames TrafficPolicy Flags
3044test/echo k8s http=80 Local
31-
32- -- services_tp_mixed.table --
45+ -- services-mixed1.table --
3346Name Source PortNames TrafficPolicy Flags
3447test/echo k8s http=80 Ext=Cluster, Int=Local
35-
36- -- frontends.table --
37- Address Type ServiceName PortName Backends Status
38- 1.1.1.1:80/TCP LoadBalancer test/echo http 10.244.1.1:80/TCP Done
39- 10.96.50.104:80/TCP ClusterIP test/echo http 10.244.1.1:80/TCP Done
40-
48+ -- services-mixed2.table --
49+ Name Source PortNames TrafficPolicy Flags
50+ test/echo k8s http=80 Ext=Local, Int=Cluster
51+ -- services-cluster.table --
52+ Name Source PortNames TrafficPolicy Flags
53+ test/echo k8s http=80 Cluster
54+ -- frontends-local.table --
55+ Address Type ServiceName PortName Backends RedirectTo Status
56+ 1.1.1.1:80/TCP LoadBalancer test/echo http 10.244.1.1:80/TCP Done
57+ 10.96.50.104:80/TCP ClusterIP test/echo http 10.244.1.1:80/TCP Done
58+ -- frontends-mixed1.table --
59+ Address Type ServiceName PortName Backends RedirectTo Status
60+ 1.1.1.1:80/TCP LoadBalancer test/echo http 10.244.1.1:80/TCP, 10.244.2.1:80/TCP Done
61+ 1.1.1.1:80/TCP/i LoadBalancer test/echo http 10.244.1.1:80/TCP Done
62+ 10.96.50.104:80/TCP ClusterIP test/echo http 10.244.1.1:80/TCP Done
63+ -- frontends-mixed2.table --
64+ Address Type ServiceName PortName Backends RedirectTo Status
65+ 1.1.1.1:80/TCP LoadBalancer test/echo http 10.244.1.1:80/TCP Done
66+ 1.1.1.1:80/TCP/i LoadBalancer test/echo http 10.244.1.1:80/TCP, 10.244.2.1:80/TCP Done
67+ 10.96.50.104:80/TCP ClusterIP test/echo http 10.244.1.1:80/TCP, 10.244.2.1:80/TCP Done
68+ -- frontends-cluster.table --
69+ Address Type ServiceName PortName Backends RedirectTo Status
70+ 1.1.1.1:80/TCP LoadBalancer test/echo http 10.244.1.1:80/TCP, 10.244.2.1:80/TCP Done
71+ 10.96.50.104:80/TCP ClusterIP test/echo http 10.244.1.1:80/TCP, 10.244.2.1:80/TCP Done
4172-- backends.table --
4273Service Address NodeName
4374test/echo 10.244.1.1:80/TCP testnode
4475test/echo 10.244.2.1:80/TCP othernode
4576
46- -- service_tp_local .yaml --
77+ -- service-local .yaml --
4778apiVersion: v1
4879kind: Service
4980metadata:
@@ -70,7 +101,7 @@ status:
70101 ingress:
71102 - ip: 1.1.1.1
72103
73- -- service_tp_mixed .yaml --
104+ -- service-mixed1 .yaml --
74105apiVersion: v1
75106kind: Service
76107metadata:
@@ -97,6 +128,60 @@ status:
97128 ingress:
98129 - ip: 1.1.1.1
99130
131+ -- service-mixed2.yaml --
132+ apiVersion: v1
133+ kind: Service
134+ metadata:
135+ name: echo
136+ namespace: test
137+ resourceVersion: "741"
138+ uid: a49fe99c-3564-4754-acc4-780f2331a49b
139+ spec:
140+ clusterIP: 10.96.50.104
141+ clusterIPs:
142+ - 10.96.50.104
143+ externalTrafficPolicy: Local
144+ internalTrafficPolicy: Cluster
145+ ports:
146+ - name: http
147+ port: 80
148+ protocol: TCP
149+ targetPort: 80
150+ selector:
151+ name: echo
152+ type: LoadBalancer
153+ status:
154+ loadBalancer:
155+ ingress:
156+ - ip: 1.1.1.1
157+
158+ -- service-cluster.yaml --
159+ apiVersion: v1
160+ kind: Service
161+ metadata:
162+ name: echo
163+ namespace: test
164+ resourceVersion: "741"
165+ uid: a49fe99c-3564-4754-acc4-780f2331a49b
166+ spec:
167+ clusterIP: 10.96.50.104
168+ clusterIPs:
169+ - 10.96.50.104
170+ externalTrafficPolicy: Cluster
171+ internalTrafficPolicy: Cluster
172+ ports:
173+ - name: http
174+ port: 80
175+ protocol: TCP
176+ targetPort: 80
177+ selector:
178+ name: echo
179+ type: LoadBalancer
180+ status:
181+ loadBalancer:
182+ ingress:
183+ - ip: 1.1.1.1
184+
100185-- endpointslice.yaml --
101186apiVersion: discovery.k8s.io/v1
102187kind: EndpointSlice
@@ -116,21 +201,19 @@ endpoints:
116201 serving: true
117202 terminating: false
118203 nodeName: testnode
119-
120204- addresses:
121205 - 10.244.2.1
122206 conditions:
123207 ready: true
124208 serving: true
125209 terminating: false
126210 nodeName: othernode
127-
128211ports:
129212- name: http
130213 port: 80
131214 protocol: TCP
132215
133- -- lbmaps.expected --
216+ -- lbmaps-local .expected --
134217BE: ID=1 ADDR=10.244.1.1:80/TCP STATE=active
135218REV: ID=1 ADDR=1.1.1.1:80
136219REV: ID=2 ADDR=10.96.50.104:80
@@ -140,7 +223,7 @@ SVC: ID=1 ADDR=1.1.1.1:80/TCP SLOT=0 LBALG=undef AFFTimeout=0 COUNT=1 QCOUNT=0 F
140223SVC: ID=1 ADDR=1.1.1.1:80/TCP SLOT=1 BEID=1 COUNT=0 QCOUNT=0 FLAGS=LoadBalancer+Local+InternalLocal
141224SVC: ID=2 ADDR=10.96.50.104:80/TCP SLOT=0 LBALG=undef AFFTimeout=0 COUNT=1 QCOUNT=0 FLAGS=ClusterIP+Local+InternalLocal+non-routable
142225SVC: ID=2 ADDR=10.96.50.104:80/TCP SLOT=1 BEID=1 COUNT=0 QCOUNT=0 FLAGS=ClusterIP+Local+InternalLocal+non-routable
143- -- lbmaps_tp_mixed .expected --
226+ -- lbmaps-mixed1 .expected --
144227BE: ID=1 ADDR=10.244.1.1:80/TCP STATE=active
145228BE: ID=2 ADDR=10.244.2.1:80/TCP STATE=active
146229REV: ID=1 ADDR=1.1.1.1:80
@@ -155,3 +238,32 @@ SVC: ID=2 ADDR=10.96.50.104:80/TCP SLOT=0 LBALG=undef AFFTimeout=0 COUNT=1 QCOUN
155238SVC: ID=2 ADDR=10.96.50.104:80/TCP SLOT=1 BEID=1 COUNT=0 QCOUNT=0 FLAGS=ClusterIP+InternalLocal+non-routable
156239SVC: ID=3 ADDR=1.1.1.1:80/TCP/i SLOT=0 LBALG=undef AFFTimeout=0 COUNT=1 QCOUNT=0 FLAGS=LoadBalancer+InternalLocal+two-scopes
157240SVC: ID=3 ADDR=1.1.1.1:80/TCP/i SLOT=1 BEID=1 COUNT=0 QCOUNT=0 FLAGS=LoadBalancer+InternalLocal+two-scopes
241+ -- lbmaps-mixed2.expected --
242+ BE: ID=1 ADDR=10.244.1.1:80/TCP STATE=active
243+ BE: ID=3 ADDR=10.244.2.1:80/TCP STATE=active
244+ REV: ID=1 ADDR=1.1.1.1:80
245+ REV: ID=2 ADDR=10.96.50.104:80
246+ REV: ID=3 ADDR=1.1.1.1:80
247+ SVC: ID=0 ADDR=1.1.1.1:0/ANY SLOT=0 LBALG=undef AFFTimeout=0 COUNT=0 QCOUNT=0 FLAGS=LoadBalancer+non-routable
248+ SVC: ID=0 ADDR=10.96.50.104:0/ANY SLOT=0 LBALG=undef AFFTimeout=0 COUNT=0 QCOUNT=0 FLAGS=ClusterIP+non-routable
249+ SVC: ID=1 ADDR=1.1.1.1:80/TCP SLOT=0 LBALG=undef AFFTimeout=0 COUNT=1 QCOUNT=0 FLAGS=LoadBalancer+Local+two-scopes
250+ SVC: ID=1 ADDR=1.1.1.1:80/TCP SLOT=1 BEID=1 COUNT=0 QCOUNT=0 FLAGS=LoadBalancer+Local+two-scopes
251+ SVC: ID=2 ADDR=10.96.50.104:80/TCP SLOT=0 LBALG=undef AFFTimeout=0 COUNT=2 QCOUNT=0 FLAGS=ClusterIP+Local+non-routable
252+ SVC: ID=2 ADDR=10.96.50.104:80/TCP SLOT=1 BEID=1 COUNT=0 QCOUNT=0 FLAGS=ClusterIP+Local+non-routable
253+ SVC: ID=2 ADDR=10.96.50.104:80/TCP SLOT=2 BEID=3 COUNT=0 QCOUNT=0 FLAGS=ClusterIP+Local+non-routable
254+ SVC: ID=3 ADDR=1.1.1.1:80/TCP/i SLOT=0 LBALG=undef AFFTimeout=0 COUNT=2 QCOUNT=0 FLAGS=LoadBalancer+Local+two-scopes
255+ SVC: ID=3 ADDR=1.1.1.1:80/TCP/i SLOT=1 BEID=1 COUNT=0 QCOUNT=0 FLAGS=LoadBalancer+Local+two-scopes
256+ SVC: ID=3 ADDR=1.1.1.1:80/TCP/i SLOT=2 BEID=3 COUNT=0 QCOUNT=0 FLAGS=LoadBalancer+Local+two-scopes
257+ -- lbmaps-cluster.expected --
258+ BE: ID=1 ADDR=10.244.1.1:80/TCP STATE=active
259+ BE: ID=3 ADDR=10.244.2.1:80/TCP STATE=active
260+ REV: ID=1 ADDR=1.1.1.1:80
261+ REV: ID=2 ADDR=10.96.50.104:80
262+ SVC: ID=0 ADDR=1.1.1.1:0/ANY SLOT=0 LBALG=undef AFFTimeout=0 COUNT=0 QCOUNT=0 FLAGS=LoadBalancer+non-routable
263+ SVC: ID=0 ADDR=10.96.50.104:0/ANY SLOT=0 LBALG=undef AFFTimeout=0 COUNT=0 QCOUNT=0 FLAGS=ClusterIP+non-routable
264+ SVC: ID=1 ADDR=1.1.1.1:80/TCP SLOT=0 LBALG=undef AFFTimeout=0 COUNT=2 QCOUNT=0 FLAGS=LoadBalancer
265+ SVC: ID=1 ADDR=1.1.1.1:80/TCP SLOT=1 BEID=1 COUNT=0 QCOUNT=0 FLAGS=LoadBalancer
266+ SVC: ID=1 ADDR=1.1.1.1:80/TCP SLOT=2 BEID=3 COUNT=0 QCOUNT=0 FLAGS=LoadBalancer
267+ SVC: ID=2 ADDR=10.96.50.104:80/TCP SLOT=0 LBALG=undef AFFTimeout=0 COUNT=2 QCOUNT=0 FLAGS=ClusterIP+non-routable
268+ SVC: ID=2 ADDR=10.96.50.104:80/TCP SLOT=1 BEID=1 COUNT=0 QCOUNT=0 FLAGS=ClusterIP+non-routable
269+ SVC: ID=2 ADDR=10.96.50.104:80/TCP SLOT=2 BEID=3 COUNT=0 QCOUNT=0 FLAGS=ClusterIP+non-routable
0 commit comments