mirror of
https://github.com/traefik/traefik.git
synced 2025-09-20 13:21:19 +02:00
Make app protocol case insensitive
This commit is contained in:
parent
c60815ed08
commit
3b33ffa245
@ -59,3 +59,13 @@ spec:
|
||||
weight: 1
|
||||
kind: Service
|
||||
group: ""
|
||||
- name: whoami-HTTP
|
||||
port: 80
|
||||
weight: 1
|
||||
kind: Service
|
||||
group: ""
|
||||
- name: whoami-HTTPS
|
||||
port: 443
|
||||
weight: 1
|
||||
kind: Service
|
||||
group: ""
|
||||
|
@ -430,6 +430,80 @@ spec:
|
||||
name: wss
|
||||
appProtocol: kubernetes.io/wss
|
||||
|
||||
---
|
||||
kind: EndpointSlice
|
||||
apiVersion: discovery.k8s.io/v1
|
||||
metadata:
|
||||
name: whoami-HTTPS-abc
|
||||
namespace: default
|
||||
labels:
|
||||
kubernetes.io/service-name: whoami-HTTPS
|
||||
|
||||
addressType: IPv4
|
||||
ports:
|
||||
- name: websecure
|
||||
port: 8443
|
||||
endpoints:
|
||||
- addresses:
|
||||
- 10.10.0.16
|
||||
conditions:
|
||||
ready: true
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: whoami-HTTPS
|
||||
namespace: default
|
||||
|
||||
spec:
|
||||
ports:
|
||||
- name: websecure
|
||||
protocol: TCP
|
||||
appProtocol: HTTPS
|
||||
port: 443
|
||||
targetPort: websecure
|
||||
selector:
|
||||
app: containous
|
||||
task: whoami-HTTPS
|
||||
|
||||
---
|
||||
kind: EndpointSlice
|
||||
apiVersion: discovery.k8s.io/v1
|
||||
metadata:
|
||||
name: whoami-HTTP-abc
|
||||
namespace: default
|
||||
labels:
|
||||
kubernetes.io/service-name: whoami-HTTP
|
||||
|
||||
addressType: IPv4
|
||||
ports:
|
||||
- name: web
|
||||
port: 8080
|
||||
endpoints:
|
||||
- addresses:
|
||||
- 10.10.0.17
|
||||
conditions:
|
||||
ready: true
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: whoami-HTTP
|
||||
namespace: default
|
||||
|
||||
spec:
|
||||
ports:
|
||||
- name: web
|
||||
protocol: TCP
|
||||
port: 80
|
||||
appProtocol: HTTP
|
||||
targetPort: web
|
||||
selector:
|
||||
app: containous
|
||||
task: whoami-HTTP
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
|
@ -430,7 +430,7 @@ func getGRPCServiceProtocol(portSpec corev1.ServicePort) (string, error) {
|
||||
return schemeH2C, nil
|
||||
}
|
||||
|
||||
switch ap := *portSpec.AppProtocol; ap {
|
||||
switch ap := strings.ToLower(*portSpec.AppProtocol); ap {
|
||||
case appProtocolH2C:
|
||||
return schemeH2C, nil
|
||||
case appProtocolHTTPS:
|
||||
|
@ -817,7 +817,7 @@ func getHTTPServiceProtocol(portSpec corev1.ServicePort) (string, error) {
|
||||
return protocol, nil
|
||||
}
|
||||
|
||||
switch ap := *portSpec.AppProtocol; ap {
|
||||
switch ap := strings.ToLower(*portSpec.AppProtocol); ap {
|
||||
case appProtocolH2C:
|
||||
return schemeH2C, nil
|
||||
case appProtocolHTTP, appProtocolWS:
|
||||
|
@ -2959,6 +2959,14 @@ func TestLoadHTTPRoutes_backendExtensionRef(t *testing.T) {
|
||||
Name: "default-whoami-wss-http-80",
|
||||
Weight: ptr.To(1),
|
||||
},
|
||||
{
|
||||
Name: "default-whoami-HTTP-http-80",
|
||||
Weight: ptr.To(1),
|
||||
},
|
||||
{
|
||||
Name: "default-whoami-HTTPS-http-443",
|
||||
Weight: ptr.To(1),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
@ -3004,6 +3012,34 @@ func TestLoadHTTPRoutes_backendExtensionRef(t *testing.T) {
|
||||
},
|
||||
},
|
||||
},
|
||||
"default-whoami-HTTPS-http-443": {
|
||||
LoadBalancer: &dynamic.ServersLoadBalancer{
|
||||
Strategy: dynamic.BalancerStrategyWRR,
|
||||
Servers: []dynamic.Server{
|
||||
{
|
||||
URL: "https://10.10.0.16:8443",
|
||||
},
|
||||
},
|
||||
PassHostHeader: ptr.To(true),
|
||||
ResponseForwarding: &dynamic.ResponseForwarding{
|
||||
FlushInterval: ptypes.Duration(100 * time.Millisecond),
|
||||
},
|
||||
},
|
||||
},
|
||||
"default-whoami-HTTP-http-80": {
|
||||
LoadBalancer: &dynamic.ServersLoadBalancer{
|
||||
Strategy: dynamic.BalancerStrategyWRR,
|
||||
Servers: []dynamic.Server{
|
||||
{
|
||||
URL: "http://10.10.0.17:8080",
|
||||
},
|
||||
},
|
||||
PassHostHeader: ptr.To(true),
|
||||
ResponseForwarding: &dynamic.ResponseForwarding{
|
||||
FlushInterval: ptypes.Duration(100 * time.Millisecond),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
ServersTransports: map[string]*dynamic.ServersTransport{},
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user