kube/grafana/application.yml

231 lines
5.9 KiB
YAML
Raw Normal View History

2022-10-14 11:38:23 +00:00
---
apiVersion: codemowers.cloud/v1beta1
kind: OIDCClient
2023-07-28 09:21:50 +00:00
metadata:
name: grafana
spec:
displayName: Grafana
uri: https://grafana.k-space.ee/login/generic_oauth
2023-07-28 09:21:50 +00:00
redirectUris:
- https://grafana.k-space.ee/login/generic_oauth
allowedGroups:
- k-space:floor
2023-07-28 09:21:50 +00:00
grantTypes:
- authorization_code
- refresh_token
responseTypes:
- code
availableScopes:
- openid
- profile
2024-09-05 06:29:16 +00:00
- groups
2023-07-28 09:21:50 +00:00
tokenEndpointAuthMethod: none
---
2022-10-14 11:38:23 +00:00
apiVersion: v1
kind: ConfigMap
2024-08-20 09:14:42 +00:00
metadata:
name: grafana-datasources
data:
prometheus.yaml: |
apiVersion: 1
prune: true
datasources:
- name: Prometheus
type: prometheus
orgId: 1
url: http://prometheus-operated.monitoring.svc.cluster.local:9090
version: 1
editable: false
---
apiVersion: v1
kind: ConfigMap
2022-10-14 11:38:23 +00:00
metadata:
name: grafana-config
data:
grafana.ini: |
[log]
level = warn
[server]
domain = grafana.k-space.ee
root_url = https://%(domain)s/
[auth]
oauth_allow_insecure_email_lookup=true
2024-12-14 23:46:22 +00:00
[auth.basic]
enabled = false
2022-10-14 11:38:23 +00:00
[auth.generic_oauth]
name = OAuth
icon = signin
enabled = true
scopes = openid profile groups
2022-10-14 11:38:23 +00:00
allow_sign_up = true
2023-07-28 09:21:50 +00:00
use_pkce = true
role_attribute_path = contains(groups[*], 'k-space:kubernetes:admins') && 'Admin' || contains(groups[*], 'k-space:floor') && 'Editor' || Viewer
allow_assign_grafana_admin = true
2023-07-28 09:21:50 +00:00
[security]
disable_initial_admin_creation = true
2022-10-14 11:38:23 +00:00
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app: grafana
name: grafana
spec:
revisionHistoryLimit: 0
serviceName: grafana
selector:
matchLabels:
app: grafana
template:
metadata:
labels:
app: grafana
spec:
securityContext:
fsGroup: 472
containers:
- name: grafana
image: grafana/grafana:11.1.0
2022-10-14 11:38:23 +00:00
securityContext:
readOnlyRootFilesystem: true
runAsNonRoot: true
runAsUser: 472
2023-07-28 09:21:50 +00:00
env:
- name: GF_AUTH_GENERIC_OAUTH_SIGNOUT_REDIRECT_URL
valueFrom:
secretKeyRef:
name: oidc-client-grafana-owner-secrets
key: OIDC_IDP_URI
2023-07-28 09:21:50 +00:00
- name: GF_AUTH_GENERIC_OAUTH_CLIENT_ID
valueFrom:
secretKeyRef:
name: oidc-client-grafana-owner-secrets
key: OIDC_CLIENT_ID
- name: GF_AUTH_GENERIC_OAUTH_SECRET
valueFrom:
secretKeyRef:
name: oidc-client-grafana-owner-secrets
key: OIDC_CLIENT_SECRET
- name: GF_AUTH_GENERIC_OAUTH_SCOPES
valueFrom:
secretKeyRef:
name: oidc-client-grafana-owner-secrets
key: OIDC_AVAILABLE_SCOPES
- name: GF_AUTH_GENERIC_OAUTH_AUTH_URL
valueFrom:
secretKeyRef:
name: oidc-client-grafana-owner-secrets
key: OIDC_IDP_AUTH_URI
2023-07-28 09:21:50 +00:00
- name: GF_AUTH_GENERIC_OAUTH_TOKEN_URL
valueFrom:
secretKeyRef:
name: oidc-client-grafana-owner-secrets
key: OIDC_IDP_TOKEN_URI
2023-07-28 09:21:50 +00:00
- name: GF_AUTH_GENERIC_OAUTH_API_URL
valueFrom:
secretKeyRef:
name: oidc-client-grafana-owner-secrets
key: OIDC_IDP_USERINFO_URI
- name: GF_DATABASE_TYPE
value: mysql
- name: GF_DATABASE_HOST
value: 172.20.36.1:3306
- name: GF_DATABASE_SSL_MODE
value: disable
- name: GF_DATABASE_NAME
value: kspace_grafana
- name: GF_DATABASE_USER
value: kspace_grafana
- name: GF_DATABASE_PASSWORD
valueFrom:
secretKeyRef:
name: grafana-database
key: password
2022-10-14 11:38:23 +00:00
ports:
- containerPort: 3000
name: http-grafana
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /robots.txt
port: 3000
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 2
livenessProbe:
failureThreshold: 3
initialDelaySeconds: 30
periodSeconds: 10
successThreshold: 1
tcpSocket:
port: 3000
timeoutSeconds: 1
resources:
requests:
cpu: 250m
memory: 750Mi
volumeMounts:
- mountPath: /var/lib/grafana
name: grafana-data
- mountPath: /etc/grafana
name: grafana-config
2024-08-20 09:14:42 +00:00
- mountPath: /etc/grafana/provisioning/datasources
name: grafana-datasources
2022-10-14 11:38:23 +00:00
volumes:
- name: grafana-config
configMap:
name: grafana-config
2024-08-20 09:14:42 +00:00
- name: grafana-datasources
configMap:
name: grafana-datasources
2024-08-23 17:37:45 +00:00
- name: grafana-data
emptyDir:
sizeLimit: 500Mi
2022-10-14 11:38:23 +00:00
---
apiVersion: v1
kind: Service
metadata:
name: grafana
spec:
ports:
- port: 80
protocol: TCP
targetPort: http-grafana
selector:
app: grafana
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: grafana
annotations:
traefik.ingress.kubernetes.io/router.entrypoints: websecure
traefik.ingress.kubernetes.io/router.tls: "true"
external-dns.alpha.kubernetes.io/target: traefik.k-space.ee
spec:
rules:
- host: grafana.k-space.ee
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: grafana
port:
number: 80
tls:
- hosts:
- "*.k-space.ee"
2023-08-29 06:29:36 +00:00
---
apiVersion: codemowers.cloud/v1beta1
kind: MysqlDatabaseClaim
metadata:
name: grafana
spec:
capacity: 1Gi
class: shared