Skip to content

Commit 8da7a09

Browse files
Modify routes for acaas
Signed-off-by: Arnob Kumar Saha <arnob@appscode.com>
1 parent 423e48c commit 8da7a09

13 files changed

Lines changed: 114 additions & 21 deletions

File tree

charts/acaas/templates/blog/route.yaml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,13 @@ spec:
2323
type: PathPrefix
2424
value: /blog
2525
backendRefs:
26-
- group: ""
27-
kind: Service
26+
- group: gateway.envoyproxy.io
27+
kind: Backend
2828
name: blog
29-
namespace: {{ .Release.Namespace }}
3029
port: 443
3130
weight: 1
31+
filters:
32+
- type: URLRewrite
33+
urlRewrite:
34+
hostname: {{ .Values.gateway.rules.blog.upstream }}
3235
{{- end }}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
{{- if eq (toString .Values.global.platform.deploymentType) "Hosted" }}
1+
{{- if and (eq (toString .Values.global.platform.deploymentType) "Hosted") (index .Values "ingress" "enabled") }}
22
apiVersion: v1
33
kind: Service
44
metadata:
55
name: blog
66
namespace: {{ .Release.Namespace }}
77
spec:
8-
externalName: {{ if .Values.gateway.enabled }}{{ .Values.gateway.rules.blog.upstream }}{{ else }}{{ .Values.ingress.rules.blog.upstream }}{{ end }}
8+
externalName: {{ .Values.ingress.rules.blog.upstream }}
99
sessionAffinity: None
1010
type: ExternalName
1111
{{- end }}

charts/acaas/templates/docs/route.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,13 @@ spec:
2323
type: PathPrefix
2424
value: /docs
2525
backendRefs:
26-
- kind: Service
26+
- group: gateway.envoyproxy.io
27+
kind: Backend
2728
name: docs
28-
namespace: {{ .Release.Namespace }}
2929
port: 443
30+
weight: 1
31+
filters:
32+
- type: URLRewrite
33+
urlRewrite:
34+
hostname: {{ .Values.gateway.rules.docs.upstream }}
3035
{{- end }}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
{{- if eq (toString .Values.global.platform.deploymentType) "Hosted" }}
1+
{{- if and (eq (toString .Values.global.platform.deploymentType) "Hosted") (index .Values "ingress" "enabled") }}
22
apiVersion: v1
33
kind: Service
44
metadata:
55
name: docs
66
namespace: {{ .Release.Namespace }}
77
spec:
8-
externalName: {{ if .Values.gateway.enabled }}{{ .Values.gateway.rules.docs.upstream }}{{ else }}{{ .Values.ingress.rules.docs.upstream }}{{ end }}
8+
externalName: {{ .Values.ingress.rules.docs.upstream }}
99
sessionAffinity: None
1010
type: ExternalName
1111
{{- end }}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
{{- if and (eq (toString .Values.global.platform.deploymentType) "Hosted") (index .Values "gateway" "enabled") }}
2+
{{- range $name, $rule := .Values.gateway.rules }}
3+
---
4+
# Backend: resolves the external upstream by FQDN so Envoy uses a STRICT_DNS
5+
# cluster instead of Kubernetes EndpointSlices. An ExternalName Service has no
6+
# EndpointSlices, so plain backendRefs -> Service report zero ready endpoints.
7+
# Requires extensionApis.enableBackend: true in the EnvoyGateway config.
8+
apiVersion: gateway.envoyproxy.io/v1alpha1
9+
kind: Backend
10+
metadata:
11+
{{- with $.Values.gateway.annotations }}
12+
annotations:
13+
{{- toYaml . | nindent 4 }}
14+
{{- end }}
15+
name: {{ $name }}
16+
namespace: {{ $.Release.Namespace }}
17+
spec:
18+
endpoints:
19+
- fqdn:
20+
hostname: {{ $rule.upstream }}
21+
port: 443
22+
---
23+
# BackendTLSPolicy: makes Envoy originate TLS to the Backend above. Without it
24+
# Envoy connects in plaintext on 443 and the upstream (which terminates TLS on
25+
# that port) resets the connection with a protocol_error.
26+
apiVersion: gateway.networking.k8s.io/v1alpha3
27+
kind: BackendTLSPolicy
28+
metadata:
29+
{{- with $.Values.gateway.annotations }}
30+
annotations:
31+
{{- toYaml . | nindent 4 }}
32+
{{- end }}
33+
name: {{ $name }}
34+
namespace: {{ $.Release.Namespace }}
35+
spec:
36+
targetRefs:
37+
- group: gateway.envoyproxy.io
38+
kind: Backend
39+
name: {{ $name }}
40+
validation:
41+
hostname: {{ $rule.upstream }}
42+
wellKnownCACertificates: System
43+
{{- end }}
44+
{{- end }}

charts/acaas/templates/learn/route.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,13 @@ spec:
2323
type: PathPrefix
2424
value: /learn
2525
backendRefs:
26-
- kind: Service
26+
- group: gateway.envoyproxy.io
27+
kind: Backend
2728
name: learn
28-
namespace: {{ .Release.Namespace }}
2929
port: 443
30+
weight: 1
31+
filters:
32+
- type: URLRewrite
33+
urlRewrite:
34+
hostname: {{ .Values.gateway.rules.learn.upstream }}
3035
{{- end }}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
{{- if eq (toString .Values.global.platform.deploymentType) "Hosted" }}
1+
{{- if and (eq (toString .Values.global.platform.deploymentType) "Hosted") (index .Values "ingress" "enabled") }}
22
apiVersion: v1
33
kind: Service
44
metadata:
55
name: learn
66
namespace: {{ .Release.Namespace }}
77
spec:
8-
externalName: {{ if .Values.gateway.enabled }}{{ .Values.gateway.rules.learn.upstream }}{{ else }}{{ .Values.ingress.rules.learn.upstream }}{{ end }}
8+
externalName: {{ .Values.ingress.rules.learn.upstream }}
99
sessionAffinity: None
1010
type: ExternalName
1111
{{- end }}

charts/acaas/templates/license/route.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,13 @@ spec:
2323
type: PathPrefix
2424
value: /issue-license
2525
backendRefs:
26-
- kind: Service
26+
- group: gateway.envoyproxy.io
27+
kind: Backend
2728
name: license
28-
namespace: {{ .Release.Namespace }}
2929
port: 443
30+
weight: 1
31+
filters:
32+
- type: URLRewrite
33+
urlRewrite:
34+
hostname: {{ .Values.gateway.rules.license.upstream }}
3035
{{- end }}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
{{- if eq (toString .Values.global.platform.deploymentType) "Hosted" }}
1+
{{- if and (eq (toString .Values.global.platform.deploymentType) "Hosted") (index .Values "ingress" "enabled") }}
22
apiVersion: v1
33
kind: Service
44
metadata:
55
name: license
66
namespace: {{ .Release.Namespace }}
77
spec:
8-
externalName: {{ if .Values.gateway.enabled }}{{ .Values.gateway.rules.license.upstream }}{{ else }}{{ .Values.ingress.rules.license.upstream }}{{ end }}
8+
externalName: {{ .Values.ingress.rules.license.upstream }}
99
sessionAffinity: None
1010
type: ExternalName
1111
{{- end }}

charts/acaas/templates/selfhost/route.yaml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,13 @@ spec:
2323
type: PathPrefix
2424
value: /selfhost
2525
backendRefs:
26-
- kind: Service
26+
- group: gateway.envoyproxy.io
27+
kind: Backend
2728
name: selfhost
28-
namespace: {{ .Release.Namespace }}
2929
port: 443
30+
weight: 1
31+
filters:
32+
- type: URLRewrite
33+
urlRewrite:
34+
hostname: {{ .Values.gateway.rules.selfhost.upstream }}
3035
{{- end }}

0 commit comments

Comments
 (0)