Skip to content

Commit a902e31

Browse files
committed
🔧(helm) add ingress collaboration api
We need to keep the stickyness between the collaboration api and the ws server, to do so, we will use "upstream-hash-by: $arg_room", meaning that the stickyness will be based on the room query. We need to ahve 2 ingress to handle the "collaboration_auth", only the ws routes has to use the "collaboration_auth" subrequest.
1 parent 932ab13 commit a902e31

File tree

4 files changed

+138
-37
lines changed

4 files changed

+138
-37
lines changed

src/helm/env.d/dev/values.impress.yaml.gotmpl

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ backend:
88
envVars:
99
COLLABORATION_API_URL: https://impress.127.0.0.1.nip.io/collaboration/api/
1010
COLLABORATION_SERVER_SECRET: my-secret
11-
DJANGO_CSRF_TRUSTED_ORIGINS: https://impress.127.0.0.1.nip.io,http://impress.127.0.0.1.nip.io
11+
DJANGO_CSRF_TRUSTED_ORIGINS: https://impress.127.0.0.1.nip.io
1212
DJANGO_CONFIGURATION: Feature
1313
DJANGO_ALLOWED_HOSTS: impress.127.0.0.1.nip.io
1414
DJANGO_SECRET_KEY: {{ .Values.djangoSecretKey }}
@@ -28,7 +28,9 @@ backend:
2828
OIDC_RP_CLIENT_ID: {{ .Values.oidc.clientId }}
2929
OIDC_RP_CLIENT_SECRET: {{ .Values.oidc.clientSecret }}
3030
OIDC_RP_SIGN_ALGO: RS256
31-
OIDC_RP_SCOPES: "openid email"
31+
OIDC_RP_SCOPES: "openid email given_name usual_name"
32+
USER_OIDC_FIELD_TO_SHORTNAME: "given_name"
33+
USER_OIDC_FIELDS_TO_FULLNAME: "given_name,usual_name"
3234
OIDC_REDIRECT_ALLOWED_HOSTS: https://impress.127.0.0.1.nip.io
3335
OIDC_AUTH_REQUEST_EXTRA_PARAMS: "{'acr_values': 'eidas1'}"
3436
LOGIN_REDIRECT_URL: https://impress.127.0.0.1.nip.io
@@ -77,8 +79,6 @@ frontend:
7779
envVars:
7880
PORT: 8080
7981
NEXT_PUBLIC_API_ORIGIN: https://impress.127.0.0.1.nip.io
80-
NEXT_PUBLIC_Y_PROVIDER_URL: wss://impress.127.0.0.1.nip.io/ws
81-
NEXT_PUBLIC_MEDIA_URL: https://impress.127.0.0.1.nip.io
8282

8383
replicas: 1
8484
command:
@@ -107,15 +107,16 @@ ingress:
107107
enabled: true
108108
host: impress.127.0.0.1.nip.io
109109

110-
ingressWS:
110+
ingressCollaborationWS:
111111
enabled: true
112112
host: impress.127.0.0.1.nip.io
113-
113+
114114
annotations:
115-
nginx.ingress.kubernetes.io/auth-response-headers: "Authorization, Can-Edit, User-Id"
116115
nginx.ingress.kubernetes.io/auth-url: https://impress.127.0.0.1.nip.io/api/v1.0/documents/collaboration-auth/
117-
nginx.ingress.kubernetes.io/enable-websocket: "true"
118-
nginx.ingress.kubernetes.io/upstream-hash-by: "$request_uri"
116+
117+
ingressCollaborationApi:
118+
enabled: true
119+
host: impress.127.0.0.1.nip.io
119120

120121
ingressAdmin:
121122
enabled: true
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{{- if .Values.ingressCollaborationApi.enabled -}}
2+
{{- $fullName := include "impress.fullname" . -}}
3+
{{- if and .Values.ingressCollaborationApi.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
4+
{{- if not (hasKey .Values.ingressCollaborationApi.annotations "kubernetes.io/ingress.class") }}
5+
{{- $_ := set .Values.ingressCollaborationApi.annotations "kubernetes.io/ingress.class" .Values.ingressCollaborationApi.className}}
6+
{{- end }}
7+
{{- end }}
8+
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
9+
apiVersion: networking.k8s.io/v1
10+
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
11+
apiVersion: networking.k8s.io/v1beta1
12+
{{- else -}}
13+
apiVersion: extensions/v1beta1
14+
{{- end }}
15+
kind: Ingress
16+
metadata:
17+
name: {{ $fullName }}-collaboration-api
18+
namespace: {{ .Release.Namespace | quote }}
19+
labels:
20+
{{- include "impress.labels" . | nindent 4 }}
21+
{{- with .Values.ingressCollaborationApi.annotations }}
22+
annotations:
23+
{{- toYaml . | nindent 4 }}
24+
{{- end }}
25+
spec:
26+
{{- if and .Values.ingressCollaborationApi.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
27+
ingressClassName: {{ .Values.ingressCollaborationApi.className }}
28+
{{- end }}
29+
{{- if .Values.ingressCollaborationApi.tls.enabled }}
30+
tls:
31+
{{- if .Values.ingressCollaborationApi.host }}
32+
- secretName: {{ $fullName }}-tls
33+
hosts:
34+
- {{ .Values.ingressCollaborationApi.host | quote }}
35+
{{- end }}
36+
{{- range .Values.ingressCollaborationApi.tls.additional }}
37+
- hosts:
38+
{{- range .hosts }}
39+
- {{ . | quote }}
40+
{{- end }}
41+
secretName: {{ .secretName }}
42+
{{- end }}
43+
{{- end }}
44+
rules:
45+
{{- if .Values.ingressCollaborationApi.host }}
46+
- host: {{ .Values.ingressCollaborationApi.host | quote }}
47+
http:
48+
paths:
49+
- path: {{ .Values.ingressCollaborationApi.path | quote }}
50+
{{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }}
51+
pathType: ImplementationSpecific
52+
{{- end }}
53+
backend:
54+
service:
55+
name: {{ include "impress.yProvider.fullname" . }}
56+
port:
57+
number: {{ .Values.yProvider.service.port }}
58+
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
59+
service:
60+
name: {{ include "impress.yProvider.fullname" . }}
61+
port:
62+
number: {{ .Values.yProvider.service.port }}
63+
{{- else }}
64+
serviceName: {{ include "impress.yProvider.fullname" . }}
65+
servicePort: {{ .Values.yProvider.service.port }}
66+
{{- end }}
67+
{{- with .Values.ingressCollaborationApi.customBackends }}
68+
{{- toYaml . | nindent 10 }}
69+
{{- end }}
70+
{{- end }}
71+
{{- end }}
72+

src/helm/impress/templates/ingress_ws.yaml renamed to src/helm/impress/templates/ingress_collaboration_ws.yaml

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
{{- if .Values.ingressWS.enabled -}}
1+
{{- if .Values.ingressCollaborationWS.enabled -}}
22
{{- $fullName := include "impress.fullname" . -}}
3-
{{- if and .Values.ingressWS.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
4-
{{- if not (hasKey .Values.ingressWS.annotations "kubernetes.io/ingress.class") }}
5-
{{- $_ := set .Values.ingressWS.annotations "kubernetes.io/ingress.class" .Values.ingressWS.className}}
3+
{{- if and .Values.ingressCollaborationWS.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
4+
{{- if not (hasKey .Values.ingressCollaborationWS.annotations "kubernetes.io/ingress.class") }}
5+
{{- $_ := set .Values.ingressCollaborationWS.annotations "kubernetes.io/ingress.class" .Values.ingressCollaborationWS.className}}
66
{{- end }}
77
{{- end }}
88
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
@@ -18,22 +18,22 @@ metadata:
1818
namespace: {{ .Release.Namespace | quote }}
1919
labels:
2020
{{- include "impress.labels" . | nindent 4 }}
21-
{{- with .Values.ingressWS.annotations }}
21+
{{- with .Values.ingressCollaborationWS.annotations }}
2222
annotations:
2323
{{- toYaml . | nindent 4 }}
2424
{{- end }}
2525
spec:
26-
{{- if and .Values.ingressWS.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
27-
ingressClassName: {{ .Values.ingressWS.className }}
26+
{{- if and .Values.ingressCollaborationWS.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
27+
ingressClassName: {{ .Values.ingressCollaborationWS.className }}
2828
{{- end }}
29-
{{- if .Values.ingressWS.tls.enabled }}
29+
{{- if .Values.ingressCollaborationWS.tls.enabled }}
3030
tls:
31-
{{- if .Values.ingressWS.host }}
31+
{{- if .Values.ingressCollaborationWS.host }}
3232
- secretName: {{ $fullName }}-tls
3333
hosts:
34-
- {{ .Values.ingressWS.host | quote }}
34+
- {{ .Values.ingressCollaborationWS.host | quote }}
3535
{{- end }}
36-
{{- range .Values.ingressWS.tls.additional }}
36+
{{- range .Values.ingressCollaborationWS.tls.additional }}
3737
- hosts:
3838
{{- range .hosts }}
3939
- {{ . | quote }}
@@ -42,11 +42,11 @@ spec:
4242
{{- end }}
4343
{{- end }}
4444
rules:
45-
{{- if .Values.ingressWS.host }}
46-
- host: {{ .Values.ingressWS.host | quote }}
45+
{{- if .Values.ingressCollaborationWS.host }}
46+
- host: {{ .Values.ingressCollaborationWS.host | quote }}
4747
http:
4848
paths:
49-
- path: {{ .Values.ingressWS.path | quote }}
49+
- path: {{ .Values.ingressCollaborationWS.path | quote }}
5050
{{- if semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion }}
5151
pathType: ImplementationSpecific
5252
{{- end }}
@@ -64,7 +64,7 @@ spec:
6464
serviceName: {{ include "impress.yProvider.fullname" . }}
6565
servicePort: {{ .Values.yProvider.service.port }}
6666
{{- end }}
67-
{{- with .Values.ingressWS.customBackends }}
67+
{{- with .Values.ingressCollaborationWS.customBackends }}
6868
{{- toYaml . | nindent 10 }}
6969
{{- end }}
7070
{{- end }}

src/helm/impress/values.yaml

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,34 +48,62 @@ ingress:
4848
## @param ingress.customBackends Add custom backends to ingress
4949
customBackends: []
5050

51-
## @param ingressWS.enabled whether to enable the Ingress or not
52-
## @param ingressWS.className IngressClass to use for the Ingress
53-
## @param ingressWS.host Host for the Ingress
54-
## @param ingressWS.path Path to use for the Ingress
55-
ingressWS:
51+
## @param ingressCollaborationWS.enabled whether to enable the Ingress or not
52+
## @param ingressCollaborationWS.className IngressClass to use for the Ingress
53+
## @param ingressCollaborationWS.host Host for the Ingress
54+
## @param ingressCollaborationWS.path Path to use for the Ingress
55+
ingressCollaborationWS:
5656
enabled: false
5757
className: null
5858
host: impress.example.com
59-
path: /ws
59+
path: /collaboration/ws/
6060
## @param ingress.hosts Additional host to configure for the Ingress
6161
hosts: []
6262
# - chart-example.local
63-
## @param ingressWS.tls.enabled Wether to enable TLS for the Ingress
64-
## @skip ingressWS.tls.additional
65-
## @extra ingressWS.tls.additional[].secretName Secret name for additional TLS config
66-
## @extra ingressWS.tls.additional[].hosts[] Hosts for additional TLS config
63+
## @param ingressCollaborationWS.tls.enabled Wether to enable TLS for the Ingress
64+
## @skip ingressCollaborationWS.tls.additional
65+
## @extra ingressCollaborationWS.tls.additional[].secretName Secret name for additional TLS config
66+
## @extra ingressCollaborationWS.tls.additional[].hosts[] Hosts for additional TLS config
6767
tls:
6868
enabled: true
6969
additional: []
7070

71-
## @param ingressWS.customBackends Add custom backends to ingress
71+
## @param ingressCollaborationWS.customBackends Add custom backends to ingress
7272
customBackends: []
7373

7474
annotations:
75+
nginx.ingress.kubernetes.io/auth-response-headers: "Authorization, X-Can-Edit, X-User-Id"
7576
nginx.ingress.kubernetes.io/auth-url: https://impress.example.com/api/v1.0/documents/collaboration-auth/
76-
nginx.ingress.kubernetes.io/auth-response-headers: "Authorization, Can-Edit, User-Id"
7777
nginx.ingress.kubernetes.io/enable-websocket: "true"
78-
nginx.ingress.kubernetes.io/upstream-hash-by: "$request_uri"
78+
nginx.ingress.kubernetes.io/proxy-read-timeout: "86400"
79+
nginx.ingress.kubernetes.io/proxy-send-timeout: "86400"
80+
nginx.ingress.kubernetes.io/upstream-hash-by: $arg_room
81+
82+
## @param ingressCollaborationApi.enabled whether to enable the Ingress or not
83+
## @param ingressCollaborationApi.className IngressClass to use for the Ingress
84+
## @param ingressCollaborationApi.host Host for the Ingress
85+
## @param ingressCollaborationApi.path Path to use for the Ingress
86+
ingressCollaborationApi:
87+
enabled: false
88+
className: null
89+
host: impress.example.com
90+
path: /collaboration/api/
91+
## @param ingress.hosts Additional host to configure for the Ingress
92+
hosts: []
93+
# - chart-example.local
94+
## @param ingressCollaborationApi.tls.enabled Wether to enable TLS for the Ingress
95+
## @skip ingressCollaborationApi.tls.additional
96+
## @extra ingressCollaborationApi.tls.additional[].secretName Secret name for additional TLS config
97+
## @extra ingressCollaborationApi.tls.additional[].hosts[] Hosts for additional TLS config
98+
tls:
99+
enabled: true
100+
additional: []
101+
102+
## @param ingressCollaborationApi.customBackends Add custom backends to ingress
103+
customBackends: []
104+
105+
annotations:
106+
nginx.ingress.kubernetes.io/upstream-hash-by: $arg_room
79107

80108
## @param ingressAdmin.enabled whether to enable the Ingress or not
81109
## @param ingressAdmin.className IngressClass to use for the Ingress

0 commit comments

Comments
 (0)