From 1fc02d561500b07d8eb78ed9f1a79984514c6b82 Mon Sep 17 00:00:00 2001 From: ange Date: Wed, 1 May 2024 12:37:16 +0200 Subject: [PATCH] feat: delegation --- manifests/bin/prod.sh | 7 ++- manifests/prod/delegation.yaml | 90 ++++++++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 manifests/prod/delegation.yaml diff --git a/manifests/bin/prod.sh b/manifests/bin/prod.sh index c97fc9e..bbcd0b9 100755 --- a/manifests/bin/prod.sh +++ b/manifests/bin/prod.sh @@ -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 diff --git a/manifests/prod/delegation.yaml b/manifests/prod/delegation.yaml new file mode 100644 index 0000000..c449641 --- /dev/null +++ b/manifests/prod/delegation.yaml @@ -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