File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ set -exuo pipefail
4+ command -v envsubst
5+
6+ FILE_ROOT=${BASH_SOURCE%/* }
7+ NAMESPACE=${NAMESPACE:= tools}
8+
9+ export FILE_ROOT NAMESPACE
10+
11+ # make sure user-workloads are enabled
12+ USER_WORKLOADS=$( oc get cm/cluster-monitoring-config -n openshift-monitoring -ojsonpath=' {.data.config\.yaml}' )
13+
14+ if ! [ " $USER_WORKLOADS " = " enableUserWorkload: true" ]; then
15+ echo " User Workload is not enabled"
16+ exit ;
17+ fi
18+
19+ envsubst < " ${FILE_ROOT} " /operator-group.yaml | oc apply -n " ${NAMESPACE} " -f -
20+ oc apply -f " ${FILE_ROOT} " /subscription.yaml -n ${NAMESPACE}
21+
22+ oc wait -n " ${NAMESPACE} " --for=jsonpath=status.installPlanRef.name subscription grafana-operator --timeout=120s
23+ oc wait -n " ${NAMESPACE} " installplan " $( oc get -n " ${NAMESPACE} " subscription grafana-operator -o=jsonpath=' {.status.installPlanRef.name}' ) " --for=condition=Installed --timeout=120s
24+
25+ oc -n " $NAMESPACE " apply -f " $FILE_ROOT " /grafana.yaml
26+
27+ oc adm policy add-cluster-role-to-user cluster-monitoring-view -z grafana-sa -n " $NAMESPACE "
28+
29+ TOKEN=" $( oc serviceaccounts new-token grafana-sa -n " $NAMESPACE " ) "
30+ THANOS_URL=" $( oc get route/thanos-querier -n openshift-monitoring -ojsonpath=' {.spec.host}' ) "
31+ export TOKEN THANOS_URL
32+
33+ envsubst < " $FILE_ROOT " /grafanadatasource.yaml | oc -n " $NAMESPACE " apply -f -
34+
35+ unset TOKEN
36+
Original file line number Diff line number Diff line change 1+ apiVersion : grafana.integreatly.org/v1beta1
2+ kind : Grafana
3+ metadata :
4+ name : grafana
5+ labels :
6+ dashboards : grafana
7+ folders : grafana
8+ spec :
9+ config :
10+ auth.anonymous :
11+ enabled : ' true'
12+ org_role : Admin
13+ auth.basic :
14+ enabled : ' true'
15+ log :
16+ mode : console
17+ security :
18+ admin_password : admin
19+ admin_user : admin
20+
Original file line number Diff line number Diff line change 1+ kind : GrafanaDatasource
2+ apiVersion : grafana.integreatly.org/v1beta1
3+ metadata :
4+ name : grafanadatasource
5+ spec :
6+ datasource :
7+ access : proxy
8+ editable : true
9+ isDefault : true
10+ jsonData :
11+ httpHeaderName1 : ' Authorization'
12+ timeInterval : 5s
13+ tlsSkipVerify : true
14+ name : Prometheus
15+ secureJsonData :
16+ httpHeaderValue1 : ' Bearer $TOKEN'
17+ type : prometheus
18+ url : ' https://$THANOS_URL'
19+ instanceSelector :
20+ matchLabels :
21+ dashboards : grafana
22+ plugins :
23+ - name : grafana-clock-panel
24+ version : 1.3.0
Original file line number Diff line number Diff line change 1+ ---
2+ apiVersion : operators.coreos.com/v1
3+ kind : OperatorGroup
4+ metadata :
5+ name : ${NAMESPACE}
6+ spec :
7+ targetNamespaces :
8+ - ${NAMESPACE}
Original file line number Diff line number Diff line change 1+ ---
2+ apiVersion : operators.coreos.com/v1alpha1
3+ kind : Subscription
4+ metadata :
5+ name : grafana-operator
6+ spec :
7+ channel : v5
8+ installPlanApproval : Automatic
9+ name : grafana-operator
10+ source : community-operators
11+ sourceNamespace : openshift-marketplace
12+
Original file line number Diff line number Diff line change 1+ ---
2+ apiVersion: integreatly.org/v1alpha1
3+ kind: GrafanaDashboard
4+ metadata:
5+ name: app-developer-dashboard
6+ namespace: <your-grafana-namespace>
7+ spec:
8+ json:
9+ url: "https://raw.githubusercontent.com/Kuadrant/kuadrant-operator/main/examples/dashboards/app_developer.json"
Original file line number Diff line number Diff line change 1+ ---
2+ apiVersion: integreatly.org/v1alpha1
3+ kind: GrafanaDashboard
4+ metadata:
5+ name: business-user-dashboard
6+ namespace: <your-grafana-namespace>
7+ spec:
8+ json:
9+ url: "https://raw.githubusercontent.com/Kuadrant/kuadrant-operator/main/examples/dashboards/business_user.json"
10+
Original file line number Diff line number Diff line change 1+ ---
2+ apiVersion : kustomize.config.k8s.io/v1beta1
3+ kind : Kustomization
4+
5+ resources :
6+ - app_developer_dashboard.yaml
7+ - business_user_dashboard.yaml
8+ - platform_engineer_dashboard.yaml
9+
Original file line number Diff line number Diff line change 1+ ---
2+ apiVersion: integreatly.org/v1alpha1
3+ kind: GrafanaDashboard
4+ metadata:
5+ name: platform-engineer-dashboard
6+ namespace: <your-grafana-namespace>
7+ spec:
8+ json:
9+ url: "https://raw.githubusercontent.com/Kuadrant/kuadrant-operator/main/examples/dashboards/platform_engineer.json"
10+
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ resources:
66 - ../../base/mockserver/
77 - ../../base/jaeger/
88 - ../../base/keycloak-deployment/
9+ - /grafana-dashboards/
910
1011images :
1112 - name : quay.io/rh_integration/go-httpbin
You can’t perform that action at this time.
0 commit comments