Skip to content

Commit 9adbbaf

Browse files
committed
routing: fix missing support for '+' notation of hostnames
1 parent 2a2baf8 commit 9adbbaf

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

pkg/resourcegenerator/istio/virtualservice/routing.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,18 @@ func generateForRouting(r reconciliation.Reconciliation) error {
3030
},
3131
}
3232

33+
h, err := routing.Spec.GetHost()
34+
if err != nil || h == nil {
35+
return fmt.Errorf("failed to get host from routing: %w", err)
36+
}
37+
3338
virtualService.Spec = networkingv1api.VirtualService{
3439
ExportTo: []string{".", "istio-system", "istio-gateways"},
3540
Gateways: []string{
3641
routing.GetGatewayName(),
3742
},
3843
Hosts: []string{
39-
routing.Spec.Hostname,
44+
h.Hostname,
4045
},
4146
Http: []*networkingv1api.HTTPRoute{},
4247
}

tests/routing/custom-certificate/routing-assert.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,3 +38,34 @@ spec:
3838
tls:
3939
credentialName: some-cert
4040
mode: SIMPLE
41+
---
42+
apiVersion: networking.istio.io/v1
43+
kind: VirtualService
44+
metadata:
45+
name: some-routing-routing-ingress
46+
spec:
47+
exportTo:
48+
- .
49+
- istio-system
50+
- istio-gateways
51+
gateways:
52+
- some-routing-routing-ingress
53+
hosts:
54+
- example.com
55+
http:
56+
- match:
57+
- port: 80
58+
name: redirect-to-https
59+
redirect:
60+
redirectCode: 308
61+
scheme: https
62+
- match:
63+
- port: 443
64+
uri:
65+
prefix: /app1
66+
name: some-app
67+
route:
68+
- destination:
69+
host: some-app
70+
port:
71+
number: 8081

0 commit comments

Comments
 (0)