diff --git a/apps/faf-content/Chart.yaml b/apps/faf-content/Chart.yaml new file mode 100644 index 0000000..d8ef0d5 --- /dev/null +++ b/apps/faf-content/Chart.yaml @@ -0,0 +1,3 @@ +apiVersion: v2 +name: faf-content +version: 1.0.0 diff --git a/apps/faf-content/templates/config.yaml b/apps/faf-content/templates/config.yaml new file mode 100644 index 0000000..0ae96d7 --- /dev/null +++ b/apps/faf-content/templates/config.yaml @@ -0,0 +1,25 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: faf-content + labels: + app: faf-content +data: + "default.conf": |- + server { + listen 80; + listen [::]:80; + server_name localhost; + root /data; + + # K8s healthcheck + # Access the path. If 200 is returned, Nginx can receive requests. + location /health { + access_log off; + return 200; + } + + location / { + index index.html index.htm; + } + } diff --git a/apps/faf-content/templates/deployment.yaml b/apps/faf-content/templates/deployment.yaml new file mode 100644 index 0000000..e2e30ed --- /dev/null +++ b/apps/faf-content/templates/deployment.yaml @@ -0,0 +1,82 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: faf-content + labels: + app: faf-content + annotations: + reloader.stakater.com/auto: "true" +spec: + replicas: 1 + revisionHistoryLimit: 10 + selector: + matchLabels: + app: faf-content + template: + metadata: + labels: + app: faf-content + spec: + containers: + - image: nginx:1.25.4-alpine-slim + imagePullPolicy: Always + name: faf-content + ports: + - containerPort: 80 + volumeMounts: + - name: config + mountPath: /etc/nginx/conf.d/default.conf + subPath: default.conf + - name: faf-replays-pvc + mountPath: /data/replays + readOnly: true + - name: faf-maps-pvc + mountPath: /data/maps + readOnly: true + - name: faf-mods-pvc + mountPath: /data/mods + readOnly: true + - name: faf-featured-mods-pvc + mountPath: /data/legacy-featured-mod-files + readOnly: true + - name: faf-content-pvc + mountPath: /data + readOnly: true + startupProbe: + httpGet: + port: 80 + path: /health + initialDelaySeconds: 10 + failureThreshold: 30 + periodSeconds: 3 + livenessProbe: + httpGet: + port: 80 + path: /health + failureThreshold: 3 + periodSeconds: 10 + restartPolicy: Always + volumes: + - name: config + configMap: + name: faf-content + - name: faf-replays-pvc + persistentVolumeClaim: + claimName: faf-replays-pvc + readOnly: true + - name: faf-maps-pvc + persistentVolumeClaim: + claimName: faf-maps-pvc + readOnly: true + - name: faf-mods-pvc + persistentVolumeClaim: + claimName: faf-mods-pvc + readOnly: true + - name: faf-featured-mods-pvc + persistentVolumeClaim: + claimName: faf-featured-mods-pvc + readOnly: true + - name: faf-content-pvc + persistentVolumeClaim: + claimName: faf-content-pvc + readOnly: true diff --git a/apps/faf-content/templates/ingress.yaml b/apps/faf-content/templates/ingress.yaml new file mode 100644 index 0000000..5d17201 --- /dev/null +++ b/apps/faf-content/templates/ingress.yaml @@ -0,0 +1,42 @@ +apiVersion: traefik.io/v1alpha1 +kind: Middleware +metadata: + name: cors +spec: + headers: + accessControlAllowMethods: + - "GET" + accessControlAllowOriginList: + - "*" + accessControlMaxAge: 60 + addVaryHeader: false + +--- + +apiVersion: traefik.io/v1alpha1 +kind: Middleware +metadata: + name: redirect-replay-subdomain +spec: + redirectRegex: + regex: ^(http|https)://replay.{{.Values.baseDomain}}/(\\d+) + replacement: ${1}://api.{{.Values.baseDomain}}/game/${2}/replay" + +--- + +apiVersion: traefik.io/v1alpha1 +kind: IngressRoute +metadata: + name: faf-content +spec: + entryPoints: + - websecure + routes: + - match: Host(`content.{{.Values.baseDomain}}`) || Host(`replay.${DOMAINNAME}`) + kind: Rule + services: + - name: faf-content + port: 80 + middlewares: + - name: redirect-replay-subdomain + - name: cors diff --git a/apps/faf-content/templates/service.yaml b/apps/faf-content/templates/service.yaml new file mode 100644 index 0000000..e8c98de --- /dev/null +++ b/apps/faf-content/templates/service.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +kind: Service +metadata: + name: faf-content + labels: + app: faf-content +spec: + selector: + app: faf-content + ports: + - port: 80 + targetPort: 80 diff --git a/cluster/storage/templates/persistent-volume-claim.yaml b/cluster/storage/templates/persistent-volume-claim.yaml index acb804c..8e917a2 100644 --- a/cluster/storage/templates/persistent-volume-claim.yaml +++ b/cluster/storage/templates/persistent-volume-claim.yaml @@ -13,4 +13,7 @@ spec: resources: requests: storage: {{ .pv.size }} + +--- + {{- end }} \ No newline at end of file diff --git a/cluster/storage/templates/persistent-volume.yaml b/cluster/storage/templates/persistent-volume.yaml index 1c5f32f..650b664 100644 --- a/cluster/storage/templates/persistent-volume.yaml +++ b/cluster/storage/templates/persistent-volume.yaml @@ -12,7 +12,7 @@ spec: persistentVolumeReclaimPolicy: Retain volumeMode: Filesystem local: - path: {{ coalesce .pv.folderName (printf "%s/%s" $.Values.dataPath .pv.name) }} + path: {{ coalesce (printf "%s/%s" $.Values.dataPath .pv.folderName) (printf "%s/%s" $.Values.dataPath .pv.name) }} nodeAffinity: required: nodeSelectorTerms: @@ -21,4 +21,7 @@ spec: operator: In values: - {{ $.Values.zfs.nodeId }} + +--- + {{- end }} \ No newline at end of file diff --git a/cluster/storage/values.yaml b/cluster/storage/values.yaml index 178dd7f..3b266e1 100644 --- a/cluster/storage/values.yaml +++ b/cluster/storage/values.yaml @@ -8,6 +8,36 @@ managedStorages: # pvc: # name: optional string, default is -pvc # namespace: faf-apps + - pv: + name: faf-replays + folderName: replays + size: 500Gi + pvc: + namespace: faf-apps + - pv: + name: faf-maps + folderName: maps + size: 200Gi + pvc: + namespace: faf-apps + - pv: + name: faf-mods + folderName: mods + size: 200Gi + pvc: + namespace: faf-apps + - pv: + name: faf-featured-mods + folderName: legacy-featured-mod-files + size: 150Gi + pvc: + namespace: faf-apps + - pv: + name: faf-content + folderName: content + size: 50Gi + pvc: + namespace: faf-apps - pv: name: phpbb3-archive size: 2Gi @@ -19,8 +49,6 @@ managedStorages: # - name: mongodb # namespace: faf-apps # size: 20Gi -# - name: faf-content -# namespace: faf-apps # size: 10Gi # - name: nodebb # namespace: faf-apps