This commit is contained in:
2023-09-20 14:12:55 +02:00
parent 2b93be7324
commit 287b4b8caa
6 changed files with 453 additions and 423 deletions

View File

@@ -9,15 +9,35 @@ 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:
volume:
default:
size: 10Gi
ingress-class:
default: traefik
examples:
- size: 10Gi
- traefik
type: string
domain-name:
default: your_company.com
examples:
- your_company.com
type: string
release:
default: 8.3.0
examples:
- 8.3.0
type: string
webhook:
default:
allowed-hosts: private
skip-tls-verify: false
examples:
- allowed-hosts: private
skip-tls-verify: false
properties:
size:
default: 10Gi
allowed-hosts:
default: private
type: string
skip-tls-verify:
default: false
type: boolean
type: object
postgres:
default:
@@ -39,16 +59,91 @@ options:
default: '14'
type: string
type: object
disable-registration:
default: true
sub-domain:
default: git
examples:
- true
type: boolean
- git
type: string
replicas:
default: 1
examples:
- 1
type: integer
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
timezone:
default: Europe/Paris
examples:
- Europe/Paris
type: string
ssh-port:
default: 2222
examples:
- 2222
type: integer
domain:
default: your-company
examples:
- your-company
type: string
default-branch:
default: main
examples:
- main
type: string
theme:
default: gitea-modern
examples:
- gitea-modern
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
volume:
default:
size: 10Gi
examples:
- size: 10Gi
properties:
size:
default: 10Gi
type: string
type: object
images:
default:
gitea:
@@ -112,16 +207,21 @@ options:
type: string
type: object
type: object
sub-domain:
default: git
disable-registration:
default: true
examples:
- git
type: string
ssh-port:
default: 2222
- true
type: boolean
load-balancer:
default:
ip: ''
examples:
- 2222
type: integer
- ip: ''
properties:
ip:
default: ''
type: string
type: object
backups:
default:
enable: false
@@ -228,106 +328,6 @@ options:
default: false
type: boolean
type: object
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
load-balancer:
default:
ip: ''
examples:
- ip: ''
properties:
ip:
default: ''
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
ingress-class:
default: traefik
examples:
- traefik
type: string
timezone:
default: Europe/Paris
examples:
- Europe/Paris
type: string
replicas:
default: 1
examples:
- 1
type: integer
issuer:
default: letsencrypt-prod
examples:
- letsencrypt-prod
type: string
default-branch:
default: main
examples:
- main
type: string
release:
default: 8.3.0
examples:
- 8.3.0
type: string
webhook:
default:
allowed-hosts: private
skip-tls-verify: false
examples:
- allowed-hosts: private
skip-tls-verify: false
properties:
allowed-hosts:
default: private
type: string
skip-tls-verify:
default: false
type: boolean
type: object
domain-name:
default: your_company.com
examples:
- your_company.com
type: string
theme:
default: gitea-modern
examples:
- gitea-modern
type: string
dependencies:
- dist: null
category: share

View File

@@ -1,5 +1,7 @@
locals {
app-name = var.component == var.instance ? var.instance : format("%s-%s", var.component, var.instance)
main-group = format("app-%s", local.app-name)
base-dn = format("dc=%s", join(",dc=", split(".", format("%s.%s", var.sub-domain, var.domain-name))))
base-group-dn = format("ou=groups,%s", local.base-dn)
base-user-dn = format("ou=users,%s", local.base-dn)
@@ -87,7 +89,8 @@ resource "authentik_application" "gitea_application" {
}
resource "authentik_group" "gitea_users" {
name = "gitea_users"
name = local.main-group
attributes = jsonencode({"${local.app-name}" = true})
}
data "authentik_group" "vynil-admin" {
@@ -96,13 +99,22 @@ data "authentik_group" "vynil-admin" {
}
resource "authentik_group" "gitea_admin" {
name = "gitea_admin"
name = format("admin-%s", local.app-name)
parent = authentik_group.gitea_users.id
attributes = jsonencode({"${local.app-name}" = true})
}
resource "authentik_policy_expression" "policy" {
name = local.main-group
expression = <<-EOF
attr = request.user.group_attributes()
return attr['${local.app-name}'] if '${local.app-name}' in attr else False
EOF
}
resource "authentik_policy_binding" "gitea_access_users" {
target = authentik_application.gitea_application.uuid
group = authentik_group.gitea_users.id
policy = authentik_policy_expression.policy.id
order = 0
}
resource "authentik_policy_binding" "gitea_access_vynil" {