Skip to content

Commit

Permalink
Merge pull request #100 from validatedpatterns/grafana
Browse files Browse the repository at this point in the history
grafana
  • Loading branch information
claudiol authored Jan 10, 2024
2 parents 99d352e + fa617ec commit 59ec398
Show file tree
Hide file tree
Showing 11 changed files with 564 additions and 324 deletions.
38 changes: 23 additions & 15 deletions charts/all/medical-diagnosis/grafana/templates/grafana.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,37 @@
apiVersion: integreatly.org/v1alpha1
apiVersion: grafana.integreatly.org/v1beta1
kind: Grafana
metadata:
name: xraylab-grafana
namespace: {{ .Values.global.xraylab.namespace }}
annotations:
argocd.argoproj.io/sync-wave: "1"
labels:
dashboards: "grafana"
spec:
deployment:
skipCreateAdminAccount: true
envFrom:
- secretRef:
name: grafana-creds
ingress:
enabled: true
spec:
template:
spec:
containers:
- name: grafana
env:
- name: GF_SECURITY_ADMIN_USER
valueFrom:
secretKeyRef:
key: GF_SECURITY_ADMIN_USER
name: grafana-creds
- name: GF_SECURITY_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
key: GF_SECURITY_ADMIN_PASSWORD
name: grafana-creds
route:
spec: {}
config:
auth:
disable_signout_menu: true
disable_signout_menu: "true"
auth.anonymous:
enabled: true
enabled: "true"
log:
level: warn
mode: console
dashboardLabelSelector:
- matchExpressions:
- key: app
operator: In
values:
- grafana
Original file line number Diff line number Diff line change
Expand Up @@ -15,34 +15,36 @@ spec:
- -c
- |
#!/usr/bin/env bash
SECRET=$(oc get secret | grep grafana-serviceaccount-token | head -n1 | awk '{print $1}')
SECRET=$(oc get secret | grep xraylab-grafana-sa-token | head -n1 | awk '{print $1}')
TOKEN=$(oc extract secret/$SECRET --keys=token --to=-)
cat <<EOF | oc create -f -
apiVersion: integreatly.org/v1alpha1
kind: GrafanaDataSource
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDatasource
metadata:
name: prometheus-grafana-datasource
namespace: {{ .Values.global.xraylab.namespace }}
spec:
datasources:
- basicAuthUser: internal
access: proxy
editable: true
isDefault: false
secureJsonData:
httpHeaderValue1: 'Bearer ${TOKEN}'
name: prometheus
url: 'https://thanos-querier.openshift-monitoring.svc.cluster.local:9091'
jsonData:
httpHeaderName1: 'Authorization'
timeInterval: 5s
tlsSkipVerify: true
type: prometheus
instanceSelector:
matchLabels:
dashboards: "grafana"
datasource:
basicAuthUser: internal
access: proxy
editable: true
isDefault: false
secureJsonData:
httpHeaderValue1: 'Bearer ${TOKEN}'
name: prometheus
url: 'https://thanos-querier.openshift-monitoring.svc.cluster.local:9091'
jsonData:
httpHeaderName1: 'Authorization'
timeInterval: 5s
tlsSkipVerify: true
type: prometheus
name: grafana-prometheus-datasource.yaml
EOF
name: get-grafana-token
dnsPolicy: ClusterFirst
restartPolicy: Never
serviceAccount: grafana-serviceaccount
serviceAccountName: grafana-serviceaccount
serviceAccount: xraylab-grafana-sa
terminationGracePeriodSeconds: 60
Original file line number Diff line number Diff line change
@@ -1,18 +1,42 @@
apiVersion: integreatly.org/v1alpha1
kind: GrafanaDataSource
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDatasource
metadata:
name: mysql-grafana-datasource
namespace: {{ .Values.global.xraylab.namespace }}
annotations:
argocd.argoproj.io/hook: PostSync
spec:
datasources:
- type: {{ .Values.dataSources.type }}
name: {{ .Values.dataSources.name }}
access: {{ .Values.dataSources.access }}
url: ${GF_DATASRC_URL}
database: ${GF_DATASRC_DB}
user: ${GF_DATASRC_USER}
secureJsonData:
password: ${GF_DATASRC_PASSWORD}
valuesFrom:
- targetPath: "user"
valueFrom:
secretKeyRef:
name: grafana-creds
key: GF_DATASRC_USER
- targetPath: "database"
valueFrom:
secretKeyRef:
name: grafana-creds
key: GF_DATASRC_DB
- targetPath: "url"
valueFrom:
secretKeyRef:
name: grafana-creds
key: GF_DATASRC_URL
- targetPath: "secureJsonData.password"
valueFrom:
secretKeyRef:
name: grafana-creds
key: GF_DATASRC_PASSWORD
instanceSelector:
matchLabels:
dashboards: "grafana"
datasource:
type: {{ .Values.dataSources.type }}
name: {{ .Values.dataSources.name }}
access: {{ .Values.dataSources.access }}
url: ${GF_DATASRC_URL}
database: ${GF_DATASRC_DB}
user: ${GF_DATASRC_USER}
secureJsonData:
password: ${GF_DATASRC_PASSWORD}
name: mysql-grafana-datasource.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: integreatly.org/v1alpha1
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDashboard
metadata:
labels:
Expand All @@ -8,6 +8,9 @@ metadata:
annotations:
argocd.argoproj.io/sync-wave: "2"
spec:
instanceSelector:
matchLabels:
dashboards: "grafana"
json: |
{
"annotations": {
Expand Down Expand Up @@ -1248,6 +1251,6 @@ spec:
}
plugins:
- name: larona-epict-panel
version: 1.2.2
version: 2.0.6
- name: ryantxu-ajax-panel
version: 0.0.7-dev
version: 0.1.0
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: integreatly.org/v1alpha1
apiVersion: grafana.integreatly.org/v1beta1
kind: GrafanaDashboard
metadata:
labels:
Expand All @@ -9,6 +9,9 @@ metadata:
annotations:
argocd.argoproj.io/sync-wave: "2"
spec:
instanceSelector:
matchLabels:
dashboards: "grafana"
json: |
{
"annotations": {
Expand Down Expand Up @@ -172,4 +175,4 @@ spec:
}
plugins:
- name: ryantxu-ajax-panel
version: 0.0.7-dev
version: 0.1.0
8 changes: 4 additions & 4 deletions charts/all/medical-diagnosis/grafana/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ rbac:
roles:
- name: grafana-mgmt
apiGroups:
- "integreatly.org"
- "grafana.integreatly.org"
scope:
cluster: false
namespace: xraylab-1
Expand Down Expand Up @@ -68,7 +68,7 @@ rbac:
namespace: xraylab-1
subjects:
kind: ServiceAccount
name: grafana-serviceaccount
name: xraylab-grafana-sa
namespace: xraylab-1
apiGroup: ""
roleRef:
Expand All @@ -80,7 +80,7 @@ rbac:
namespace: xraylab-1
subjects:
kind: ServiceAccount
name: grafana-serviceaccount
name: xraylab-grafana-sa
namespace: xraylab-1
apiGroup: ""
roleRef:
Expand All @@ -92,7 +92,7 @@ rbac:
namespace: ""
subjects:
kind: ServiceAccount
name: grafana-serviceaccount
name: xraylab-grafana-sa
namespace: xraylab-1
apiGroup: ""
roleRef:
Expand Down
Loading

0 comments on commit 59ec398

Please sign in to comment.