Skip to content

Commit e5f66d2

Browse files
committed
Updates to implement GitOps approach
1 parent b6817ce commit e5f66d2

16 files changed

+17966
-48
lines changed

README.md

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,40 @@ This project deploys a self-supported Grafana operator. It does not modify the
1515
## Requirements
1616

1717
This was deployed and tested with:
18-
* OpenShift 4.9
19-
* Grafana Operator 4.2.0 from OperatorHub
18+
* OpenShift 4.15
19+
* Grafana Operator 5.6.3 from OperatorHub
20+
* OpenShift GitOps 1.11.1
2021

21-
## Deployment
22+
## GitOps Approach
2223

23-
### 1a. Deploy Grafana operator from OperatorHub
24+
A GitOps approach using OpenShift GitOps (ArgoCD) is recommended over executing the above instructions manually. Install OpenShift GitOps from OperatorHub, and then deploy the ArgoCD application into the openshift-gitops namespace as follows:
2425

25-
Create a new project (i.e. my-grafana) and deploy the community-supported Grafana operator from OperatorHub. The Grafana operator creates Custom Resource Definitions (CRDs) for the following objects:
26-
* grafanas.integreatly.org
27-
* grafanadatasources.integreatly.org
28-
* grafanadashboards.integreatly.org
26+
```
27+
oc apply -f custom-grafana.application.yaml
28+
```
2929

30-
To create a Grafana resource from the UI, navigate to Installed Operators -> Grafana Operator -> Grafana -> Create Grafana. Configure your Grafana resource as desired, and press Create.
30+
## Manual Deployment
3131

32-
### 1b. Additional instructions for deploying in a restricted network
32+
### 1. Deploy Grafana operator from OperatorHub
3333

34-
Follow these additional instructions to [deploy Grafana operator in a restricted network].
34+
Create a new project (i.e. my-grafana) and deploy the community-supported Grafana operator from OperatorHub.
35+
36+
To create a Grafana resource from the UI, navigate to Installed Operators -> Grafana Operator -> Grafana -> Create Grafana. Configure your Grafana resource as desired, and press Create.
3537

3638
### 2. Deploy GrafanaDataSource for Prometheus
3739

38-
The grafana-serviceaccount service account was created alongside the Grafana instance. We will grant it the cluster-monitoring-view cluster role.
40+
The grafana-sa service account was created alongside the Grafana instance. We will grant it the cluster-monitoring-view cluster and openshift-cluster-monitoring-view roles, as well as project edit role to access secrets in the my-grafana project.
3941

4042
```
41-
oc adm policy add-cluster-role-to-user cluster-monitoring-view -z grafana-serviceaccount
43+
oc adm policy add-cluster-role-to-user cluster-monitoring-view -z grafana-sa
44+
oc adm policy add-cluster-role-to-user openshift-cluster-monitoring-view -z grafana-sa
45+
oc adm policy add-role-to-user edit -z grafana-sa -n my-grafana
4246
```
4347

4448
The bearer token for this service account is used to authenticate access to Prometheus in the openshift-monitoring namespace. The following command will display this token.
4549

4650
```
47-
oc serviceaccounts get-token grafana-serviceaccount -n my-grafana
51+
oc create token grafana-sa --duration=8760h -n my-grafana
4852
```
4953

5054
From the Grafana Data Source resource, press Create Instance, and navigate to the YAML view. Create the [example GrafanaDataSource], substituting `${BEARER_TOKEN}` with the output of the command above.
@@ -63,7 +67,6 @@ oc create -f <dashboard>
6367

6468
If you are unable to deploy the GrafanaDashboard custom resources, I have also provided [JSON dashboards] which can be imported directly from within the Grafana console.
6569

66-
6770
## License
6871

6972
GPLv3
@@ -72,7 +75,6 @@ GPLv3
7275

7376
Kevin Chung
7477

75-
[deploy Grafana operator in a restricted network]: restricted-setup.md
7678
[example GrafanaDatasource]: ./datasources/prometheus-grafanadatasource.yaml
7779
[example GrafanaDashboards]: ./dashboards/crds/
7880
[JSON dashboards]: ./dashboards/json_raw/

custom-grafana.application.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: argoproj.io/v1alpha1
2+
kind: Application
3+
metadata:
4+
name: custom-grafana
5+
namespace: openshift-gitops
6+
spec:
7+
destination:
8+
namespace: my-grafana
9+
server: https://kubernetes.default.svc
10+
project: default
11+
source:
12+
path: gitops/overlays/dashboards
13+
repoURL: https://github.com/kevchu3/openshift4-grafana.git
14+
targetRevision: HEAD
15+
syncPolicy:
16+
automated:
17+
prune: true
18+
selfHeal: true
19+
syncOptions:
20+
- CreateNamespace=true

0 commit comments

Comments
 (0)