This commit is contained in:
2023-10-20 12:08:53 +02:00
parent d0bc1c58c7
commit 7ea6e4167a
6 changed files with 408 additions and 341 deletions

View File

@@ -1,6 +1,6 @@
locals { locals {
pg_vars = merge([for pg in var.pg: { pg_vars = merge([for pg in var.pg: {
join("_",["LABEL_pg", pg.namespace, pg.name, pg.dbname]) = join(" | ",["pg", pg.namespace, pg.name, pg.dbname]) join("_",["LABEL_pg", pg.namespace, pg.name, pg.dbname]) = join(" | ",[pg.namespace, pg.name, pg.dbname])
join("_",["ENGINE_pg", pg.namespace, pg.name, pg.dbname]) = "postgres@dbgate-plugin-postgres" join("_",["ENGINE_pg", pg.namespace, pg.name, pg.dbname]) = "postgres@dbgate-plugin-postgres"
join("_",["SERVER_pg", pg.namespace, pg.name, pg.dbname]) = join(".",["${pg.name}-rw", pg.namespace, "svc"]) join("_",["SERVER_pg", pg.namespace, pg.name, pg.dbname]) = join(".",["${pg.name}-rw", pg.namespace, "svc"])
join("_",["PORT_pg", pg.namespace, pg.name, pg.dbname]) = "5432" join("_",["PORT_pg", pg.namespace, pg.name, pg.dbname]) = "5432"
@@ -13,7 +13,7 @@ locals {
pg_conns = [for pg in var.pg: join("_",["pg", pg.namespace, pg.name, pg.dbname])] pg_conns = [for pg in var.pg: join("_",["pg", pg.namespace, pg.name, pg.dbname])]
maria_vars = merge([for m in var.maria: { maria_vars = merge([for m in var.maria: {
join("_",["LABEL_maria", m.namespace, m.name]) = join(" | ",["maria", m.namespace, m.name]) join("_",["LABEL_maria", m.namespace, m.name]) = join(" | ",[m.namespace, m.name])
join("_",["ENGINE_maria", m.namespace, m.name]) = "mysql@dbgate-plugin-mysql" join("_",["ENGINE_maria", m.namespace, m.name]) = "mysql@dbgate-plugin-mysql"
join("_",["SERVER_maria", m.namespace, m.name]) = join(".",["${m.name}-svc", m.namespace, "svc"]) join("_",["SERVER_maria", m.namespace, m.name]) = join(".",["${m.name}-svc", m.namespace, "svc"])
join("_",["PORT_maria", m.namespace, m.name]) = "3306" join("_",["PORT_maria", m.namespace, m.name]) = "3306"
@@ -25,6 +25,14 @@ locals {
}]...) }]...)
maria_conns = [for m in var.maria: join("_",["maria", m.namespace, m.name])] maria_conns = [for m in var.maria: join("_",["maria", m.namespace, m.name])]
redis_vars = merge([for m in var.redis: {
join("_",["LABEL_redis", m.namespace, m.name]) = join(" | ",[m.namespace, m.name])
join("_",["ENGINE_redis", m.namespace, m.name]) = "redis@dbgate-plugin-redis"
join("_",["SERVER_redis", m.namespace, m.name]) = join(".",[m.name, m.namespace, "svc"])
join("_",["PORT_redis", m.namespace, m.name]) = "6379"
}]...)
redis_conns = [for m in var.maria: join("_",["redis", m.namespace, m.name])]
mongo_vars = merge([for m in var.mongo: { mongo_vars = merge([for m in var.mongo: {
join("_",["LABEL_mongo", m.namespace, m.name]) = join(" | ",["mongo", m.namespace, m.name]) join("_",["LABEL_mongo", m.namespace, m.name]) = join(" | ",["mongo", m.namespace, m.name])
join("_",["ENGINE_mongo", m.namespace, m.name]) = "mongo@dbgate-plugin-mongo" join("_",["ENGINE_mongo", m.namespace, m.name]) = "mongo@dbgate-plugin-mongo"
@@ -41,8 +49,8 @@ locals {
"OAUTH_LOGIN_FIELD" = "nickname" "OAUTH_LOGIN_FIELD" = "nickname"
"OAUTH_SCOPE" = "email" "OAUTH_SCOPE" = "email"
} }
connections = join(",",concat(local.pg_conns, local.maria_conns, local.mongo_conns)) connections = join(",", concat(local.pg_conns, local.maria_conns, local.mongo_conns, local.redis_conns))
connection_vars = merge(local.pg_vars, local.maria_vars, local.mongo_vars) connection_vars = merge(local.pg_vars, local.maria_vars, local.mongo_vars, local.redis_conns)
connection_secrets = merge(local.pg_secrets, local.mongo_secrets) connection_secrets = merge(local.pg_secrets, local.mongo_secrets)
} }

View File

@@ -6,6 +6,16 @@ metadata:
name: dbgate name: dbgate
description: null description: null
options: options:
use-oauth:
default: false
examples:
- false
type: boolean
domain:
default: your-company
examples:
- your-company
type: string
maria: maria:
default: [] default: []
examples: examples:
@@ -35,16 +45,40 @@ options:
type: string type: string
type: object type: object
type: array type: array
app-group: ingress-class:
default: dev default: traefik
examples: examples:
- dev - traefik
type: string type: string
issuer: mongo:
default: letsencrypt-prod default: []
examples: examples:
- letsencrypt-prod - []
items:
properties:
dbname:
default: ''
type: string type: string
name:
default: ''
type: string
namespace:
default: ''
type: string
secret:
properties:
key:
default: ''
type: string
name:
default: ''
type: string
type: object
username:
default: ''
type: string
type: object
type: array
images: images:
default: default:
dbgate: dbgate:
@@ -84,47 +118,39 @@ options:
type: string type: string
type: object type: object
type: object type: object
storage:
default:
accessMode: ReadWriteOnce
size: 1Gi
type: Filesystem
examples:
- accessMode: ReadWriteOnce
size: 1Gi
type: Filesystem
properties:
accessMode:
default: ReadWriteOnce
enum:
- ReadWriteOnce
- ReadOnlyMany
- ReadWriteMany
type: string
size:
default: 1Gi
type: string
type:
default: Filesystem
enum:
- Filesystem
- Block
type: string
type: object
domain-name:
default: your_company.com
examples:
- your_company.com
type: string
sub-domain: sub-domain:
default: dbgate default: dbgate
examples: examples:
- dbgate - dbgate
type: string type: string
domain: issuer:
default: your-company default: letsencrypt-prod
examples: examples:
- your-company - letsencrypt-prod
type: string
redis:
default: []
examples:
- []
items:
properties:
name:
default: ''
type: string
namespace:
default: ''
type: string
type: object
type: array
domain-name:
default: your_company.com
examples:
- your_company.com
type: string
app-group:
default: dev
examples:
- dev
type: string type: string
pg: pg:
default: [] default: []
@@ -155,45 +181,33 @@ options:
type: string type: string
type: object type: object
type: array type: array
mongo: storage:
default: [] default:
accessMode: ReadWriteOnce
size: 1Gi
type: Filesystem
examples: examples:
- [] - accessMode: ReadWriteOnce
items: size: 1Gi
type: Filesystem
properties: properties:
dbname: accessMode:
default: '' default: ReadWriteOnce
enum:
- ReadWriteOnce
- ReadOnlyMany
- ReadWriteMany
type: string type: string
name: size:
default: '' default: 1Gi
type: string type: string
namespace: type:
default: '' default: Filesystem
type: string enum:
secret: - Filesystem
properties: - Block
key:
default: ''
type: string
name:
default: ''
type: string type: string
type: object type: object
username:
default: ''
type: string
type: object
type: array
ingress-class:
default: traefik
examples:
- traefik
type: string
use-oauth:
default: false
examples:
- false
type: boolean
dependencies: dependencies:
- dist: null - dist: null
category: share category: share

View File

@@ -99,6 +99,17 @@ locals {
} if ds.engine=="mongo"]])]), } if ds.engine=="mongo"]])]),
var.external-mongos var.external-mongos
) )
"redis" = concat(
flatten([for ds in local.sorted-datasets: {
"name" = "${ds.name}-dataset-redis"
"namespace" = ds.namespace
} if ds.engine=="mongo"]),
flatten([for org in local.sorted-organisations: flatten([for stage in lookup(org, "stages", []): [for ds in org.datasets: {
"name" = "${ds.name}-dataset-redis"
"namespace" = "${var.domain}-${org.name}-${stage.name}"
} if ds.engine=="mongo"]])]),
var.external-redis
)
}, { for k, v in var.apps.dbgate : k => v if k!="enable" }) }, { for k, v in var.apps.dbgate : k => v if k!="enable" })
} }

View File

@@ -6,118 +6,20 @@ metadata:
name: domain-devspaces name: domain-devspaces
description: null description: null
options: options:
domain-name: stations:
default: your_company.com
examples:
- your_company.com
type: string
images:
default:
codeserver:
pullPolicy: IfNotPresent
registry: docker.io
repository: sebt3/code-server
tag: 4.15
examples:
- codeserver:
pullPolicy: IfNotPresent
registry: docker.io
repository: sebt3/code-server
tag: 4.15
properties:
codeserver:
default:
pullPolicy: IfNotPresent
registry: docker.io
repository: sebt3/code-server
tag: 4.15
properties:
pullPolicy:
default: IfNotPresent
enum:
- Always
- Never
- IfNotPresent
type: string
registry:
default: docker.io
type: string
repository:
default: sebt3/code-server
type: string
tag:
default: 4.15
type: number
type: object
type: object
distributions:
default:
core: core
domain: domain
examples:
- core: core
domain: domain
properties:
core:
default: core
type: string
domain:
default: domain
type: string
type: object
external-pgs:
default: [] default: []
examples: examples:
- [] - []
items: items:
properties: properties:
dbname:
default: ''
type: string
name: name:
default: '' default: ''
type: string type: string
namespace: organisations:
default: '' default: []
items:
type: string type: string
secret:
properties:
key:
default: ''
type: string
name:
default: ''
type: string
type: object
username:
default: ''
type: string
type: object
type: array type: array
external-marias:
default: []
examples:
- []
items:
properties:
name:
default: ''
type: string
namespace:
default: ''
type: string
secret:
properties:
key:
default: ''
type: string
name:
default: ''
type: string
type: object
username:
default: ''
type: string
type: object type: object
type: array type: array
organisations: organisations:
@@ -161,41 +63,40 @@ options:
type: array type: array
type: object type: object
type: array type: array
storage-classes: domain-name:
default: default: your_company.com
BlockReadWriteMany: ''
BlockReadWriteOnce: ''
FilesystemReadWriteMany: ''
FilesystemReadWriteOnce: ''
examples: examples:
- BlockReadWriteMany: '' - your_company.com
BlockReadWriteOnce: '' type: string
FilesystemReadWriteMany: '' external-pgs:
FilesystemReadWriteOnce: '' default: []
examples:
- []
items:
properties: properties:
BlockReadWriteMany: dbname:
default: '' default: ''
type: string type: string
BlockReadWriteOnce: name:
default: '' default: ''
type: string type: string
FilesystemReadWriteMany: namespace:
default: '' default: ''
type: string type: string
FilesystemReadWriteOnce: secret:
properties:
key:
default: ''
type: string
name:
default: '' default: ''
type: string type: string
type: object type: object
domain: username:
default: your-company default: ''
examples:
- your-company
type: string
issuer:
default: letsencrypt-prod
examples:
- letsencrypt-prod
type: string type: string
type: object
type: array
stations-sub-domain: stations-sub-domain:
default: code default: code
examples: examples:
@@ -231,7 +132,7 @@ options:
default: backup-settings default: backup-settings
type: string type: string
type: object type: object
stations: external-marias:
default: [] default: []
examples: examples:
- [] - []
@@ -240,11 +141,21 @@ options:
name: name:
default: '' default: ''
type: string type: string
organisations: namespace:
default: [] default: ''
items: type: string
secret:
properties:
key:
default: ''
type: string
name:
default: ''
type: string
type: object
username:
default: ''
type: string type: string
type: array
type: object type: object
type: array type: array
external-mongos: external-mongos:
@@ -276,11 +187,119 @@ options:
type: string type: string
type: object type: object
type: array type: array
distributions:
default:
core: core
domain: domain
examples:
- core: core
domain: domain
properties:
core:
default: core
type: string
domain:
default: domain
type: string
type: object
external-redis:
default: []
examples:
- []
items:
properties:
name:
default: ''
type: string
namespace:
default: ''
type: string
type: object
type: array
images:
default:
codeserver:
pullPolicy: IfNotPresent
registry: docker.io
repository: sebt3/code-server
tag: 4.15
examples:
- codeserver:
pullPolicy: IfNotPresent
registry: docker.io
repository: sebt3/code-server
tag: 4.15
properties:
codeserver:
default:
pullPolicy: IfNotPresent
registry: docker.io
repository: sebt3/code-server
tag: 4.15
properties:
pullPolicy:
default: IfNotPresent
enum:
- Always
- Never
- IfNotPresent
type: string
registry:
default: docker.io
type: string
repository:
default: sebt3/code-server
type: string
tag:
default: 4.15
type: number
type: object
type: object
issuer:
default: letsencrypt-prod
examples:
- letsencrypt-prod
type: string
domain:
default: your-company
examples:
- your-company
type: string
ingress-class: ingress-class:
default: traefik default: traefik
examples: examples:
- traefik - traefik
type: string type: string
app-group:
default: dev
examples:
- dev
type: string
storage-classes:
default:
BlockReadWriteMany: ''
BlockReadWriteOnce: ''
FilesystemReadWriteMany: ''
FilesystemReadWriteOnce: ''
examples:
- BlockReadWriteMany: ''
BlockReadWriteOnce: ''
FilesystemReadWriteMany: ''
FilesystemReadWriteOnce: ''
properties:
BlockReadWriteMany:
default: ''
type: string
BlockReadWriteOnce:
default: ''
type: string
FilesystemReadWriteMany:
default: ''
type: string
FilesystemReadWriteOnce:
default: ''
type: string
type: object
apps: apps:
default: default:
dbgate: dbgate:
@@ -334,11 +353,6 @@ options:
type: boolean type: boolean
type: object type: object
type: object type: object
app-group:
default: dev
examples:
- dev
type: string
dependencies: [] dependencies: []
providers: providers:
kubernetes: true kubernetes: true

View File

@@ -6,43 +6,65 @@ metadata:
name: domain name: domain
description: null description: null
options: options:
auth: apps:
default: default:
enable: false
nextcloud:
enable: true enable: true
examples: examples:
- enable: true - enable: false
nextcloud:
enable: true
properties:
enable:
default: false
type: boolean
nextcloud:
default:
enable: true
properties: properties:
enable: enable:
default: true default: true
type: boolean type: boolean
type: object type: object
type: object
ingress-class: ingress-class:
default: traefik default: traefik
examples: examples:
- traefik - traefik
type: string type: string
infra: domain-name:
default: your_company.com
examples:
- your_company.com
type: string
ci:
default: default:
enable: false enable: false
traefik: gitea:
enable: false enable: true
examples: examples:
- enable: false - enable: false
traefik: gitea:
enable: false enable: true
properties: properties:
enable: enable:
default: false default: false
type: boolean type: boolean
traefik: gitea:
default: default:
enable: false enable: true
properties: properties:
enable: enable:
default: false default: true
type: boolean type: boolean
type: object type: object
type: object type: object
issuer:
default: letsencrypt-prod
examples:
- letsencrypt-prod
type: string
erp: erp:
default: default:
dolibarr: dolibarr:
@@ -65,36 +87,16 @@ options:
default: false default: false
type: boolean type: boolean
type: object type: object
distributions: auth:
default: default:
core: core enable: true
domain: domain
examples: examples:
- core: core - enable: true
domain: domain
properties:
core:
default: core
type: string
domain:
default: domain
type: string
type: object
devspaces:
default:
enable: false
examples:
- enable: false
properties: properties:
enable: enable:
default: false default: true
type: boolean type: boolean
type: object type: object
domain-name:
default: your_company.com
examples:
- your_company.com
type: string
backups: backups:
default: default:
enable: false enable: false
@@ -125,6 +127,75 @@ options:
default: backup-settings default: backup-settings
type: string type: string
type: object type: object
infra:
default:
enable: false
traefik:
enable: false
examples:
- enable: false
traefik:
enable: false
properties:
enable:
default: false
type: boolean
traefik:
default:
enable: false
properties:
enable:
default: false
type: boolean
type: object
type: object
devspaces:
default:
enable: false
examples:
- enable: false
properties:
enable:
default: false
type: boolean
type: object
distributions:
default:
core: core
domain: domain
examples:
- core: core
domain: domain
properties:
core:
default: core
type: string
domain:
default: domain
type: string
type: object
mail:
default:
enable: false
wildduck:
enable: true
examples:
- enable: false
wildduck:
enable: true
properties:
enable:
default: false
type: boolean
wildduck:
default:
enable: true
properties:
enable:
default: true
type: boolean
type: object
type: object
storage-classes: storage-classes:
default: default:
BlockReadWriteMany: '' BlockReadWriteMany: ''
@@ -150,77 +221,6 @@ options:
default: '' default: ''
type: string type: string
type: object type: object
issuer:
default: letsencrypt-prod
examples:
- letsencrypt-prod
type: string
apps:
default:
enable: false
nextcloud:
enable: true
examples:
- enable: false
nextcloud:
enable: true
properties:
enable:
default: false
type: boolean
nextcloud:
default:
enable: true
properties:
enable:
default: true
type: boolean
type: object
type: object
mail:
default:
enable: false
wildduck:
enable: true
examples:
- enable: false
wildduck:
enable: true
properties:
enable:
default: false
type: boolean
wildduck:
default:
enable: true
properties:
enable:
default: true
type: boolean
type: object
type: object
ci:
default:
enable: false
gitea:
enable: true
examples:
- enable: false
gitea:
enable: true
properties:
enable:
default: false
type: boolean
gitea:
default:
enable: true
properties:
enable:
default: true
type: boolean
type: object
type: object
dependencies: [] dependencies: []
providers: providers:
kubernetes: null kubernetes: null

View File

@@ -81,7 +81,27 @@ locals {
"name" = "gitea-gitea-pg-app" "name" = "gitea-gitea-pg-app"
"key" = "password" "key" = "password"
} }
}]:[]) }]:[], lookup(var.devspaces, "external-pgs", []))
external-mongos = concat(var.mail.enable&&var.mail.wildduck.enable?[{
"name" = "wildduck-wildduck-mongo"
"dbname" = "wildduck"
"username" = "wildduck"
"namespace" = "${var.namespace}-mail"
"secret" = {
"name" = "wildduck-wildduck-mongo"
"key" = "password"
}
}]:[], lookup(var.devspaces, "external-mongos", []))
external-redis = concat(var.mail.enable&&var.mail.wildduck.enable?[{
"name" = "wildduck-wildduck-redis"
"namespace" = "${var.namespace}-mail"
}]:[], var.erp.enable&&var.erp.dolibarr.enable?[{
"name" = "dolibarr-dolibarr-redis"
"namespace" = "${var.namespace}-erp"
}]:[], var.apps.enable&&var.apps.nextcloud.enable?[{
"name" = "nextcloud-nextcloud-redis"
"namespace" = "${var.namespace}-files"
}]:[], lookup(var.devspaces, "external-redis", []))
} }
} }
@@ -194,6 +214,6 @@ resource "kubectl_manifest" "devspaces" {
distrib: "${var.distributions.domain}" distrib: "${var.distributions.domain}"
category: "meta" category: "meta"
component: "domain-devspaces" component: "domain-devspaces"
options: ${jsonencode(merge(local.global, local.devspaces-custom, local.devspaces))} options: ${jsonencode(merge(local.global, local.devspaces, local.devspaces-custom))}
EOF EOF
} }