From cdb12acc2a87452af558222c69f83ffc4173c78f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Huss?= Date: Fri, 26 Jan 2024 13:38:22 +0100 Subject: [PATCH] fix --- share/dataset-pg/index.yaml | 190 +++++++++++++++++----------------- share/dataset-pg/providers.tf | 48 +++++++++ 2 files changed, 143 insertions(+), 95 deletions(-) create mode 100644 share/dataset-pg/providers.tf diff --git a/share/dataset-pg/index.yaml b/share/dataset-pg/index.yaml index 71827b8..8cca8be 100644 --- a/share/dataset-pg/index.yaml +++ b/share/dataset-pg/index.yaml @@ -6,104 +6,16 @@ metadata: name: dataset-pg description: null options: - issuer: - default: letsencrypt-prod - examples: - - letsencrypt-prod - type: string - postgres: - default: - replicas: 1 - examples: - - replicas: 1 - properties: - replicas: - default: 1 - type: integer - type: object - sub-domain: - default: dataset-pg - examples: - - dataset-pg - type: string - ingress_class: - default: traefik - examples: - - traefik - type: string - domain_name: - default: your_company.com - examples: - - your_company.com - type: string app_group: default: api examples: - api type: string - backups: - default: - enable: false - endpoint: '' - key-id-key: s3-id - retention: - db: 30d - schedule: - db: 0 3 * * * - secret-key: s3-secret - secret-name: backup-settings + domain: + default: your-company examples: - - enable: false - endpoint: '' - key-id-key: s3-id - retention: - db: 30d - schedule: - db: 0 3 * * * - secret-key: s3-secret - secret-name: backup-settings - properties: - enable: - default: false - type: boolean - endpoint: - default: '' - type: string - key-id-key: - default: s3-id - type: string - retention: - default: - db: 30d - properties: - db: - default: 30d - type: string - type: object - schedule: - default: - db: 0 3 * * * - properties: - db: - default: 0 3 * * * - type: string - type: object - secret-key: - default: s3-secret - type: string - secret-name: - default: backup-settings - type: string - type: object - roles: - default: [] - items: - properties: - name: - default: alt-account - type: string - type: object - type: array + - your-company + type: string storage: default: postgres: @@ -121,6 +33,16 @@ options: type: string type: object type: object + domain_name: + default: your_company.com + examples: + - your_company.com + type: string + issuer: + default: letsencrypt-prod + examples: + - letsencrypt-prod + type: string extentions: default: directus: @@ -302,6 +224,79 @@ options: type: object type: object type: object + roles: + default: [] + items: + properties: + name: + default: alt-account + type: string + type: object + type: array + postgres: + default: + replicas: 1 + examples: + - replicas: 1 + properties: + replicas: + default: 1 + type: integer + type: object + backups: + default: + enable: false + endpoint: '' + key-id-key: s3-id + retention: + db: 30d + schedule: + db: 0 3 * * * + secret-key: s3-secret + secret-name: backup-settings + examples: + - enable: false + endpoint: '' + key-id-key: s3-id + retention: + db: 30d + schedule: + db: 0 3 * * * + secret-key: s3-secret + secret-name: backup-settings + properties: + enable: + default: false + type: boolean + endpoint: + default: '' + type: string + key-id-key: + default: s3-id + type: string + retention: + default: + db: 30d + properties: + db: + default: 30d + type: string + type: object + schedule: + default: + db: 0 3 * * * + properties: + db: + default: 0 3 * * * + type: string + type: object + secret-key: + default: s3-secret + type: string + secret-name: + default: backup-settings + type: string + type: object images: default: postgresql: @@ -331,10 +326,10 @@ options: type: number type: object type: object - domain: - default: your-company + sub-domain: + default: dataset-pg examples: - - your-company + - dataset-pg type: string databases: default: [] @@ -345,6 +340,11 @@ options: type: string type: object type: array + ingress_class: + default: traefik + examples: + - traefik + type: string dependencies: - dist: null category: dbo diff --git a/share/dataset-pg/providers.tf b/share/dataset-pg/providers.tf new file mode 100644 index 0000000..5e4485f --- /dev/null +++ b/share/dataset-pg/providers.tf @@ -0,0 +1,48 @@ + +terraform { + required_providers { + kustomization = { + source = "kbst/kustomization" + version = "~> 0.9.2" + } + kubernetes = { + source = "hashicorp/kubernetes" + version = "~> 2.20.0" + } + kubectl = { + source = "gavinbunney/kubectl" + version = "~> 1.14.0" + } + authentik = { + source = "goauthentik/authentik" + version = "~> 2023.5.0" + } + postgresql = { + source = "cyrilgdn/postgresql" + version = "~> 1.19.0" + } + } +} +provider "kustomization" { + kubeconfig_incluster = true +} +provider "kubernetes" { + host = "https://kubernetes.default.svc" + token = "${file("/run/secrets/kubernetes.io/serviceaccount/token")}" + cluster_ca_certificate = "${file("/run/secrets/kubernetes.io/serviceaccount/ca.crt")}" +} +provider "kubectl" { + host = "https://kubernetes.default.svc" + token = "${file("/run/secrets/kubernetes.io/serviceaccount/token")}" + cluster_ca_certificate = "${file("/run/secrets/kubernetes.io/serviceaccount/ca.crt")}" + load_config_file = false +} +provider "authentik" { + url = "http://authentik.${var.domain}-auth.svc" + token = data.kubernetes_secret_v1.authentik.data["AUTHENTIK_BOOTSTRAP_TOKEN"] +} +provider "postgresql" { + host = "${var.instance}-${var.component}-rw.${var.namespace}.svc" + username = data.kubernetes_secret_v1.postgresql_password.data["username"] + password = data.kubernetes_secret_v1.postgresql_password.data["password"] +}