fix
This commit is contained in:
113
share/organisation/index.yaml
Normal file
113
share/organisation/index.yaml
Normal file
@@ -0,0 +1,113 @@
|
||||
---
|
||||
apiVersion: vinyl.solidite.fr/v1beta1
|
||||
kind: Component
|
||||
category: share
|
||||
metadata:
|
||||
name: organisation
|
||||
description: null
|
||||
options:
|
||||
backups:
|
||||
default:
|
||||
enable: false
|
||||
endpoint: ''
|
||||
key-id-key: s3-id
|
||||
secret-key: s3-secret
|
||||
secret-name: backup-settings
|
||||
examples:
|
||||
- enable: false
|
||||
endpoint: ''
|
||||
key-id-key: s3-id
|
||||
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
|
||||
secret-key:
|
||||
default: s3-secret
|
||||
type: string
|
||||
secret-name:
|
||||
default: backup-settings
|
||||
type: string
|
||||
type: object
|
||||
datasets:
|
||||
default: []
|
||||
items:
|
||||
properties:
|
||||
engine:
|
||||
default: pg
|
||||
type: string
|
||||
name:
|
||||
default: ''
|
||||
type: string
|
||||
type: object
|
||||
type: array
|
||||
domain-name:
|
||||
default: your_company.com
|
||||
examples:
|
||||
- your_company.com
|
||||
type: string
|
||||
domain:
|
||||
default: your-company
|
||||
examples:
|
||||
- your-company
|
||||
type: string
|
||||
ingress-class:
|
||||
default: traefik
|
||||
examples:
|
||||
- traefik
|
||||
type: string
|
||||
app-group:
|
||||
default: dev
|
||||
examples:
|
||||
- dev
|
||||
type: string
|
||||
distributions:
|
||||
default:
|
||||
core: core
|
||||
domain: domain
|
||||
examples:
|
||||
- core: core
|
||||
domain: domain
|
||||
properties:
|
||||
core:
|
||||
default: core
|
||||
type: string
|
||||
domain:
|
||||
default: domain
|
||||
type: string
|
||||
type: object
|
||||
issuer:
|
||||
default: letsencrypt-prod
|
||||
examples:
|
||||
- letsencrypt-prod
|
||||
type: string
|
||||
haveGitea:
|
||||
default: false
|
||||
examples:
|
||||
- false
|
||||
type: boolean
|
||||
stages:
|
||||
default: []
|
||||
items:
|
||||
properties:
|
||||
name:
|
||||
default: prod
|
||||
type: string
|
||||
type: object
|
||||
type: array
|
||||
dependencies: []
|
||||
providers:
|
||||
kubernetes: true
|
||||
authentik: null
|
||||
kubectl: true
|
||||
postgresql: null
|
||||
restapi: null
|
||||
http: null
|
||||
tfaddtype: null
|
||||
58
share/organisation/stages.tf
Normal file
58
share/organisation/stages.tf
Normal file
@@ -0,0 +1,58 @@
|
||||
locals {
|
||||
annotations = {
|
||||
"vynil.solidite.fr/name" = "${var.component}"
|
||||
"vynil.solidite.fr/domain" = var.domain-name
|
||||
"vynil.solidite.fr/issuer" = var.issuer
|
||||
"vynil.solidite.fr/ingress" = var.ingress-class
|
||||
}
|
||||
global = {
|
||||
"domain" = var.namespace
|
||||
"domain-name" = var.domain-name
|
||||
"issuer" = var.issuer
|
||||
"ingress-class" = var.ingress-class
|
||||
"backups" = var.backups
|
||||
"app-group" = var.app-group
|
||||
}
|
||||
sorted-stage-name = reverse(distinct(sort([for s in var.stages: s.name])))
|
||||
sorted-dataset-name = reverse(distinct(sort([for d in var.datasets: d.name])))
|
||||
sorted-stages = flatten([
|
||||
for name in local.sorted-stage-name: [
|
||||
for s in var.stages:
|
||||
merge({s, {"namespace" = "${var.domain}-${var.instance}-${name}"}}) if s.name == name
|
||||
]
|
||||
])
|
||||
sorted-datasets = flatten([
|
||||
for stage in local.sorted-stage-name: flatten([
|
||||
for name in local.sorted-dataset-name: [
|
||||
for ds in var.datasets:
|
||||
merge(ds,{"namespace" = "${var.domain}-${var.instance}-${stage}"}) if ds.name == name
|
||||
]
|
||||
])
|
||||
])
|
||||
}
|
||||
resource "kubernetes_namespace_v1" "ns" {
|
||||
count = length(local.sorted-stages)
|
||||
metadata {
|
||||
annotations = local.annotations
|
||||
labels = merge(local.common-labels, local.annotations)
|
||||
name = local.sorted-stages[count.index].namespace
|
||||
}
|
||||
}
|
||||
|
||||
resource "kubectl_manifest" "datasets" {
|
||||
count = length(local.sorted-datasets)
|
||||
depends_on = [kubernetes_namespace_v1.ns]
|
||||
yaml_body = <<-EOF
|
||||
apiVersion: "vynil.solidite.fr/v1"
|
||||
kind: "Install"
|
||||
metadata:
|
||||
name: "${local.sorted-datasets[count.index].name}"
|
||||
namespace: "${local.sorted-datasets[count.index].namespace}"
|
||||
labels: ${jsonencode(local.common-labels)}
|
||||
spec:
|
||||
distrib: "${var.distributions.domain}"
|
||||
category: "share"
|
||||
component: "dataset-${local.sorted-datasets[count.index].engine}"
|
||||
options: ${jsonencode(merge(local.global, { for k, v in local.sorted-datasets[count.index] : k => v if !contains(["name","namespace","engine"], k) }))}
|
||||
EOF
|
||||
}
|
||||
Reference in New Issue
Block a user