1
1
# Insights Operator
2
2
3
- This cluster operator gathers anonymized system configuration and reports it to Red Hat Insights. It is a part of the
4
- standard OpenShift distribution. The data collected allows for debugging in the event of cluster failures or
3
+ This cluster operator gathers anonymized system configuration and reports it to Red Hat Insights. It is a part of the
4
+ standard OpenShift distribution. The data collected allows for debugging in the event of cluster failures or
5
5
unanticipated errors.
6
6
7
7
# Table of Contents
@@ -60,7 +60,7 @@ Unit tests can be started by the following command:
60
60
make test
61
61
```
62
62
63
- It is also possible to specify CLI options for Go test. For example, if you need to disable test results caching,
63
+ It is also possible to specify CLI options for Go test. For example, if you need to disable test results caching,
64
64
use the following command:
65
65
66
66
``` shell script
@@ -72,8 +72,8 @@ VERBOSE=-count=1 make test
72
72
# Documentation
73
73
74
74
75
- The document [ docs/gathered-data] ( docs/gathered-data.md ) contains the list of collected data and the API that is used
76
- to collect it. This documentation is generated by the command bellow, by collecting the comment tags located above
75
+ The document [ docs/gathered-data] ( docs/gathered-data.md ) contains the list of collected data and the API that is used
76
+ to collect it. This documentation is generated by the command bellow, by collecting the comment tags located above
77
77
each Gather method.
78
78
79
79
To start generating the document run:
@@ -86,12 +86,12 @@ make docs
86
86
87
87
## Generate the certificate and key
88
88
89
- Certificate and key are required to access Prometheus metrics (instead 404 Forbidden is returned). It is possible
90
- to generate these two files from Kubernetes config file. Certificate is stored in ` users/admin/client-cerfificate-data `
91
- and key in ` users/admin/client-key-data ` . Please note that these values are encoded by using Base64 encoding,
89
+ Certificate and key are required to access Prometheus metrics (instead 404 Forbidden is returned). It is possible
90
+ to generate these two files from Kubernetes config file. Certificate is stored in ` users/admin/client-cerfificate-data `
91
+ and key in ` users/admin/client-key-data ` . Please note that these values are encoded by using Base64 encoding,
92
92
so it is needed to decode them, for example by ` base64 -d ` .
93
93
94
- There's a tool named ` gen_cert_key.py ` that can be used to automatically generate both files. It is stored in ` tools `
94
+ There's a tool named ` gen_cert_key.py ` that can be used to automatically generate both files. It is stored in ` tools `
95
95
subdirectory.
96
96
97
97
``` shell script
@@ -100,10 +100,10 @@ gen_cert_file.py kubeconfig.yaml
100
100
101
101
## Prometheus metrics provided by Insights Operator
102
102
103
- It is possible to read Prometheus metrics provided by Insights Operator. Example of metrics exposed by
103
+ It is possible to read Prometheus metrics provided by Insights Operator. Example of metrics exposed by
104
104
Insights Operator can be found at [ metrics.txt] ( docs/metrics.txt )
105
105
106
- Depending on how or where the IO is running you may have different ways to retrieve the metrics.
106
+ Depending on how or where the IO is running you may have different ways to retrieve the metrics.
107
107
Here is a list of some options, so you can find the one that fits you:
108
108
109
109
### Running IO locally
@@ -140,22 +140,20 @@ curl --cert k8s.crt --key k8s.key -k 'https://prometheus-k8s.openshift-monitori
140
140
141
141
## Debugging Prometheus metrics without valid CA
142
142
143
- Get the token
143
+ 1 . Forward the service
144
144
145
- ``` shell script
146
- oc sa get-token prometheus-k8s -n openshift-monitoring
145
+ ``` bash
146
+ sudo kubefwd svc -n openshift-monitoring -d openshift-monitoring.svc -l prometheus=k8s
147
147
```
148
148
149
- Change in ` pkg/controller/operator.go ` after creating ` metricsGatherKubeConfig ` (about line # 86 )
149
+ 2 . Set ` INSECURE_PROMETHEUS_TOKEN ` environment variable:
150
150
151
- ``` go
152
- metricsGatherKubeConfig.Insecure = true
153
- metricsGatherKubeConfig.BearerToken = " YOUR-TOKEN-HERE"
154
- # by default CAFile is /var /run/secrets/kubernetes.io /serviceaccount/service-ca.crt
155
- metricsGatherKubeConfig.CAFile = " "
156
- metricsGatherKubeConfig.CAData = []byte {}
151
+ ``` bash
152
+ export INSECURE_PROMETHEUS_TOKEN=$( oc sa get-token prometheus-k8s -n openshift-monitoring)
157
153
```
158
154
155
+ 3 . Run the operator.
156
+
159
157
# Debugging
160
158
161
159
## Using the profiler
@@ -185,7 +183,7 @@ go tool pprof http://localhost:6060/debug/pprof/profile?seconds=30
185
183
go tool pprof http://localhost:6060/debug/pprof/heap
186
184
```
187
185
188
- These commands will create a compressed file that can be visualized using a variety of tools, one of them is
186
+ These commands will create a compressed file that can be visualized using a variety of tools, one of them is
189
187
the ` pprof ` tool.
190
188
191
189
### Analyzing profiling data
@@ -213,7 +211,7 @@ It uses both the local git and GitHub`s API to update the file so:
213
211
214
212
It can be used 2 ways:
215
213
216
- 1 . Providing no command line arguments the script will update the current ` CHANGELOG.md ` with the latest changes
214
+ 1 . Providing no command line arguments the script will update the current ` CHANGELOG.md ` with the latest changes
217
215
2 . according to the local git state.
218
216
219
217
> 🚨 IMPORTANT: It will only work with changelogs created with this script
@@ -222,7 +220,7 @@ It can be used 2 ways:
222
220
go run cmd/changelog/main.go
223
221
```
224
222
225
- 2 . Providing 2 command line arguments, ` AFTER ` and ` UNTIL ` dates the script will generate a new ` CHANGELOG.md ` within
223
+ 2 . Providing 2 command line arguments, ` AFTER ` and ` UNTIL ` dates the script will generate a new ` CHANGELOG.md ` within
226
224
the provided time frame.
227
225
228
226
``` shell script
@@ -235,17 +233,17 @@ go run cmd/changelog/main.go 2021-01-10 2021-01-20
235
233
* ClusterOperator objects
236
234
* All non-secret global config (hostnames and URLs anonymized)
237
235
238
- The list of all collected data with description, location in produced archive and link to Api and some examples is
236
+ The list of all collected data with description, location in produced archive and link to Api and some examples is
239
237
at [ docs/gathered-data.md] ( docs/gathered-data.md )
240
238
241
- The resulting data is packed in ` .tar.gz ` archive with folder structure indicated in the document. Example of such
239
+ The resulting data is packed in ` .tar.gz ` archive with folder structure indicated in the document. Example of such
242
240
archive is at [ docs/insights-archive-sample] ( docs/insights-archive-sample ) .
243
241
244
242
## Insights Operator Archive
245
243
246
244
### Sample IO archive
247
245
248
- There is a sample IO archive maintained in this repo to use as a quick reference. (can be found
246
+ There is a sample IO archive maintained in this repo to use as a quick reference. (can be found
249
247
at [ docs/insights-archive-sample] ( https://github.com/openshift/insights-operator/tree/master/docs/insights-archive-sample ) )
250
248
251
249
To keep it up-to-date it is ** required** to update this manually when developing a new data enhancement.
@@ -311,8 +309,13 @@ the `managedFields` field when it was removed from the IO archive to save space:
311
309
./scripts/update_sample_archive.sh < Path of directory with the NEW extracted IO archive> ' "managedFields":'
312
310
```
313
311
314
- The path of the sample archive directory should be constant relative to
315
- the path of the script and therefore does not have to be specified explicitly.
312
+ The path of the sample archive directory should be constant relative to the path of the script and therefore does not
313
+ have to be specified explicitly.
314
+
315
+ # Conditional Gathering
316
+
317
+ See [ docs/conditional-gatherer/README.md] ( https://github.com/openshift/insights-operator/blob/master/docs/conditional-gatherer/README.md )
318
+
316
319
317
320
# Contributing
318
321
0 commit comments