feat: delegation

This commit is contained in:
ange 2024-05-01 12:37:16 +02:00
parent f8629440d1
commit 1fc02d5615
Signed by: ange
GPG Key ID: 9E0C4157BB7BEB1D
2 changed files with 96 additions and 1 deletions

View File

@ -1,5 +1,10 @@
#!/bin/bash -e
export NB_REPLICAS=3
# TODO: 3
export NB_REPLICAS=1
. ./manifests/bin/deploy.sh
kapply prod/delegation.yaml
kubectl rollout restart deployment delegation

View File

@ -0,0 +1,90 @@
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: app
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
spec:
ingressClassName: nginx
tls:
- secretName: tls-delegation
hosts:
- gmoker.com
rules:
- host: gmoker.com
http:
paths:
- path: /.well-known/matrix/
pathType: Prefix
backend:
service:
name: delegation
port:
name: http
---
apiVersion: v1
kind: Service
metadata:
name: delegation
labels:
app: delegation
spec:
selector:
app: delegation
ports:
- name: http
port: 80
targetPort: http
---
apiVersion: v1
kind: ConfigMap
metadata:
name: delegation
data:
default.conf: |
server {
listen 80;
location / {
return 200;
}
location /.well-known/matrix/server {
default_type application/json;
return 200 '{"m.server": "$BASE_URL:443"}';
}
location /.well-known/matrix/client {
default_type application/json;
return 200 '{"m.homeserver": { "base_url": "https://$ASE_URL" }}';
}
}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: delegation
labels:
app: delegation
spec:
replicas: $NB_REPLICAS
selector:
matchLabels:
app: delegation
template:
metadata:
labels:
app: delegation
spec:
containers:
- name: app
image: docker.io/nginx:latest
ports:
- name: http
containerPort: 80
volumeMounts:
- name: delegation
mountPath: /etc/nginx/conf.d
readOnly: true
volumes:
- name: delegation
configMap:
name: delegation