From d01dc990323e9cfedead45308eff432f81b1e075 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Huss?= Date: Tue, 12 Sep 2023 16:08:49 +0200 Subject: [PATCH] fix --- apps/nextcloud/index.yaml | 236 +++++++++++++++++----------------- apps/nextcloud/ingress.tf | 2 +- apps/nextcloud/middlewares.tf | 19 ++- 3 files changed, 136 insertions(+), 121 deletions(-) diff --git a/apps/nextcloud/index.yaml b/apps/nextcloud/index.yaml index 413343f..9705a3e 100644 --- a/apps/nextcloud/index.yaml +++ b/apps/nextcloud/index.yaml @@ -6,10 +6,20 @@ metadata: name: nextcloud description: null options: - domain: - default: your-company + openid-name: + default: vynil examples: - - your-company + - vynil + type: string + domain-name: + default: your_company.com + examples: + - your_company.com + type: string + issuer: + default: letsencrypt-prod + examples: + - letsencrypt-prod type: string backups: default: @@ -117,11 +127,94 @@ options: default: false type: boolean type: object - openid-name: - default: vynil + sub-domain: + default: files examples: - - vynil + - files type: string + redis: + default: + exporter: + enabled: true + image: quay.io/opstree/redis-exporter:v1.44.0 + image: quay.io/opstree/redis:v7.0.5 + storage: 2Gi + examples: + - exporter: + enabled: true + image: quay.io/opstree/redis-exporter:v1.44.0 + image: quay.io/opstree/redis:v7.0.5 + storage: 2Gi + properties: + exporter: + default: + enabled: true + image: quay.io/opstree/redis-exporter:v1.44.0 + properties: + enabled: + default: true + type: boolean + image: + default: quay.io/opstree/redis-exporter:v1.44.0 + type: string + type: object + image: + default: quay.io/opstree/redis:v7.0.5 + type: string + storage: + default: 2Gi + type: string + type: object + postgres: + default: + replicas: 1 + storage: 5Gi + version: '14' + examples: + - replicas: 1 + storage: 5Gi + version: '14' + properties: + replicas: + default: 1 + type: integer + storage: + default: 5Gi + type: string + version: + default: '14' + type: string + type: object + hpa: + default: + avg-cpu: 50 + max-replicas: 5 + min-replicas: 1 + examples: + - avg-cpu: 50 + max-replicas: 5 + min-replicas: 1 + properties: + avg-cpu: + default: 50 + type: integer + max-replicas: + default: 5 + type: integer + min-replicas: + default: 1 + type: integer + type: object + admin: + default: + name: nextcloud_admin + examples: + - name: nextcloud_admin + properties: + name: + default: nextcloud_admin + type: string + type: object apps: default: audioplayer: false @@ -212,72 +305,10 @@ options: default: true type: boolean type: object - redis: - default: - exporter: - enabled: true - image: quay.io/opstree/redis-exporter:v1.44.0 - image: quay.io/opstree/redis:v7.0.5 - storage: 2Gi + ingress-class: + default: traefik examples: - - exporter: - enabled: true - image: quay.io/opstree/redis-exporter:v1.44.0 - image: quay.io/opstree/redis:v7.0.5 - storage: 2Gi - properties: - exporter: - default: - enabled: true - image: quay.io/opstree/redis-exporter:v1.44.0 - properties: - enabled: - default: true - type: boolean - image: - default: quay.io/opstree/redis-exporter:v1.44.0 - type: string - type: object - image: - default: quay.io/opstree/redis:v7.0.5 - type: string - storage: - default: 2Gi - type: string - type: object - storage: - default: - accessMode: ReadWriteOnce - size: 10Gi - examples: - - accessMode: ReadWriteOnce - size: 10Gi - properties: - accessMode: - default: ReadWriteOnce - enum: - - ReadWriteOnce - - ReadOnlyMany - - ReadWriteMany - type: string - size: - default: 10Gi - type: string - type: object - admin: - default: - name: nextcloud_admin - examples: - - name: nextcloud_admin - properties: - name: - default: nextcloud_admin - type: string - type: object - issuer: - default: letsencrypt-prod - examples: - - letsencrypt-prod + - traefik type: string images: default: @@ -442,60 +473,29 @@ options: type: string type: object type: object - postgres: + storage: default: - replicas: 1 - storage: 5Gi - version: '14' + accessMode: ReadWriteOnce + size: 10Gi examples: - - replicas: 1 - storage: 5Gi - version: '14' + - accessMode: ReadWriteOnce + size: 10Gi properties: - replicas: - default: 1 - type: integer - storage: - default: 5Gi + accessMode: + default: ReadWriteOnce + enum: + - ReadWriteOnce + - ReadOnlyMany + - ReadWriteMany type: string - version: - default: '14' + size: + default: 10Gi type: string type: object - domain-name: - default: your_company.com + domain: + default: your-company examples: - - your_company.com - type: string - ingress-class: - default: traefik - examples: - - traefik - type: string - hpa: - default: - avg-cpu: 50 - max-replicas: 5 - min-replicas: 1 - examples: - - avg-cpu: 50 - max-replicas: 5 - min-replicas: 1 - properties: - avg-cpu: - default: 50 - type: integer - max-replicas: - default: 5 - type: integer - min-replicas: - default: 1 - type: integer - type: object - sub-domain: - default: files - examples: - - files + - your-company type: string dependencies: - dist: null diff --git a/apps/nextcloud/ingress.tf b/apps/nextcloud/ingress.tf index 730ef47..00545b4 100644 --- a/apps/nextcloud/ingress.tf +++ b/apps/nextcloud/ingress.tf @@ -1,6 +1,6 @@ locals { dns-names = [local.dns-name] - middlewares = ["${var.instance}-https","${var.instance}-redirectregex"] + middlewares = ["${var.instance}-https","${var.instance}-redirectdav","${var.instance}-redirectindex"] service = { "name" = "${var.component}" "port" = { diff --git a/apps/nextcloud/middlewares.tf b/apps/nextcloud/middlewares.tf index d9b8a1e..8226781 100644 --- a/apps/nextcloud/middlewares.tf +++ b/apps/nextcloud/middlewares.tf @@ -1,9 +1,9 @@ -resource "kubectl_manifest" "redirectregex" { +resource "kubectl_manifest" "redirectdav" { yaml_body = <<-EOF apiVersion: traefik.containo.us/v1alpha1 kind: Middleware metadata: - name: "${var.instance}-redirectregex" + name: "${var.instance}-redirectdav" namespace: "${var.namespace}" labels: ${jsonencode(local.common-labels)} spec: @@ -13,3 +13,18 @@ spec: replacement: "https://$${1}/remote.php/dav/" EOF } +resource "kubectl_manifest" "redirectindex" { + yaml_body = <<-EOF +apiVersion: traefik.containo.us/v1alpha1 +kind: Middleware +metadata: + name: "${var.instance}-redirectindex" + namespace: "${var.namespace}" + labels: ${jsonencode(local.common-labels)} +spec: + redirectRegex: + permanent: true + regex: "https://(.*)/.well-known/(.*)" + replacement: "https://$${1}/index.php/$${2}" + EOF +}