1
0
Fork 0

Merge branch v3.4 into v3.5

This commit is contained in:
kevinpollet 2025-07-11 10:29:18 +02:00
commit ff992fb7f9
No known key found for this signature in database
GPG key ID: 0C9A5DDD1B292453
41 changed files with 3830 additions and 66 deletions

View file

@ -301,6 +301,38 @@ spec:
type: ClusterIP
clusterIP: 10.10.0.1
---
apiVersion: v1
kind: Service
metadata:
name: native-disabled-svc
namespace: default
spec:
ports:
- name: web
port: 80
type: ClusterIP
clusterIP: 10.10.0.1
---
kind: EndpointSlice
apiVersion: discovery.k8s.io/v1
metadata:
name: native-disabled-svc-abc
namespace: default
labels:
kubernetes.io/service-name: native-disabled-svc
addressType: IPv4
ports:
- name: web
port: 80
endpoints:
- addresses:
- 10.10.0.20
- 10.10.0.21
conditions:
ready: true
---
apiVersion: v1
kind: Service

View file

@ -298,11 +298,46 @@ metadata:
spec:
ports:
- name: myapp
port: 8000
- name: tcp
protocol: TCP
port: 9000
type: ClusterIP
clusterIP: 10.10.0.1
---
apiVersion: v1
kind: Service
metadata:
name: native-disabled-svc-tcp
namespace: default
spec:
ports:
- name: tcp
protocol: TCP
port: 9000
type: ClusterIP
clusterIP: 10.10.0.1
---
kind: EndpointSlice
apiVersion: discovery.k8s.io/v1
metadata:
name: native-disabled-tcp-abc
namespace: default
labels:
kubernetes.io/service-name: native-disabled-svc-tcp
addressType: IPv4
ports:
- name: tcp
protocol: TCP
port: 9000
endpoints:
- addresses:
- 10.10.0.30
- 10.10.0.31
conditions:
ready: true
---
apiVersion: v1
kind: Service

View file

@ -12,4 +12,4 @@ spec:
- match: HostSNI(`foo.com`)
services:
- name: native-svc-tcp
port: 8000
port: 9000

View file

@ -12,5 +12,5 @@ spec:
- match: HostSNI(`foo.com`)
services:
- name: native-svc-tcp
port: 8000
port: 9000
nativeLB: true

View file

@ -0,0 +1,12 @@
apiVersion: traefik.io/v1alpha1
kind: IngressRouteTCP
metadata:
name: tcp.route.native-disabled
namespace: default
spec:
routes:
- match: HostSNI(`foo.com`)
services:
- name: native-disabled-svc-tcp
port: 9000
nativeLB: false

View file

@ -252,11 +252,46 @@ metadata:
spec:
ports:
- name: myapp
- name: udp
protocol: UDP
port: 8000
type: ClusterIP
clusterIP: 10.10.0.1
---
apiVersion: v1
kind: Service
metadata:
name: native-disabled-svc-udp
namespace: default
spec:
ports:
- name: udp
protocol: UDP
port: 8000
type: ClusterIP
clusterIP: 10.10.0.1
---
kind: EndpointSlice
apiVersion: discovery.k8s.io/v1
metadata:
name: native-disabled-udp-abc
namespace: default
labels:
kubernetes.io/service-name: native-disabled-svc-udp
addressType: IPv4
ports:
- name: udp
protocol: UDP
port: 8000
endpoints:
- addresses:
- 10.10.0.30
- 10.10.0.31
conditions:
ready: true
---
apiVersion: v1
kind: Service

View file

@ -0,0 +1,11 @@
apiVersion: traefik.io/v1alpha1
kind: IngressRouteUDP
metadata:
name: udp.route.native-disabled
namespace: default
spec:
routes:
- services:
- name: native-disabled-svc-udp
port: 8000
nativeLB: false

View file

@ -0,0 +1,13 @@
apiVersion: traefik.io/v1alpha1
kind: IngressRoute
metadata:
name: test.route.native-disabled
namespace: default
spec:
routes:
- match: Host(`foo.com`)
kind: Rule
services:
- name: native-disabled-svc
port: 80
nativeLB: false

View file

@ -7778,7 +7778,7 @@ func TestNativeLB(t *testing.T) {
LoadBalancer: &dynamic.TCPServersLoadBalancer{
Servers: []dynamic.TCPServer{
{
Address: "10.10.0.1:8000",
Address: "10.10.0.1:9000",
Port: "",
},
},
@ -8375,6 +8375,52 @@ func TestGlobalNativeLB(t *testing.T) {
TLS: &dynamic.TLSConfiguration{},
},
},
{
desc: "HTTP with global native Service LB but service reference has nativeLB disabled",
paths: []string{"services.yml", "with_native_service_lb_disabled.yml"},
NativeLBByDefault: true,
expected: &dynamic.Configuration{
UDP: &dynamic.UDPConfiguration{
Routers: map[string]*dynamic.UDPRouter{},
Services: map[string]*dynamic.UDPService{},
},
TCP: &dynamic.TCPConfiguration{
ServersTransports: map[string]*dynamic.TCPServersTransport{},
Routers: map[string]*dynamic.TCPRouter{},
Middlewares: map[string]*dynamic.TCPMiddleware{},
Services: map[string]*dynamic.TCPService{},
},
HTTP: &dynamic.HTTPConfiguration{
ServersTransports: map[string]*dynamic.ServersTransport{},
Routers: map[string]*dynamic.Router{
"default-test-route-native-disabled-6f97418635c7e18853da": {
Service: "default-test-route-native-disabled-6f97418635c7e18853da",
Rule: "Host(`foo.com`)",
Priority: 0,
},
},
Middlewares: map[string]*dynamic.Middleware{},
Services: map[string]*dynamic.Service{
"default-test-route-native-disabled-6f97418635c7e18853da": {
LoadBalancer: &dynamic.ServersLoadBalancer{
Strategy: dynamic.BalancerStrategyWRR,
ResponseForwarding: &dynamic.ResponseForwarding{FlushInterval: dynamic.DefaultFlushInterval},
Servers: []dynamic.Server{
{
URL: "http://10.10.0.20:80",
},
{
URL: "http://10.10.0.21:80",
},
},
PassHostHeader: pointer(true),
},
},
},
},
TLS: &dynamic.TLSConfiguration{},
},
},
{
desc: "HTTP with native Service LB in ingressroute",
paths: []string{"services.yml", "with_native_service_lb.yml"},
@ -8448,7 +8494,51 @@ func TestGlobalNativeLB(t *testing.T) {
LoadBalancer: &dynamic.TCPServersLoadBalancer{
Servers: []dynamic.TCPServer{
{
Address: "10.10.0.1:8000",
Address: "10.10.0.1:9000",
Port: "",
},
},
},
},
},
},
TLS: &dynamic.TLSConfiguration{},
},
},
{
desc: "TCP with global native Service LB but service reference has nativeLB disabled",
paths: []string{"tcp/services.yml", "tcp/with_native_service_lb_disabled.yml"},
NativeLBByDefault: true,
expected: &dynamic.Configuration{
UDP: &dynamic.UDPConfiguration{
Routers: map[string]*dynamic.UDPRouter{},
Services: map[string]*dynamic.UDPService{},
},
HTTP: &dynamic.HTTPConfiguration{
ServersTransports: map[string]*dynamic.ServersTransport{},
Routers: map[string]*dynamic.Router{},
Middlewares: map[string]*dynamic.Middleware{},
Services: map[string]*dynamic.Service{},
},
TCP: &dynamic.TCPConfiguration{
ServersTransports: map[string]*dynamic.TCPServersTransport{},
Routers: map[string]*dynamic.TCPRouter{
"default-tcp.route.native-disabled-fdd3e9338e47a45efefc": {
Service: "default-tcp.route.native-disabled-fdd3e9338e47a45efefc",
Rule: "HostSNI(`foo.com`)",
},
},
Middlewares: map[string]*dynamic.TCPMiddleware{},
Services: map[string]*dynamic.TCPService{
"default-tcp.route.native-disabled-fdd3e9338e47a45efefc": {
LoadBalancer: &dynamic.TCPServersLoadBalancer{
Servers: []dynamic.TCPServer{
{
Address: "10.10.0.30:9000",
Port: "",
},
{
Address: "10.10.0.31:9000",
Port: "",
},
},
@ -8488,7 +8578,7 @@ func TestGlobalNativeLB(t *testing.T) {
LoadBalancer: &dynamic.TCPServersLoadBalancer{
Servers: []dynamic.TCPServer{
{
Address: "10.10.0.1:8000",
Address: "10.10.0.1:9000",
Port: "",
},
},
@ -8578,6 +8668,49 @@ func TestGlobalNativeLB(t *testing.T) {
TLS: &dynamic.TLSConfiguration{},
},
},
{
desc: "UDP with global native Service LB but service reference has nativeLB disabled",
paths: []string{"udp/services.yml", "udp/with_native_service_lb_disabled.yml"},
NativeLBByDefault: true,
expected: &dynamic.Configuration{
UDP: &dynamic.UDPConfiguration{
Routers: map[string]*dynamic.UDPRouter{
"default-udp.route.native-disabled-0": {
Service: "default-udp.route.native-disabled-0",
},
},
Services: map[string]*dynamic.UDPService{
"default-udp.route.native-disabled-0": {
LoadBalancer: &dynamic.UDPServersLoadBalancer{
Servers: []dynamic.UDPServer{
{
Address: "10.10.0.30:8000",
Port: "",
},
{
Address: "10.10.0.31:8000",
Port: "",
},
},
},
},
},
},
HTTP: &dynamic.HTTPConfiguration{
ServersTransports: map[string]*dynamic.ServersTransport{},
Routers: map[string]*dynamic.Router{},
Middlewares: map[string]*dynamic.Middleware{},
Services: map[string]*dynamic.Service{},
},
TCP: &dynamic.TCPConfiguration{
ServersTransports: map[string]*dynamic.TCPServersTransport{},
Routers: map[string]*dynamic.TCPRouter{},
Middlewares: map[string]*dynamic.TCPMiddleware{},
Services: map[string]*dynamic.TCPService{},
},
TLS: &dynamic.TLSConfiguration{},
},
},
}
for _, test := range testCases {
@ -8595,8 +8728,6 @@ func TestGlobalNativeLB(t *testing.T) {
objects := k8s.MustParseYaml(yamlContent)
for _, obj := range objects {
switch o := obj.(type) {
case *corev1.Service, *corev1.Endpoints, *corev1.Secret:
k8sObjects = append(k8sObjects, o)
case *traefikv1alpha1.IngressRoute:
crdObjects = append(crdObjects, o)
case *traefikv1alpha1.IngressRouteTCP:
@ -8612,6 +8743,7 @@ func TestGlobalNativeLB(t *testing.T) {
case *traefikv1alpha1.TLSStore:
crdObjects = append(crdObjects, o)
default:
k8sObjects = append(k8sObjects, o)
}
}
}