From 30485e579629cdd17fe16b097b1b84f7e5ef3577 Mon Sep 17 00:00:00 2001 From: Brutus5000 Date: Tue, 22 Oct 2024 22:25:54 +0200 Subject: [PATCH] Add nodebb --- apps/nodebb/templates/deployment.yaml | 46 +++++++++++++++++++++++++++ apps/nodebb/templates/ingress.yaml | 13 ++++++++ apps/nodebb/templates/secret.yaml | 19 +++++++++++ apps/nodebb/templates/service.yaml | 12 ++++--- cluster/storage/values.yaml | 8 +++-- 5 files changed, 90 insertions(+), 8 deletions(-) create mode 100644 apps/nodebb/templates/deployment.yaml create mode 100644 apps/nodebb/templates/ingress.yaml create mode 100644 apps/nodebb/templates/secret.yaml diff --git a/apps/nodebb/templates/deployment.yaml b/apps/nodebb/templates/deployment.yaml new file mode 100644 index 00000000..bf05c795 --- /dev/null +++ b/apps/nodebb/templates/deployment.yaml @@ -0,0 +1,46 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: nodebb + name: nodebb +spec: + replicas: 1 + revisionHistoryLimit: 10 + selector: + matchLabels: + app: nodebb + template: + metadata: + labels: + app: nodebb + spec: + containers: + - image: nodebb/docker:1.18.5 + command: + - /bin/sh + - tail + - /dev/null + imagePullPolicy: Always + name: nodebb + volumeMounts: + - mountPath: /usr/src/app/config.json + name: config + subPath: config.json + - mountPath: /usr/src/app/node_modules + name: nodebb + subPath: node_modules + - mountPath: /usr/src/app/build + name: nodebb + subPath: build + - mountPath: /usr/src/app/public/uploads + name: nodebb + subPath: uploads + restartPolicy: Always + volumes: + - name: config + secret: + secretName: nodebb + - name: nodebb + persistentVolumeClaim: + claimName: nodebb-pvc \ No newline at end of file diff --git a/apps/nodebb/templates/ingress.yaml b/apps/nodebb/templates/ingress.yaml new file mode 100644 index 00000000..06924316 --- /dev/null +++ b/apps/nodebb/templates/ingress.yaml @@ -0,0 +1,13 @@ +apiVersion: traefik.io/v1alpha1 +kind: IngressRoute +metadata: + name: nodebb +spec: + entryPoints: + - websecure + routes: + - match: Host(`forum.{{.Values.baseDomain}}`) + kind: Rule + services: + - name: nodebb + port: 4567 diff --git a/apps/nodebb/templates/secret.yaml b/apps/nodebb/templates/secret.yaml new file mode 100644 index 00000000..282141c7 --- /dev/null +++ b/apps/nodebb/templates/secret.yaml @@ -0,0 +1,19 @@ +apiVersion: secrets.infisical.com/v1alpha1 +kind: InfisicalSecret +metadata: + name: nodebb + namespace: faf-apps +spec: + authentication: + universalAuth: + credentialsRef: + secretName: infisical-machine-identity + secretNamespace: faf-ops + secretsScope: + projectSlug: {{.Values.infisical.projectSlug}} + envSlug: {{.Values.infisical.envSlug}} + secretsPath: "/nodebb" + managedSecretReference: + secretName: nodebb + secretNamespace: faf-apps + creationPolicy: "Owner" diff --git a/apps/nodebb/templates/service.yaml b/apps/nodebb/templates/service.yaml index dc6783ff..4dcfdc4d 100644 --- a/apps/nodebb/templates/service.yaml +++ b/apps/nodebb/templates/service.yaml @@ -1,10 +1,12 @@ -# This is a temporary workaround to point to the nodebb instance running in faf-stack for the API to reach it -# (it is exposed to the host though) -# TODO: Replace as soon as nodebb runs in cluster apiVersion: v1 kind: Service metadata: name: nodebb + labels: + app: nodebb spec: - type: ExternalName - externalName: {{.Values.hostName}} + selector: + app: nodebb + ports: + - port: 4567 + targetPort: 4567 \ No newline at end of file diff --git a/cluster/storage/values.yaml b/cluster/storage/values.yaml index 306159e4..dcfd94e2 100644 --- a/cluster/storage/values.yaml +++ b/cluster/storage/values.yaml @@ -48,6 +48,11 @@ managedStorages: size: 20Gi pvc: namespace: faf-infra + - pv: + name: nodebb + size: 15Gi + pvc: + namespace: faf-apps - pv: name: wordpress size: 10Gi @@ -82,6 +87,3 @@ managedStorages: # namespace: faf-apps # size: 20Gi # size: 10Gi -# - name: nodebb -# namespace: faf-apps -# size: 10Gi