From 2b01eb74b4de30a3ee588f6424c79d6fd060cb63 Mon Sep 17 00:00:00 2001 From: tectux Date: Sat, 5 Oct 2024 15:37:56 +0000 Subject: [PATCH] wellknown custom deployment --- conduit/templates/wellknown/service.yaml | 2 +- .../templates/wellknowncustom/configmap.yaml | 11 +++ .../templates/wellknowncustom/deployment.yaml | 79 +++++++++++++++++++ .../templates/wellknowncustom/service.yaml | 18 +++++ conduit/values.yaml | 59 ++++++++++++++ 5 files changed, 168 insertions(+), 1 deletion(-) create mode 100644 conduit/templates/wellknowncustom/configmap.yaml create mode 100644 conduit/templates/wellknowncustom/deployment.yaml create mode 100644 conduit/templates/wellknowncustom/service.yaml diff --git a/conduit/templates/wellknown/service.yaml b/conduit/templates/wellknown/service.yaml index 780e068..929e068 100644 --- a/conduit/templates/wellknown/service.yaml +++ b/conduit/templates/wellknown/service.yaml @@ -15,4 +15,4 @@ spec: selector: {{- include "conduit.selectorLabels" . | nindent 4 }} type: wellknown -{{- end }} +{{- end }} \ No newline at end of file diff --git a/conduit/templates/wellknowncustom/configmap.yaml b/conduit/templates/wellknowncustom/configmap.yaml new file mode 100644 index 0000000..7173d37 --- /dev/null +++ b/conduit/templates/wellknowncustom/configmap.yaml @@ -0,0 +1,11 @@ +{{- 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 }} \ No newline at end of file diff --git a/conduit/templates/wellknowncustom/deployment.yaml b/conduit/templates/wellknowncustom/deployment.yaml new file mode 100644 index 0000000..c3bc297 --- /dev/null +++ b/conduit/templates/wellknowncustom/deployment.yaml @@ -0,0 +1,79 @@ +{{- 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 }} diff --git a/conduit/templates/wellknowncustom/service.yaml b/conduit/templates/wellknowncustom/service.yaml new file mode 100644 index 0000000..c8583cc --- /dev/null +++ b/conduit/templates/wellknowncustom/service.yaml @@ -0,0 +1,18 @@ +{{- 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 }} \ No newline at end of file diff --git a/conduit/values.yaml b/conduit/values.yaml index 816237e..8e2545e 100644 --- a/conduit/values.yaml +++ b/conduit/values.yaml @@ -76,6 +76,65 @@ 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 { + server { + listen 8080; + server_name localhost; + + location /.well-known/matrix/server { + return 200 '{"m.server": "your.server.name:443"}'; + 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/"}}'; + types { } default_type "application/json; charset=utf-8"; + add_header "Access-Control-Allow-Origin" *; + } + + location / { + return 404; + } + + location /nginx_health { + return 200 'OK'; + types { } default_type "text/plain; charset=utf-8"; + } + } + } + podLabels: {} podAnnotations: {}