Correct Kubernetes Ingress and IngressRoute port heuristic for choosing HTTPS
This commit is contained in:
parent
5731ae7f47
commit
2895ad21f3
7 changed files with 11 additions and 9 deletions
|
@ -68,6 +68,7 @@ spec:
|
||||||
ports:
|
ports:
|
||||||
- name: web-secure
|
- name: web-secure
|
||||||
port: 443
|
port: 443
|
||||||
|
targetPort: 8443
|
||||||
selector:
|
selector:
|
||||||
app: containous
|
app: containous
|
||||||
task: whoami2
|
task: whoami2
|
||||||
|
@ -85,7 +86,7 @@ subsets:
|
||||||
- ip: 10.10.0.6
|
- ip: 10.10.0.6
|
||||||
ports:
|
ports:
|
||||||
- name: web-secure
|
- name: web-secure
|
||||||
port: 443
|
port: 8443
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
|
|
|
@ -273,7 +273,7 @@ func loadServers(client Client, namespace string, svc v1alpha1.Service) ([]dynam
|
||||||
case "http", "https", "h2c":
|
case "http", "https", "h2c":
|
||||||
protocol = svc.Scheme
|
protocol = svc.Scheme
|
||||||
case "":
|
case "":
|
||||||
if port == 443 || strings.HasPrefix(portSpec.Name, "https") {
|
if portSpec.Port == 443 || strings.HasPrefix(portSpec.Name, "https") {
|
||||||
protocol = "https"
|
protocol = "https"
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -1324,10 +1324,10 @@ func TestLoadIngressRoutes(t *testing.T) {
|
||||||
LoadBalancer: &dynamic.LoadBalancerService{
|
LoadBalancer: &dynamic.LoadBalancerService{
|
||||||
Servers: []dynamic.Server{
|
Servers: []dynamic.Server{
|
||||||
{
|
{
|
||||||
URL: "https://10.10.0.5:443",
|
URL: "https://10.10.0.5:8443",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
URL: "https://10.10.0.6:443",
|
URL: "https://10.10.0.6:8443",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
PassHostHeader: true,
|
PassHostHeader: true,
|
||||||
|
|
|
@ -8,8 +8,8 @@ subsets:
|
||||||
- addresses:
|
- addresses:
|
||||||
- ip: 10.10.0.1
|
- ip: 10.10.0.1
|
||||||
ports:
|
ports:
|
||||||
- port: 443
|
- port: 8443
|
||||||
- addresses:
|
- addresses:
|
||||||
- ip: 10.21.0.1
|
- ip: 10.21.0.1
|
||||||
ports:
|
ports:
|
||||||
- port: 443
|
- port: 8443
|
||||||
|
|
|
@ -7,4 +7,5 @@ metadata:
|
||||||
spec:
|
spec:
|
||||||
ports:
|
ports:
|
||||||
- port: 443
|
- port: 443
|
||||||
|
targetPort: 8443
|
||||||
clusterIp: 10.0.0.1
|
clusterIp: 10.0.0.1
|
||||||
|
|
|
@ -216,7 +216,7 @@ func loadService(client Client, namespace string, backend v1beta1.IngressBackend
|
||||||
}
|
}
|
||||||
|
|
||||||
protocol := "http"
|
protocol := "http"
|
||||||
if port == 443 || strings.HasPrefix(portName, "https") {
|
if portSpec.Port == 443 || strings.HasPrefix(portName, "https") {
|
||||||
protocol = "https"
|
protocol = "https"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -732,10 +732,10 @@ func TestLoadConfigurationFromIngresses(t *testing.T) {
|
||||||
PassHostHeader: true,
|
PassHostHeader: true,
|
||||||
Servers: []dynamic.Server{
|
Servers: []dynamic.Server{
|
||||||
{
|
{
|
||||||
URL: "https://10.10.0.1:443",
|
URL: "https://10.10.0.1:8443",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
URL: "https://10.21.0.1:443",
|
URL: "https://10.21.0.1:8443",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue