diff --git a/apps/okd/index.yaml b/apps/okd/index.yaml index 4375d31..af78fab 100644 --- a/apps/okd/index.yaml +++ b/apps/okd/index.yaml @@ -6,6 +6,46 @@ metadata: name: okd description: null options: + namespaces: + default: [] + items: + type: string + type: array + cluster-admin: + default: false + examples: + - false + type: boolean + ingress-class: + default: traefik + examples: + - traefik + type: string + app-group: + default: infra + examples: + - infra + type: string + domain: + default: your-company + examples: + - your-company + type: string + issuer: + default: letsencrypt-prod + examples: + - letsencrypt-prod + type: string + sub-domain: + default: okd + examples: + - okd + type: string + domain-name: + default: your_company.com + examples: + - your_company.com + type: string images: default: okd: @@ -49,46 +89,6 @@ options: type: string type: object type: object - domain-name: - default: your_company.com - examples: - - your_company.com - type: string - sub-domain: - default: okd - examples: - - okd - type: string - issuer: - default: letsencrypt-prod - examples: - - letsencrypt-prod - type: string - domain: - default: your-company - examples: - - your-company - type: string - cluster-admin: - default: true - examples: - - true - type: boolean - namespaces: - default: [] - items: - type: string - type: array - app-group: - default: infra - examples: - - infra - type: string - ingress-class: - default: traefik - examples: - - traefik - type: string dependencies: - dist: null category: share diff --git a/meta/domain-devspaces/apps.tf b/meta/domain-devspaces/apps.tf index c1d0d98..389f5f9 100644 --- a/meta/domain-devspaces/apps.tf +++ b/meta/domain-devspaces/apps.tf @@ -14,6 +14,15 @@ locals { "backups" = var.backups "app-group" = var.app-group } + global-apps = merge(local.global, {"domain-name" = "devtools.${var.domain-name}"}) + dev-ns = concat([ + for station in local.sorted-station-names: "${var.domain}-devspaces-${station}" + ],flatten([ + for org in local.sorted-organisations:[ + for stage in reverse(distinct(sort([for s in org.stages: s.name]))): "${var.domain}-${org.name}-${stage}" + ] + ])) + okd = merge({"namespaces" = local.dev-ns}, { for k, v in var.apps.okd : k => v if k!="enable" }) dbgate = { for k, v in var.apps.dbgate : k => v if k!="enable" } # dbgate_pgs = flatten([for i in local.sorted-datasets: [ # for db in @@ -21,7 +30,7 @@ locals { } resource "kubernetes_namespace_v1" "apps-ns" { - count = var.apps.dbgate.enable ? 1 : 0 + count = (var.apps.dbgate.enable || var.apps.okd.enable) ? 1 : 0 metadata { annotations = local.annotations labels = merge(local.common-labels, local.annotations) @@ -29,6 +38,24 @@ resource "kubernetes_namespace_v1" "apps-ns" { } } +resource "kubectl_manifest" "okd" { + count = var.apps.okd.enable ? 1 : 0 + depends_on = [kubernetes_namespace_v1.apps-ns] + yaml_body = <<-EOF + apiVersion: "vynil.solidite.fr/v1" + kind: "Install" + metadata: + name: "dev-okd" + namespace: "${kubernetes_namespace_v1.apps-ns[0].metadata[0].name}" + labels: ${jsonencode(local.common-labels)} + spec: + distrib: "${var.distributions.domain}" + category: "apps" + component: "okd" + options: ${jsonencode(merge(local.global-apps, local.okd))} + EOF +} + resource "kubectl_manifest" "dbgate" { count = var.apps.dbgate.enable ? 1 : 0 depends_on = [kubernetes_namespace_v1.apps-ns] @@ -37,12 +64,12 @@ resource "kubectl_manifest" "dbgate" { kind: "Install" metadata: name: "dbgate" - namespace: "${var.namespace}-devapps" + namespace: "${kubernetes_namespace_v1.apps-ns[0].metadata[0].name}" labels: ${jsonencode(local.common-labels)} spec: distrib: "${var.distributions.domain}" category: "apps" component: "dbgate" - options: ${jsonencode(merge(local.global, local.dbgate))} + options: ${jsonencode(merge(local.global-apps, local.dbgate))} EOF } diff --git a/meta/domain-devspaces/index.yaml b/meta/domain-devspaces/index.yaml index 40b6f09..7d7ec74 100644 --- a/meta/domain-devspaces/index.yaml +++ b/meta/domain-devspaces/index.yaml @@ -6,73 +6,16 @@ metadata: name: domain-devspaces description: null options: - issuer: - default: letsencrypt-prod + domain-name: + default: your_company.com examples: - - letsencrypt-prod + - your_company.com type: string - organisations: - default: [] + domain: + default: your-company examples: - - [] - items: - properties: - datasets: - default: [] - items: - properties: - engine: - default: pg - type: string - name: - default: '' - type: string - type: object - type: array - name: - 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 + - your-company + type: string backups: default: enable: false @@ -103,46 +46,64 @@ options: default: backup-settings type: string type: object + apps: + default: + dbgate: + enable: false + okd: + enable: false + superset: + enable: false + yaade: + enable: false + examples: + - dbgate: + enable: false + okd: + enable: false + superset: + enable: false + yaade: + enable: false + properties: + dbgate: + default: + enable: false + properties: + enable: + default: false + type: boolean + type: object + okd: + default: + enable: false + properties: + enable: + default: false + type: boolean + type: object + superset: + default: + enable: false + properties: + enable: + default: false + type: boolean + type: object + yaade: + default: + enable: false + properties: + enable: + default: false + type: boolean + type: object + type: object stations-sub-domain: default: code examples: - code 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 - domain: - default: your-company - examples: - - your-company - type: string - app-group: - default: dev - examples: - - dev - type: string external-databases: default: [] examples: @@ -186,52 +147,36 @@ options: type: object type: object type: array - apps: - default: - dbgate: - enable: false - superset: - enable: false - yaade: - enable: false + app-group: + default: dev examples: - - dbgate: - enable: false - superset: - enable: false - yaade: - enable: false - properties: - dbgate: - default: - enable: false - properties: - enable: - default: false - type: boolean - type: object - superset: - default: - enable: false - properties: - enable: - default: false - type: boolean - type: object - yaade: - default: - enable: false - properties: - enable: - default: false - type: boolean - type: object - type: object - domain-name: - default: your_company.com - examples: - - your_company.com + - 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 stations: default: [] examples: @@ -248,6 +193,82 @@ options: type: array 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 + organisations: + default: [] + examples: + - [] + items: + properties: + datasets: + default: [] + items: + properties: + engine: + default: pg + type: string + name: + default: '' + type: string + type: object + type: array + name: + default: '' + type: string + stages: + default: [] + items: + properties: + name: + default: prod + type: string + type: object + type: array + type: object + type: array ingress-class: default: traefik examples: diff --git a/meta/domain-infra/apps.tf b/meta/domain-infra/apps.tf index 5b2ffa8..e11beb9 100644 --- a/meta/domain-infra/apps.tf +++ b/meta/domain-infra/apps.tf @@ -17,7 +17,7 @@ locals { traefik = { for k, v in var.traefik : k => v if k!="enable" } dns = { for k, v in var.dns : k => v if k!="enable" } api = { for k, v in var.api : k => v if k!="enable" } - okd = { for k, v in var.okd : k => v if k!="enable" } + okd = merge({"cluster-admin" = true}, { for k, v in var.okd : k => v if k!="enable" }) } resource "kubernetes_namespace_v1" "infra-ns" { @@ -65,7 +65,7 @@ resource "kubectl_manifest" "traefik" { } resource "kubectl_manifest" "k8s_api" { - count = var.traefik.enable ? 1 : 0 + count = var.api.enable ? 1 : 0 yaml_body = <<-EOF apiVersion: "vynil.solidite.fr/v1" kind: "Install" @@ -88,7 +88,7 @@ resource "kubectl_manifest" "okd" { apiVersion: "vynil.solidite.fr/v1" kind: "Install" metadata: - name: "okd" + name: "infra-okd" namespace: "${kubernetes_namespace_v1.infra-ns[0].metadata[0].name}" labels: ${jsonencode(local.common-labels)} spec: diff --git a/meta/domain-infra/index.yaml b/meta/domain-infra/index.yaml index 208920a..f132bb8 100644 --- a/meta/domain-infra/index.yaml +++ b/meta/domain-infra/index.yaml @@ -6,56 +6,6 @@ metadata: name: domain-infra description: null options: - ingress-class: - default: traefik - examples: - - traefik - type: string - app-group: - default: infra - examples: - - infra - type: string - okd: - default: - enable: false - examples: - - enable: false - properties: - enable: - default: false - type: boolean - type: object - domain-name: - default: your_company.com - examples: - - your_company.com - type: string - traefik: - default: - enable: false - namespace: traefik - examples: - - enable: false - namespace: traefik - properties: - enable: - default: false - type: boolean - namespace: - default: traefik - type: string - type: object - api: - default: - enable: false - examples: - - enable: false - properties: - enable: - default: false - type: boolean - type: object storage-classes: default: BlockReadWriteMany: '' @@ -81,17 +31,32 @@ options: default: '' type: string type: object - domain: - default: your-company - examples: - - your-company - type: string issuer: default: letsencrypt-prod examples: - letsencrypt-prod type: string - dns: + traefik: + default: + enable: false + namespace: traefik + examples: + - enable: false + namespace: traefik + properties: + enable: + default: false + type: boolean + namespace: + default: traefik + type: string + type: object + domain-name: + default: your_company.com + examples: + - your_company.com + type: string + api: default: enable: false examples: @@ -116,6 +81,11 @@ options: default: domain type: string type: object + app-group: + default: infra + examples: + - infra + type: string backups: default: enable: false @@ -146,6 +116,36 @@ options: default: backup-settings type: string type: object + okd: + default: + enable: false + examples: + - enable: false + properties: + enable: + default: false + type: boolean + type: object + dns: + default: + enable: false + examples: + - enable: false + properties: + enable: + default: false + type: boolean + type: object + ingress-class: + default: traefik + examples: + - traefik + type: string + domain: + default: your-company + examples: + - your-company + type: string dependencies: [] providers: kubernetes: true