Merge wellknown, use nginx conf.d, improvements

This commit is contained in:
tectux 2024-10-06 21:26:41 +00:00
parent 2b01eb74b4
commit 37eec10d2b
8 changed files with 33 additions and 155 deletions

View file

@ -76,5 +76,14 @@ spec:
name: {{ include "conduit.fullname" . }}-wellknown
port:
name: http
{{- if .Values.wellknown.rewriteRoot }}
- path: /
pathType: Exact
backend:
service:
name: {{ include "conduit.fullname" . }}-wellknown
port:
name: http
{{- end }}
{{- end }}
{{- end }}

View file

@ -2,10 +2,12 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "conduit.fullname" . }}-wellknown
name: {{ include "conduit.fullname" . }}-nginx-wellknown
labels:
{{- include "conduit.labels" . | nindent 4 }}
data:
server: {{ toJson .Values.wellknown.server | quote }}
client: {{ toJson .Values.wellknown.client | quote }}
default.conf: |
{{- with .Values.wellknown}}
{{ tpl .nginxServerConf . | quote | indent 4 }}
{{- end }}
{{- end }}

View file

@ -46,17 +46,19 @@ spec:
protocol: TCP
livenessProbe:
httpGet:
path: /
path: /nginx_health
port: http
readinessProbe:
httpGet:
path: /
path: /nginx_health
port: http
resources:
{{- toYaml .Values.wellknown.resources | nindent 12 }}
volumeMounts:
- name: "data"
mountPath: "/usr/share/nginx/html/.well-known/matrix/"
- name: "wellknown-nginx-conf"
mountPath: "/etc/nginx/conf.d/default.conf"
subPath: default.conf
readOnly: true
{{- with .Values.wellknown.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
@ -70,7 +72,7 @@ spec:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: "data"
- name: "wellknown-nginx-conf"
configMap:
name: {{ include "conduit.fullname" . }}-wellknown
name: {{ include "conduit.fullname" . }}-nginx-wellknown
{{- end }}

View file

@ -1,11 +0,0 @@
{{- if .Values.wellknowncustom.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "conduit.fullname" . }}-nginx-wellknowncustom
labels:
{{- include "conduit.labels" . | nindent 4 }}
data:
nginx.conf: |
{{ .Values.wellknowncustom.nginx_conf | nindent 4 }}
{{- end }}

View file

@ -1,79 +0,0 @@
{{- if .Values.wellknowncustom.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "conduit.fullname" . }}-wellknowncustom
labels:
{{- include "conduit.labels" . | nindent 4 }}
app.kubernetes.io/component: wellknowncustom
spec:
replicas: {{ .Values.wellknowncustom.replicaCount }}
selector:
matchLabels:
{{- include "conduit.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: wellknowncustom
template:
metadata:
{{- with .Values.wellknowncustom.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "conduit.selectorLabels" . | nindent 8 }}
app.kubernetes.io/component: wellknowncustom
{{- with .Values.wellknowncustom.podLabels }}
{{- toYaml . | nindent 8 }}
{{- end }}
type: wellknowncustom
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "conduit.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.wellknowncustom.podSecurityContext | nindent 8 }}
containers:
- name: wellknowncustom
securityContext:
{{- toYaml .Values.wellknowncustom.securityContext | nindent 12 }}
{{- with .Values.wellknowncustom.image }}
image: "{{ .registry }}/{{ .repository }}:{{ .tag }}"
{{- end }}
imagePullPolicy: {{ .Values.wellknowncustom.image.pullPolicy }}
ports:
- name: http
containerPort: {{ .Values.wellknowncustom.containerPort }}
protocol: TCP
livenessProbe:
httpGet:
path: /nginx_health
port: http
readinessProbe:
httpGet:
path: /nginx_health
port: http
resources:
{{- toYaml .Values.wellknowncustom.resources | nindent 12 }}
volumeMounts:
- name: "wellknowncustom-nginx-conf"
mountPath: "/etc/nginx/nginx.conf"
subPath: nginx.conf
readOnly: true
{{- with .Values.wellknowncustom.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.wellknowncustom.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.wellknowncustom.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: "wellknowncustom-nginx-conf"
configMap:
name: {{ include "conduit.fullname" . }}-nginx-wellknowncustom
{{- end }}

View file

@ -1,18 +0,0 @@
{{- if .Values.wellknowncustom.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "conduit.fullname" . }}-wellknowncustom
labels:
{{- include "conduit.labels" . | nindent 4 }}
spec:
type: {{ .Values.wellknowncustom.service.type }}
ports:
- port: {{ .Values.wellknowncustom.service.port }}
targetPort: http
protocol: TCP
name: http
selector:
{{- include "conduit.selectorLabels" . | nindent 4 }}
type: wellknowncustom
{{- end }}

View file

@ -67,6 +67,9 @@ wellknown:
port: 8080
annotations: {}
# if ingress is enabled: specifies whether ingress should redirect the `/`-Location to the wellknown server
rewriteRoot: true
# TO EDIT:
server:
"m.server": "your.server.name:443"
@ -76,55 +79,26 @@ wellknown:
"org.matrix.msc3575.proxy":
"url": "https://your.server.name/"
wellknowncustom:
enabled: false
image:
registry: docker.io
repository: library/nginx
pullPolicy: IfNotPresent
tag: "1.27.1"
replicaCount: 1
podLabels: {}
podAnnotations: []
podSecurityContext: {}
securityContext: {}
containerPort: 8080
env: []
resources: {}
nodeSelector: {}
tolerations: []
affinity: {}
service:
type: ClusterIP
port: 8080
annotations: {}
# TO EDIT:
nginx_conf: |
user nginx;
worker_processes 1;
events {
worker_connections 10240;
}
http {
# EDIT IF NEEDED
nginxServerConf: |-
server {
listen 8080;
server_name localhost;
location /.well-known/matrix/server {
return 200 '{"m.server": "your.server.name:443"}';
return 200 {{ toJson .server | quote }};
types { } default_type "application/json; charset=utf-8";
}
location /.well-known/matrix/client {
return 200 '{"m.homeserver": {"base_url": "https://your.server.name/"}, "org.matrix.msc3575.proxy": {"url": "https://your.server.name/"}}';
return 200 {{ toJson .client | quote }};
types { } default_type "application/json; charset=utf-8";
add_header "Access-Control-Allow-Origin" *;
}
location / {
# return 200 'Welcome to the your.server.name conduit server!';
# types { } default_type "text/plain; charset=utf-8";
return 404;
}
@ -133,7 +107,6 @@ wellknowncustom:
types { } default_type "text/plain; charset=utf-8";
}
}
}
podLabels: {}
podAnnotations: {}