This commit is contained in:
2024-04-25 10:14:49 +02:00
parent 8295da1c9a
commit 687a4de352
7 changed files with 73 additions and 2 deletions

View File

@@ -250,6 +250,16 @@ options:
type: string
type: object
type: array
gitea_ssh_port:
default: 2222
examples:
- 2222
type: integer
gitea_ssh_prefix:
default: git
examples:
- git
type: string
haveFlux:
default: false
examples:

View File

@@ -32,6 +32,8 @@ resource "kubectl_manifest" "organisations" {
"haveTekton" = var.haveTekton
"haveFlux" = var.haveFlux
"autoCD" = var.autoCD
"gitea_ssh_prefix" = var.gitea_ssh_prefix
"gitea_ssh_port" = var.gitea_ssh_port
},
{ for k, v in local.sorted-organisations[count.index] : k => v if !contains(["name"], k) }
))}

View File

@@ -85,12 +85,49 @@ resource "kubectl_manifest" "auto-ci-detector" {
EOF
}
resource "kubectl_manifest" "ci-git-repo" {
count = var.haveFlux?1:0
yaml_body = <<-EOF
apiVersion: source.toolkit.fluxcd.io/v1
kind: GitRepository
metadata:
name: "${var.instance}-${var.component}-ci"
namespace: "${var.namespace}"
labels: ${jsonencode(local.push-labels)}
spec:
interval: 5m0s
ref:
branch: main
secretRef:
name: ssh-credentials
url: ssh://git@${var.gitea_ssh_prefix}.${var.domain_name}:${var.gitea_ssh_port}/${var.organization}/deploy.git
EOF
}
resource "kubectl_manifest" "ci-kustomization" {
count = var.haveFlux?1:0
yaml_body = <<-EOF
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: "${var.instance}-${var.component}-ci"
namespace: "${var.namespace}"
labels: ${jsonencode(local.push-labels)}
spec:
interval: 5m
path: ./ci
prune: true
sourceRef:
kind: GitRepository
name: "${var.instance}-${var.component}-ci"
timeout: 1m
EOF
}
resource "kubectl_manifest" "ci-trigger-push" {
count = var.haveFlux?0:1
yaml_body = <<-EOF
apiVersion: triggers.tekton.dev/v1beta1
kind: Trigger
metadata:
metadata:
name: "${var.instance}-${var.component}-auto-push"
namespace: "${var.namespace}"

View File

@@ -21,6 +21,16 @@ options:
examples:
- your_company.com
type: string
gitea_ssh_port:
default: 2222
examples:
- 2222
type: integer
gitea_ssh_prefix:
default: git
examples:
- git
type: string
haveFlux:
default: false
examples:

View File

@@ -96,6 +96,7 @@ data:
template deploy-policy-default.yaml.tmpl "stages/${STAGE}/deploy/${PROJECT_NAME}/policy.yaml"
fi
copy empty-kusto.yaml "stages/${STAGE}/deploy/kustomization.yaml"
add_resources "../../../bases/deploy" "stages/${STAGE}/deploy/kustomization.yaml"
template stage-kusto.yaml.tmpl "stages/${STAGE}/${PROJECT_NAME}/kustomization.yaml"
template stage-ingress.yaml.tmpl "stages/${STAGE}/${PROJECT_NAME}/ingress.yaml"
template stage-cert.yaml.tmpl "stages/${STAGE}/${PROJECT_NAME}/cert.yaml"

View File

@@ -29,7 +29,8 @@ resource "kubectl_manifest" "tekton" {
stages: ${jsonencode(local.sorted-stage-name)}
haveFlux: ${jsonencode(var.haveFlux)}
autoCD: ${jsonencode(var.autoCD)}
gitea_ssh_prefix: ${jsonencode(var.gitea_ssh_prefix)}
gitea_ssh_port: ${jsonencode(var.gitea_ssh_port)}
EOF
}

View File

@@ -88,6 +88,16 @@ options:
examples:
- ''
type: string
gitea_ssh_port:
default: 2222
examples:
- 2222
type: integer
gitea_ssh_prefix:
default: git
examples:
- git
type: string
haveFlux:
default: false
examples: