This commit is contained in:
2024-01-23 16:43:41 +01:00
parent 99b0ca744e
commit b61e510acf
3 changed files with 129 additions and 44 deletions

View File

@@ -9,6 +9,20 @@ locals {
}
}
data "kubernetes_secret_v1" "authentik" {
metadata {
name = "authentik"
namespace = "${var.domain}-auth"
}
}
data "kubernetes_ingress_v1" "authentik" {
metadata {
name = "authentik"
namespace = "${var.domain}-auth"
}
}
data "kustomization_overlay" "data" {
common_labels = local.common-labels
namespace = var.namespace

View File

@@ -6,45 +6,21 @@ metadata:
name: grafana
description: null
options:
app-group:
default: monitor
examples:
- monitor
type: string
volume:
default:
accessMode: ReadWriteOnce
size: 10Gi
examples:
- accessMode: ReadWriteOnce
size: 10Gi
properties:
accessMode:
default: ReadWriteOnce
enum:
- ReadWriteOnce
- ReadOnlyMany
- ReadWriteMany
type: string
size:
default: 10Gi
type: string
type: object
sub-domain:
default: grafana
examples:
- grafana
type: string
domain-name:
default: your_company.com
examples:
- your_company.com
type: string
ingress-class:
default: traefik
examples:
- traefik
type: string
domain:
default: your-company
examples:
- your-company
type: string
issuer:
default: letsencrypt-prod
examples:
- letsencrypt-prod
type: string
images:
default:
busybox:
@@ -142,28 +118,52 @@ options:
type: string
type: object
type: object
issuer:
default: letsencrypt-prod
volume:
default:
accessMode: ReadWriteOnce
size: 10Gi
examples:
- letsencrypt-prod
- accessMode: ReadWriteOnce
size: 10Gi
properties:
accessMode:
default: ReadWriteOnce
enum:
- ReadWriteOnce
- ReadOnlyMany
- ReadWriteMany
type: string
size:
default: 10Gi
type: string
type: object
app-group:
default: monitor
examples:
- monitor
type: string
domain-name:
default: your_company.com
examples:
- your_company.com
type: string
sub-domain:
default: grafana
examples:
- grafana
type: string
admin_name:
default: grafana_admin
examples:
- grafana_admin
type: string
domain:
default: your-company
examples:
- your-company
type: string
dependencies: []
providers:
kubernetes: true
authentik: true
kubectl: true
postgresql: null
restapi: null
http: null
restapi: true
http: true
gitea: null
tfaddtype: null

View File

@@ -0,0 +1,71 @@
locals {
dns-name = "${var.sub-domain}.${var.domain-name}"
dns-names = [local.dns-name]
app-name = var.component == var.instance ? var.instance : format("%s-%s", var.component, var.instance)
icon = "logo192.png"
request_headers = {
"Content-Type" = "application/json"
Authorization = "Bearer ${data.kubernetes_secret_v1.authentik.data["AUTHENTIK_BOOTSTRAP_TOKEN"]}"
}
service = {
"name" = "grafana"
"port" = {
"number" = 80
}
}
}
module "ingress" {
source = "/dist/modules/ingress"
component = ""
instance = var.instance
namespace = var.namespace
issuer = var.issuer
ingress-class = var.ingress-class
labels = local.common-labels
dns-names = local.dns-names
middlewares = []
service = local.service
providers = {
kubectl = kubectl
}
}
/* module "application" {
source = "/dist/modules/application"
component = var.component
instance = var.instance
app-group = var.app-group
dns-name = local.dns-name
icon = local.icon
protocol_provider = module.oauth2.provider-id
providers = {
authentik = authentik
}
}
module "oauth2" {
source = "/dist/modules/oauth2"
component = var.component
instance = var.instance
namespace = var.namespace
labels = local.common-labels
dns-name = local.dns-name
redirect-path = ""
providers = {
kubernetes = kubernetes
kubectl = kubectl
authentik = authentik
}
}
provider "restapi" {
uri = "http://authentik.${var.domain}-auth.svc/api/v3/"
headers = local.request_headers
create_method = "PATCH"
update_method = "PATCH"
destroy_method = "PATCH"
write_returns_object = true
id_attribute = "name"
}
*/