Add grafana

This commit is contained in:
2025-11-10 18:02:56 +01:00
parent 38a8286b50
commit a11c7ea3b8
3 changed files with 117 additions and 0 deletions

20
apps/grafana.yaml Normal file
View File

@@ -0,0 +1,20 @@
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: grafana
namespace: argocd
spec:
project: default
destination:
server: https://kubernetes.default.svc
namespace: grafana
syncPolicy:
automated:
prune: true
selfHeal: false
syncOptions:
- CreateNamespace=true
source:
repoURL: https://github.com/zoriya/snow
targetRevision: HEAD
path: apps/grafana

85
apps/grafana/grafana.yaml Normal file
View File

@@ -0,0 +1,85 @@
apiVersion: grafana.integreatly.org/v1beta1
kind: Grafana
metadata:
name: grafana
labels:
dashboards: "grafana"
spec:
config:
log:
mode: "console"
auth:
disable_login_form: "false"
signout_redirect_url: "https://authentik.sdg.moe/application/o/grafana/end-session/"
oauth_auto_login: "true"
server:
root_url: https://grafana.sdg.moe
auth.generic_oauth:
name: authentik
enabled: "true"
allow_sign_up: "true"
client_id: ${AUTH_CLIENT_ID}
client_secret: ${AUTH_CLIENT_SECRET}
scopes: "openid profile email"
auth_url: "https://authentik.sdg.moe/application/o/authorize/"
token_url: "https://authentik.sdg.moe/application/o/token/"
api_url: "https://authentik.sdg.moe/application/o/userinfo/"
role_attribute_path: 'Admin' #contains(groups, 'Grafana Admins') && 'Admin' || contains(groups, 'Grafana Editors') && 'Editor' || 'Viewer'
persistentVolumeClaim:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
deployment:
spec:
template:
spec:
securityContext:
fsGroup: 10001
containers:
- name: grafana
env:
- name: AUTH_CLIENT_ID
valueFrom:
secretKeyRef:
name: grafana-oidc
key: clientId
- name: AUTH_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: grafana-oidc
key: clientSecret
readinessProbe:
failureThreshold: 3
volumes:
- name: grafana-data
persistentVolumeClaim:
claimName: grafana-pvc
strategy:
type: Recreate
ingress:
metadata:
annotations:
cert-manager.io/cluster-issuer: letsencrypt
acme.cert-manager.io/http01-edit-in-place: "true"
spec:
ingressClassName: cilium
rules:
- host: grafana.sdg.moe
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: grafana-service
port:
number: 3000
tls:
- hosts:
- grafana.sdg.moe
secretName: grafana-ssl

12
apps/grafana/oidc.yaml Normal file
View File

@@ -0,0 +1,12 @@
apiVersion: external-secrets.io/v1
kind: ExternalSecret
metadata:
name: grafana-oidc
spec:
refreshInterval: 24h
secretStoreRef:
name: bitwarden
kind: ClusterSecretStore
dataFrom:
- extract:
key: grafana-sso