This commit is contained in:
2023-08-12 11:53:33 +02:00
parent 5e5b0f2470
commit 30bf0874ae
8 changed files with 1003 additions and 505 deletions

View File

@@ -9,15 +9,30 @@ metadata:
A painless self-hosted Git service.
Gitea is a community managed lightweight code hosting solution written in Go. It is published under the MIT license.
options:
ssh-port:
default: 2222
timezone:
default: Europe/Paris
examples:
- 2222
type: integer
ingress-class:
default: traefik
- Europe/Paris
type: string
load-balancer:
default:
ip: ''
examples:
- traefik
- ip: ''
properties:
ip:
default: ''
type: string
type: object
issuer:
default: letsencrypt-prod
examples:
- letsencrypt-prod
type: string
domain:
default: your-company
examples:
- your-company
type: string
webhook:
default:
@@ -34,35 +49,10 @@ options:
default: false
type: boolean
type: object
domain-name:
default: your_company.com
sub-domain:
default: git
examples:
- your_company.com
type: string
replicas:
default: 1
examples:
- 1
type: integer
volume:
default:
size: 10Gi
examples:
- size: 10Gi
properties:
size:
default: 10Gi
type: string
type: object
theme:
default: gitea-modern
examples:
- gitea-modern
type: string
default-branch:
default: main
examples:
- main
- git
type: string
postgres:
default:
@@ -84,6 +74,182 @@ options:
default: '14'
type: string
type: object
release:
default: 8.3.0
examples:
- 8.3.0
type: string
disable-registration:
default: true
examples:
- true
type: boolean
ingress-class:
default: traefik
examples:
- traefik
type: string
replicas:
default: 1
examples:
- 1
type: integer
backups:
default:
enable: false
endpoint: ''
key-id-key: s3-id
restic-key: bck-password
retention:
db: 30d
keepDaily: 14
keepMonthly: 12
keepWeekly: 6
keepYearly: 12
schedule:
backup: 10 3 * * *
check: 10 5 * * 1
db: 10 3 * * *
prune: 10 1 * * 0
secret-key: s3-secret
secret-name: backup-settings
examples:
- enable: false
endpoint: ''
key-id-key: s3-id
restic-key: bck-password
retention:
db: 30d
keepDaily: 14
keepMonthly: 12
keepWeekly: 6
keepYearly: 12
schedule:
backup: 10 3 * * *
check: 10 5 * * 1
db: 10 3 * * *
prune: 10 1 * * 0
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
restic-key:
default: bck-password
type: string
retention:
default:
db: 30d
keepDaily: 14
keepMonthly: 12
keepWeekly: 6
keepYearly: 12
properties:
db:
default: 30d
type: string
keepDaily:
default: 14
type: integer
keepMonthly:
default: 12
type: integer
keepWeekly:
default: 6
type: integer
keepYearly:
default: 12
type: integer
type: object
schedule:
default:
backup: 10 3 * * *
check: 10 5 * * 1
db: 10 3 * * *
prune: 10 1 * * 0
properties:
backup:
default: 10 3 * * *
type: string
check:
default: 10 5 * * 1
type: string
db:
default: 10 3 * * *
type: string
prune:
default: 10 1 * * 0
type: string
type: object
secret-key:
default: s3-secret
type: string
secret-name:
default: backup-settings
type: string
type: object
volume:
default:
size: 10Gi
examples:
- size: 10Gi
properties:
size:
default: 10Gi
type: string
type: object
default-branch:
default: main
examples:
- main
type: string
push-create:
default:
org: 'true'
private: 'false'
user: 'true'
examples:
- org: 'true'
private: 'false'
user: 'true'
properties:
org:
default: 'true'
type: string
private:
default: 'false'
type: string
user:
default: 'true'
type: string
type: object
admin:
default:
email: git-admin@git.your_company.com
name: gitea_admin
examples:
- email: git-admin@git.your_company.com
name: gitea_admin
properties:
email:
default: git-admin@git.your_company.com
type: string
name:
default: gitea_admin
type: string
type: object
ssh-port:
default: 2222
examples:
- 2222
type: integer
images:
default:
gitea:
@@ -147,81 +313,16 @@ options:
type: string
type: object
type: object
load-balancer:
default:
ip: ''
theme:
default: gitea-modern
examples:
- ip: ''
properties:
ip:
default: ''
type: string
type: object
timezone:
default: Europe/Paris
examples:
- Europe/Paris
- gitea-modern
type: string
disable-registration:
default: true
domain-name:
default: your_company.com
examples:
- true
type: boolean
sub-domain:
default: git
examples:
- git
- your_company.com
type: string
release:
default: 8.3.0
examples:
- 8.3.0
type: string
issuer:
default: letsencrypt-prod
examples:
- letsencrypt-prod
type: string
push-create:
default:
org: 'true'
private: 'false'
user: 'true'
examples:
- org: 'true'
private: 'false'
user: 'true'
properties:
org:
default: 'true'
type: string
private:
default: 'false'
type: string
user:
default: 'true'
type: string
type: object
domain:
default: your-company
examples:
- your-company
type: string
admin:
default:
email: git-admin@git.your_company.com
name: gitea_admin
examples:
- email: git-admin@git.your_company.com
name: gitea_admin
properties:
email:
default: git-admin@git.your_company.com
type: string
name:
default: gitea_admin
type: string
type: object
dependencies:
- dist: null
category: share

View File

@@ -2,6 +2,23 @@ locals {
pg-labels = merge(local.common-labels, {
"app.kubernetes.io/component" = "pg"
})
backup-def = var.backups.enable ? {
retentionPolicy = var.backups.retention.db
barmanObjectStore = {
destinationPath = "s3://${var.instance}-${var.namespace}/"
endpointURL = "${var.backups.endpoint}/barman"
s3Credentials = {
accessKeyId = {
name = var.backups.secret-name
key = var.backups.key-id-key
}
secretAccessKey = {
name = var.backups.secret-name
key = var.backups.secret-key
}
}
}
} : {}
}
resource "kubectl_manifest" "prj_pg" {
@@ -16,5 +33,28 @@ resource "kubectl_manifest" "prj_pg" {
instances: ${var.postgres.replicas}
storage:
size: "${var.postgres.storage}"
monitoring:
enablePodMonitor: true
bootstrap:
initdb:
database: "${var.component}"
owner: "${var.component}"
backup: ${jsonencode(local.backup-def)}
EOF
}
resource "kubectl_manifest" "prj_pg_backup" {
yaml_body = <<-EOF
apiVersion: postgresql.cnpg.io/v1
kind: ScheduledBackup
metadata:
name: "${var.instance}-${var.component}-pg"
namespace: "${var.namespace}"
labels: ${jsonencode(local.pg-labels)}
spec:
schedule: "${var.backups.schedule.db}"
backupOwnerReference: self
cluster:
name: "${var.instance}-${var.component}-pg"
EOF
}