cluster

Infrastructure files for Nordgedanken and Midnightthoughts.
git clone git://archive.git.mtrnord.blog/MTRNord/cluster.git
Log | Files | Refs | README

deployment.yaml (4423B)


      1 apiVersion: apps/v1
      2 kind: Deployment
      3 metadata:
      4   name: persephone
      5   namespace: persephone
      6 spec:
      7   progressDeadlineSeconds: 120
      8   strategy:
      9     rollingUpdate:
     10       maxUnavailable: 0
     11     type: RollingUpdate
     12   selector:
     13     matchLabels:
     14       app: persephone
     15   template:
     16     metadata:
     17       labels:
     18         app: persephone
     19     spec:
     20       automountServiceAccountToken: false
     21       securityContext:
     22         fsGroup: 1000
     23       containers:
     24         - name: persephone
     25           image: ghcr.io/mtrnord/persephone:main
     26           imagePullPolicy: Always
     27           securityContext:
     28             allowPrivilegeEscalation: false
     29             readOnlyRootFilesystem: false # app writes to ./uploads/tmp/ relative to workdir
     30             runAsNonRoot: true
     31             runAsUser: 1000
     32             runAsGroup: 1000
     33             capabilities:
     34               drop:
     35                 - ALL
     36             seccompProfile:
     37               type: RuntimeDefault
     38           env:
     39             # Base path for the configuration file
     40             - name: PERSEPHONE_CONFIG
     41               value: /data/config.yaml
     42           resources:
     43             limits:
     44               cpu: "1000m"
     45               memory: "512Mi"
     46             requests:
     47               memory: "344Mi"
     48               cpu: "252m"
     49           ports:
     50             - containerPort: 8008
     51               name: web
     52               protocol: TCP
     53           volumeMounts:
     54             - name: data
     55               mountPath: /data
     56             - name: config
     57               mountPath: /data/config.yaml
     58               subPath: config.yaml
     59             - mountPath: /tmp
     60               name: tmp
     61           livenessProbe:
     62             httpGet:
     63               path: /_matrix/federation/v1/version
     64               port: web
     65               scheme: HTTP
     66           readinessProbe:
     67             httpGet:
     68               path: /_matrix/federation/v1/version
     69               port: web
     70               scheme: HTTP
     71           startupProbe:
     72             httpGet:
     73               path: /_matrix/federation/v1/version
     74               port: web
     75       volumes:
     76         - name: tmp
     77           emptyDir:
     78             sizeLimit: 2048Mi
     79         - name: data
     80           persistentVolumeClaim:
     81             claimName: persephone-data
     82         - name: config
     83           configMap:
     84             name: persephone-config
     85             items:
     86               - key: config.yaml
     87                 path: config.yaml
     88 ---
     89 apiVersion: v1
     90 kind: Service
     91 metadata:
     92   name: persephone
     93 spec:
     94   selector:
     95     app: persephone
     96   ports:
     97     - name: web
     98       port: 8008
     99       targetPort: 8008
    100 ---
    101 apiVersion: gateway.networking.k8s.io/v1
    102 kind: HTTPRoute
    103 metadata:
    104   name: persephone
    105   namespace: persephone
    106 spec:
    107   parentRefs:
    108     - name: envoy-gateway
    109       namespace: envoy-gateway
    110   hostnames:
    111     - persephone.midnightthoughts.space
    112   rules:
    113     - matches:
    114         - path:
    115             type: PathPrefix
    116             value: /.well-known/matrix/server
    117       filters:
    118         - type: ExtensionRef
    119           extensionRef:
    120             group: gateway.envoyproxy.io
    121             kind: HTTPRouteFilter
    122             name: server-wellknown
    123     - matches:
    124         - path:
    125             type: PathPrefix
    126             value: /.well-known/matrix/client
    127       filters:
    128         - type: ExtensionRef
    129           extensionRef:
    130             group: gateway.envoyproxy.io
    131             kind: HTTPRouteFilter
    132             name: client-wellknown
    133 ---
    134 apiVersion: gateway.networking.k8s.io/v1
    135 kind: HTTPRoute
    136 metadata:
    137   name: persephone-matrix
    138   namespace: persephone
    139 spec:
    140   parentRefs:
    141     - name: envoy-gateway
    142       namespace: envoy-gateway
    143   hostnames:
    144     - matrix.persephone.midnightthoughts.space
    145   rules:
    146     - backendRefs:
    147         - name: persephone
    148           port: 8008
    149       timeouts:
    150         request: 240s
    151         backendRequest: 0s
    152 ---
    153 apiVersion: gateway.envoyproxy.io/v1alpha1
    154 kind: HTTPRouteFilter
    155 metadata:
    156   name: server-wellknown
    157 spec:
    158   directResponse:
    159     contentType: application/json
    160     statusCode: 200
    161     body:
    162       type: Inline
    163       inline: '{"m.server": "matrix.persephone.midnightthoughts.space:443"}'
    164 
    165 ---
    166 apiVersion: gateway.envoyproxy.io/v1alpha1
    167 kind: HTTPRouteFilter
    168 metadata:
    169   name: client-wellknown
    170 spec:
    171   directResponse:
    172     contentType: application/json
    173     statusCode: 200
    174     header:
    175       set:
    176         - name: Access-Control-Allow-Origin
    177           value: "*"
    178     body:
    179       type: Inline
    180       inline: '{"m.homeserver": {"base_url": "https://matrix.persephone.midnightthoughts.space"}}'