Mock service mimicking Insights Results Aggregator
- Description
- Howto build the service
- Howto start the service
- Generate the image for Docker
- Running in Docker
- Makefile targets
- Usage
- Accessing results
- List of cluster IDs that can be accesses by this service
- List of clusters hitting specified rule
- Endpoint to ack rule
- List of acked rules
- Ack rule with specified justification
- Ack rule
- Update rule
- Delete rule
- Upgrade risks prediction results
- Clusters that return valid data
- Cluster returning "no content" because the cluster is managed
- Cluster returning unavailable service due to AMS is not available
- Cluster returning unavailable service due to Upgrade Risks Prediction is not available
- Cluster returning 404 due to no data in RHOBS for this cluster
- Endpoints for On Demand Data Gathering
- Endpoints to retrieve information about DVO namespaces
- Debug endpoints
- Definition of Done for new features and fixes
- BDD tests
- Package manifest
Mock service mimicking Insights Results Aggregator / SmartProxy REST API
make build
make run
docker build -t insights-results-aggregator-mock:latest .
docker run --rm insights-results-aggregator-mock:latest
Usage: make <OPTIONS> ... <TARGETS>
Available targets are:
build Build binary containing service executable
build-cover Build binary with code coverage detection support
fmt Run go fmt -w for all sources
lint Run golint
vet Run go vet. Report likely mistakes in source code
cyclo Run gocyclo
ineffassign Run ineffassign checker
shellcheck Run shellcheck
errcheck Run errcheck
goconst Run goconst checker
gosec Run gosec checker
abcgo Run ABC metrics checker
style Run all the formatting related commands (fmt, vet, lint, cyclo) + check shell scripts
run Build the project and executes the binary
test Run the unit tests
cover Generate HTML pages with code coverage
coverage Display code coverage on terminal
integration_tests Run all integration tests
local_integration_tests Run all integration tests locally
help Show this help screen
function_list List all functions in generated binary file
Usage:
./insights-results-aggregator-mock [command]
The commands are:
<EMPTY> starts content service
start-service starts content service
help print-help prints help
config print-config prints current configuration set by files & env variables
version print-version-info prints version info
authors print-authors prints authors
Note: it is possible to use single dash or double dashes for all commands.
ADDRESS=localhost:8080/api/insights-results-aggregator/v2
curl -k -v $ADDRESS/
curl -k -v $ADDRESS/info
curl -k -v $ADDRESS/groups
curl -k -v $ADDRESS/content
curl -k -v $ADDRESS/organizations
curl -k -v $ADDRESS/clusters
Compatible with Smart Proxy:
curl -k -v $ADDRESS/info
Example output:
{
"info": {
"SmartProxy": {
"BuildBranch": "master",
"BuildCommit": "9e5196b79ef7003265ed6aea67cf20ab9b8439ac",
"BuildTime": "Fri 08 Dec 2023 03:35:19 PM CET",
"BuildVersion": "v1.0.0",
"UtilsVersion": "v1.24.11",
"status": "ok"
},
"Aggregator": {
"BuildBranch": "master",
"BuildCommit": "43428604c1b972f94635587ac62e9cee04d25b28",
"BuildTime": "Fri 08 Dec 2023 03:45:28 PM CET",
"BuildVersion": "v1.3.4",
"DB_version": "31",
"UtilsVersion": "v1.24.12",
"status": "ok"
},
"ContentService": {
"BuildBranch": "master",
"BuildCommit": "ff305a07cf0bca484355590ac62e9c54320af456",
"BuildTime": "Fri 08 Dec 2023 03:45:28 PM CET",
"BuildVersion": "v1.0.0",
"UtilsVersion": "v1.24.12",
"status": "ok"
}
},
"status": "ok"
}
Returns rule content and also group info:
curl -k -v $ADDRESS/content
An example of response (shortened):
{
"content": [
{
"plugin": {
"name": "",
"node_id": "",
"product_code": "",
"python_module": "foo.bar.baz"
},
],
"groups": [
{
"title": "Performance",
"description": "High utilization, proposed tuned profiles, storage issues",
"tags": [
"performance"
]
},
],
"status": "ok"
}
curl -k -v $ADDRESS/groups
An example of response (further formatted by jq
):
{
"groups": [
{
"title": "Security",
"description": "Issues related to certificates, user management, security groups, specific port usage, storage permissions, usage of kubeadmin account, exposed keys etc.",
"tags": [
"security"
]
},
{
"title": "Fault Tolerance",
"description": "Load balancer issues, machine api and autoscaler issues, failover issues, nodes down, cluster api/cluster provider issues.",
"tags": [
"fault_tolerance"
]
},
{
"title": "Performance",
"description": "High utilization, proposed tuned profiles, storage issues",
"tags": [
"performance"
]
},
{
"title": "Service Availability",
"description": "Operator degraded, missing functionality due to misconfiguration or resource constraints.",
"tags": [
"service_availability"
]
}
],
"status": "ok"
}
curl -k -v $ADDRESS/organizations/11789772/clusters
curl -k -v $ADDRESS/organizations/11940171/clusters
curl -k -v $ADDRESS/report/11789772/34c3ecc5-624a-49a5-bab8-4fdc5e51a266
or alternatively
curl -k -v $ADDRESS/clusters/11789772/34c3ecc5-624a-49a5-bab8-4fdc5e51a266/report
In this case 11789772
is organization ID and 34c3ecc5-624a-49a5-bab8-4fdc5e51a266
is cluster ID
curl -k -v $ADDRESS/report/34c3ecc5-624a-49a5-bab8-4fdc5e51a266
List of clusters has to be provided in payload in JSON format:
curl -k -v $ADDRESS/clusters -d @cluster_list.json
Format of the payload:
{
"clusters" : [
"34c3ecc5-624a-49a5-bab8-4fdc5e51a266",
"74ae54aa-6577-4e80-85e7-697cb646ff37",
"a7467445-8d6a-43cc-b82c-7007664bdf69",
"ee7d2bf4-8933-4a3a-8634-3328fe806e08"
]
}
Format of response:
{
"clusters": [
"34c3ecc5-624a-49a5-bab8-4fdc5e51a266",
"74ae54aa-6577-4e80-85e7-697cb646ff37",
"a7467445-8d6a-43cc-b82c-7007664bdf69",
"ee7d2bf4-8933-4a3a-8634-3328fe806e08"
],
"errors": null,
"reports": {
"34c3ecc5-624a-49a5-bab8-4fdc5e51a266": {
"report": {
// ...
// ...
// ...
}
}
},
"generated_at": "2020-08-11T10:17:29Z"
}
Response format in case it is not possible to return result for some cluster:
{
"clusters": [
"ee7d2bf4-8933-4a3a-8634-3328fe806e08"
],
"errors": [
"00000000-0000-0000-0000-000000000000"
],
"reports": {
"ee7d2bf4-8933-4a3a-8634-3328fe806e08": {
"report": {
"data": [
// ...
// ...
// ...
]
},
"status": "ok"
}
},
"generated_at": "2020-08-11T10:17:29Z"
}
34c3ecc5-624a-49a5-bab8-4fdc5e51a266
34c3ecc5-624a-49a5-bab8-4fdc5e51a267
34c3ecc5-624a-49a5-bab8-4fdc5e51a268
34c3ecc5-624a-49a5-bab8-4fdc5e51a269
34c3ecc5-624a-49a5-bab8-4fdc5e51a26a
34c3ecc5-624a-49a5-bab8-4fdc5e51a26b
34c3ecc5-624a-49a5-bab8-4fdc5e51a26c
34c3ecc5-624a-49a5-bab8-4fdc5e51a26d
34c3ecc5-624a-49a5-bab8-4fdc5e51a26e
34c3ecc5-624a-49a5-bab8-4fdc5e51a26f
74ae54aa-6577-4e80-85e7-697cb646ff37
a7467445-8d6a-43cc-b82c-7007664bdf69
ee7d2bf4-8933-4a3a-8634-3328fe806e08
00000001-624a-49a5-bab8-4fdc5e51a266
00000001-624a-49a5-bab8-4fdc5e51a267
00000001-624a-49a5-bab8-4fdc5e51a268
00000001-624a-49a5-bab8-4fdc5e51a269
00000001-624a-49a5-bab8-4fdc5e51a26a
00000001-624a-49a5-bab8-4fdc5e51a26b
00000001-624a-49a5-bab8-4fdc5e51a26c
00000001-624a-49a5-bab8-4fdc5e51a26d
00000001-624a-49a5-bab8-4fdc5e51a26e
00000001-624a-49a5-bab8-4fdc5e51a26f
00000001-6577-4e80-85e7-697cb646ff37
00000001-8933-4a3a-8634-3328fe806e08
00000001-8d6a-43cc-b82c-7007664bdf69
00000002-624a-49a5-bab8-4fdc5e51a266
00000002-6577-4e80-85e7-697cb646ff37
00000002-8933-4a3a-8634-3328fe806e08
00000003-8933-4a3a-8634-3328fe806e08
00000003-8d6a-43cc-b82c-7007664bdf69
eeeeeeee-eeee-eeee-eeee-000000000001
00000001-eeee-eeee-eeee-000000000001
00000003-eeee-eeee-eeee-000000000001
Mnemotechnic: e
means "empty"
Cluster ID Returns results that are similar to:
cccccccc-cccc-cccc-cccc-000000000001 34c3ecc5-624a-49a5-bab8-4fdc5e51a266
74ae54aa-6577-4e80-85e7-697cb646ff37
a7467445-8d6a-43cc-b82c-7007664bdf69
cccccccc-cccc-cccc-cccc-000000000002 74ae54aa-6577-4e80-85e7-697cb646ff37
a7467445-8d6a-43cc-b82c-7007664bdf69
ee7d2bf4-8933-4a3a-8634-3328fe806e08
cccccccc-cccc-cccc-cccc-000000000003 ee7d2bf4-8933-4a3a-8634-3328fe806e08
ee7d2bf4-8933-4a3a-8634-3328fe806e08
34c3ecc5-624a-49a5-bab8-4fdc5e51a266
cccccccc-cccc-cccc-cccc-000000000004 eeeeeeee-eeee-eeee-eeee-000000000001
eeeeeeee-eeee-eeee-eeee-000000000001
34c3ecc5-624a-49a5-bab8-4fdc5e51a266
Mnemotechnic: c
means "changing"
ffffffff-ffff-ffff-ffff-000000000xxx'
Returns HTTP code xxx taken directly from the last three digits of cluster ID. It means that devels/testers could use this functionality to check the behaviour on client side.
Mnemotechnic: f
means "failure"
Example:
ADDRESS=localhost:8080/api/insights-results-aggregator/v2
clusters="ffffffff-ffff-ffff-ffff-000000000200
ffffffff-ffff-ffff-ffff-000000000201
ffffffff-ffff-ffff-ffff-000000000404
ffffffff-ffff-ffff-ffff-000000000405
ffffffff-ffff-ffff-ffff-000000000201"
for cluster in $clusters
do
curl -k -v $ADDRESS/report/${cluster}
done
curl 'localhost:8080/api/insights-results-aggregator/v2/rule/ccx_rules_ocp.external.rules.nodes_requirements_check.report|NODES_MINIMUM_REQUIREMENTS_NOT_MET/clusters_detail/'
{
"meta": {
"count": 24,
"component": "ccx_rules_ocp.external.rules.nodes_requirements_check.report",
"error_key": "NODES_MINIMUM_REQUIREMENTS_NOT_MET",
"generated_at": "2021-08-27T12:12:18Z"
},
"data": [
"00000001-624a-49a5-bab8-4fdc5e51a266",
"00000001-6577-4e80-85e7-697cb646ff37",
"00000001-8933-4a3a-8634-3328fe806e08",
"00000001-8d6a-43cc-b82c-7007664bdf69",
"00000001-0000-0000-0000-000000000000",
"00000001-1111-1111-1111-000000000000",
"00000001-2222-2222-2222-000000000000",
"00000001-3333-3333-3333-000000000000",
"00000001-4444-4444-4444-000000000000",
"00000001-5555-5555-5555-000000000000",
"00000001-6666-6666-6666-000000000000",
"00000001-7777-7777-7777-000000000000",
"00000001-8888-8888-8888-000000000000",
"00000001-9999-9999-9999-000000000000",
"00000001-aaaa-aaaa-aaaa-000000000000",
"00000001-bbbb-bbbb-bbbb-000000000000",
"00000001-cccc-cccc-cccc-000000000000",
"00000001-dddd-dddd-dddd-000000000000",
"00000001-ffff-ffff-ffff-000000000000",
"00000001-ffff-ffff-ffff-000000000000",
"34c3ecc5-624a-49a5-bab8-4fdc5e51a266",
"74ae54aa-6577-4e80-85e7-697cb646ff37",
"a7467445-8d6a-43cc-b82c-7007664bdf69",
"ee7d2bf4-8933-4a3a-8634-3328fe806e08"
]
}
List acks from this account where the rule is active. Will return an empty list if this account has no acks.
Request to the service:
curl localhost:8080/api/insights-results-aggregator/v2/ack
Response from the service:
{
"meta": {
"count": 5
},
"data": [
{
"rule": "ccx_rules_ocp.external.rules.nodes_kubelet_version_check.report|NODE_KUBELET_VERSION",
"justification": "Justification3",
"created_by": "tester3",
"created_at": "2021-09-04T17:11:35.130Z",
"updated_at": "2021-09-04T17:11:35.130Z"
},
{
"rule": "ccx_rules_ocp.external.rules.samples_op_failed_image_import_check.report|SAMPLES_FAILED_IMAGE_IMPORT_ERR",
"justification": "Justification4",
"created_by": "tester4",
"created_at": "2021-09-04T17:11:35.130Z",
"updated_at": "2021-09-04T17:11:35.130Z"
},
{
"rule": "ccx_rules_ocp.external.rules.cluster_wide_proxy_auth_check.report|AUTH_OPERATOR_PROXY_ERROR",
"justification": "Justification5",
"created_by": "tester5",
"created_at": "2021-09-04T17:11:35.130Z",
"updated_at": "2021-09-04T17:11:35.130Z"
},
{
"rule": "ccx_rules_ocp.external.rules.nodes_requirements_check.report|NODES_MINIMUM_REQUIREMENTS_NOT_MET",
"justification": "Justification1",
"created_by": "tester1",
"created_at": "2021-09-04T17:11:35.130Z",
"updated_at": "2021-09-04T17:11:35.130Z"
},
{
"rule": "ccx_rules_ocp.external.bug_rules.bug_1766907.report|BUGZILLA_BUG_1766907",
"justification": "Justification2",
"created_by": "tester2",
"created_at": "2021-09-04T17:11:35.130Z",
"updated_at": "2021-09-04T17:11:35.130Z"
}
]
}
Acknowledges (and therefore hides) a rule from view in an account. If there's already an acknowledgement of this rule by this account, then return that. Otherwise, a new ack is created.
Request to the service:
curl -v -X POST -H "Content-Type: application/json" --data '{"rule_id":"foo|bar", "justification":"xyzzy"}' "localhost:8080/api/insights-results-aggregator/v2/ack"
Response from the service:
< HTTP/1.1 201 Created
< Content-Type: application/json; charset=utf-8
< Date: Sun, 05 Sep 2021 14:29:33 GMT
< Content-Length: 168
<
{
"rule": "foo|bar",
"justification": "xyzzy",
"created_by": "onlineTester",
"created_at": "2021-09-05T16:29:33+02:00",
"updated_at": "2021-09-05T16:29:33+02:00"
}
Request to the service:
curl -v -X POST -H "Content-Type: application/json" --data '{"rule_id":"existing|rule", "justification":"xyzzy"}' "localhost:8080/api/insights-results-aggregator/v2/ack"
Response from the service:
< HTTP/1.1 200 OK
< Content-Type: application/json; charset=utf-8
< Date: Sun, 05 Sep 2021 14:35:51 GMT
< Content-Length: 168
<
{
"rule": "foo|bar",
"justification": "xyzzy",
"created_by": "onlineTester",
"created_at": "2021-09-05T16:35:25+02:00",
"updated_at": "2021-09-05T16:35:25+02:00"
}
Acks acknowledge (and therefore hide) a rule from view in an account. This view handles listing, retrieving, creating and deleting acks. Acks are created and deleted by Insights rule ID, not by their own ack ID.
Request to the service:
curl -v "localhost:8080/api/insights-results-aggregator/v2/ack/new|rule"
Response from the service:
< HTTP/1.1 200 OK
< Content-Type: application/json; charset=utf-8
< Date: Sat, 04 Sep 2021 18:46:20 GMT
< Content-Length: 165
<
{
"rule": "new|rule",
"justification": "?",
"created_by": "onlineTester",
"created_at": "2021-09-04T20:46:20+02:00",
"updated_at": "2021-09-04T20:46:20+02:00"
}
Request to the service:
curl -v "localhost:8080/api/insights-results-aggregator/v2/ack/ccx_rules_ocp.external.rules.cluster_wide_proxy_auth_check.report|AUTH_OPERATOR_PROXY_ERROR"
Response from the service:
< HTTP/1.1 200 OK
< Content-Type: application/json; charset=utf-8
< Date: Sat, 04 Sep 2021 18:32:58 GMT
< Content-Length: 260
<
{
"rule": "ccx_rules_ocp.external.rules.cluster_wide_proxy_auth_check.report|AUTH_OPERATOR_PROXY_ERROR",
"justification": "Justification5",
"created_by": "onlineTester",
"created_at": "2021-09-04T17:11:35.130Z",
"updated_at": "2021-09-04T20:32:58+02:00"
Please note that just updated_at
attribute is changed in this situation.
Request to the service:
curl -v-X PUT -H "Content-Type: application/json" --data '{"justification":"xyzzy"}' "localhost:8080/api/insights-results-aggregator/v2/ack/existing|rule"
Response from the service:
< HTTP/1.1 200 OK
< Date: Sun, 05 Sep 2021 05:47:46 GMT
< Content-Length: 169
< Content-Type: text/plain; charset=utf-8
<
{
"rule": "existing|rule",
"justification": "xyzzy",
"created_by": "onlineTester",
"created_at": "2021-09-05T07:45:00+02:00",
"updated_at": "2021-09-05T07:47:46+02:00"
}
Update an acknowledgement for a rule, by rule ID. A new justification can be supplied. The username is taken from the authenticated request. The updated ack is returned.
Request to the service:
curl -v -X PUT -H "Content-Type: application/json" --data '{"justification":"xyzzy"}' "localhost:8080/api/insights-results-aggregator/v2/ack/new|rule"
Response from the service:
< HTTP/1.1 404 Not Found
< Content-Type: text/plain; charset=utf-8
< X-Content-Type-Options: nosniff
< Date: Sun, 05 Sep 2021 06:13:27 GMT
< Content-Length: 51
<
rule not found -> justification can not be changed
Delete an acknowledgement for a rule, by its rule ID. If the ack existed, it is deleted and a 204 is returned. Otherwise, a 404 is returned.
Request to the service:
curl -v -X DELETE "localhost:8080/api/insights-results-aggregator/v2/ack/ccx_rules_ocp.external.rules.cluster_wide_proxy_auth_check.report|AUTH_OPERATOR_PROXY_ERROR"
Response from the service:
< HTTP/1.1 204 No Content
< Date: Sat, 04 Sep 2021 17:44:32 GMT
<
Request to the service:
curl -v -X DELETE "localhost:8080/api/insights-results-aggregator/v2/ack/foobar|foobar"
Response from the service:
< HTTP/1.1 404 Not Found
< Date: Sat, 04 Sep 2021 17:44:35 GMT
< Content-Length: 0
<
To use the Upgrade Risks Prediction endpoint:
curl "localhost:8080/api/insights-results-aggregator/v2/cluster/{cluster_id}/upgrade-risks-prediction
Response from the service:
< HTTP/1.1 200 OK
< Content-Type: application/json; charset=utf-8
< Date: Thu, 13 Apr 2023 12:38:44 GMT
< Content-Length: 186
<
{"meta":{"last_checked_at":"2023-04-13T12:38:44Z"},"status":"ok","upgrade_recommendation":{"upgrade_recommended":true,"upgrade_risks_predictors":{"alerts":[],"operator_conditions":[]}}}
To use the Upgrade Risks Predicions for multiple clusters endpoint:
curl -s -k -X POST \
-H "Content-Type: application/json" \
-d '{
"clusters": [
"00000001-624a-49a5-bab8-4fdc5e51a266",
"00000003-eeee-eeee-eeee-000000000001",
"6cab9726-c2be-438e-af11-db846a678abb",
"c60ba611-6af4-4d62-9b9e-36344da5e7bc",
"897ec1a1-4679-4122-aacb-f0ae9f9e1a5f",
"234ec1a1-4679-4122-aacb-f0ae9f9e1a56"
]
}' localhost:8080/api/insights-results-aggregator/v2/upgrade-risks-prediction
The response from the service will depend on the clusters used in the list from the request shown above, but it should look like the following:
{
"predictions": [
{
"cluster_id": "00000001-624a-49a5-bab8-4fdc5e51a266",
"prediction_status": "ok",
"upgrade_recommended": true,
"upgrade_risks_predictors": {
"alerts": [],
"operator_conditions": []
}
},
{
"cluster_id": "00000003-eeee-eeee-eeee-000000000001",
"prediction_status": "ok",
"upgrade_risks_predictors": {
"alerts": [
{
"name": "alert1",
"namespace": "namespace1",
"severity": "info",
"url": "https://my-cluster.com/monitoring/alerts?orderBy=asc&sortBy=Severity&alert-name=alert1"
},
{
"name": "alert2",
"namespace": "namespace2",
"severity": "warning",
"url": "https://my-cluster.com/monitoring/alerts?orderBy=asc&sortBy=Severity&alert-name=alert2"
},
{
"name": "alert3",
"namespace": "namespace3",
"severity": "critical",
"url": "https://my-cluster.com/monitoring/alerts?orderBy=asc&sortBy=Severity&alert-name=alert3"
}
],
"operator_conditions": [
{
"name": "foc1",
"condition": "Degraded",
"reason": "NotExpected",
"url": "https://my-cluster.com/k8s/cluster/config.openshift.io~v1~ClusterOperator/foc1"
},
{
"name": "foc2",
"condition": "Failing",
"reason": "NotExpected",
"url": "https://my-cluster.com/k8s/cluster/config.openshift.io~v1~ClusterOperator/foc2"
},
{
"name": "foc3",
"condition": "Not Available",
"reason": "NotExpected",
"url": "https://my-cluster.com/k8s/cluster/config.openshift.io~v1~ClusterOperator/foc3"
},
{
"name": "foc4",
"condition": "Not Upgradeable",
"reason": "NotExpected",
"url": "https://my-cluster.com/k8s/cluster/config.openshift.io~v1~ClusterOperator/foc4"
}
]
}
},
{
"cluster_id": "6cab9726-c2be-438e-af11-db846a678abb",
"prediction_status": "ok"
},
{
"cluster_id": "c60ba611-6af4-4d62-9b9e-36344da5e7bc",
"prediction_status": "AMS service not available"
},
{
"cluster_id": "897ec1a1-4679-4122-aacb-f0ae9f9e1a5f",
"prediction_status": "Upgrade Risks Prediction service unavailable"
}
],
"status": "ok"
}
For the clusters not listed in the sections bellow, a 404 will be returned.
00000001-624a-49a5-bab8-4fdc5e51a266
00000003-eeee-eeee-eeee-000000000001
6cab9726-c2be-438e-af11-db846a678abb
c60ba611-6af4-4d62-9b9e-36344da5e7bc
897ec1a1-4679-4122-aacb-f0ae9f9e1a5f
234ec1a1-4679-4122-aacb-f0ae9f9e1a56
List of all rule hits (all identified by x-rh-insights-request-id) for given cluster (the list also contain timestamps).
Request to the service
curl -v localhost:8080/api/insights-results-aggregator/v2/cluster/34c3ecc5-624a-49a5-bab8-4fdc5e51a267/requests/
curl -v -X POST -d @requests.json localhost:8080/api/insights-results-aggregator/v2/cluster/34c3ecc5-624a-49a5-bab8-4fdc5e51a267/requests/
Where requests.json
looks like:
[
"1duzaoao0l1b230ipv0rb4sqe8",
"1yjdje758zgyy3ksfr732yb1cl",
"eeeeeeeeeeeeeeeeeeeeeeeeee",
"2ukce6u74rm9e12mplu6liqzsv"
]
{
"cluster": "34c3ecc5-624a-49a5-bab8-4fdc5e51a267",
"requests": [
{
"requestID": "1duzaoao0l1b230ipv0rb4sqe8",
"valid": true,
"received": "2000-11-01T01:00:00.000000999Z",
"processed": "2023-05-29T06:44:20.210989121Z"
},
{
"requestID": "1yjdje758zgyy3ksfr732yb1cl",
"valid": true,
"received": "2000-11-01T01:00:00.000000999Z",
"processed": "2023-05-29T06:44:20.210989913Z"
},
{
"requestID": "2drtvjlisiqww1c93kugqyboyc",
"valid": true,
"received": "2000-11-01T01:00:00.000000999Z",
"processed": "2023-05-29T06:44:20.210994822Z"
}
],
"status": "ok"
}
- HTTP code 400 is set in HTTP header
{
"status": "invalid UUID length: 37"
}
Check status of given request-id
(original name x-rh-insights-request-id
).
Request to the service:
curl -v localhost:8080/api/insights-results-aggregator/v2/cluster/34c3ecc5-624a-49a5-bab8-4fdc5e51a267/request/1yjdje758zgyy3ksfr732yb1cl/status
{
"cluster": "34c3ecc5-624a-49a5-bab8-4fdc5e51a267",
"requestID": "1yjdje758zgyy3ksfr732yb1cl",
"status": "processed"
}
or
{
"cluster": "34c3ecc5-624a-49a5-bab8-4fdc5e51a267",
"requestID": "1yjdje758zgyy3ksfr732yx1cl",
"status": "unknown"
}
{
"status": "Requests for cluster not found"
}
- HTTP code 400 is set in HTTP header
{
"status": "invalid UUID length: 35"
}
- HTTP code 400 is set in HTTP header
{
"status": "invalid request ID: '1yjdje758zgyy3ksf_r732yb1cl'"
}
Request to the service:
curl -v localhost:8080/api/insights-results-aggregator/v2/cluster/34c3ecc5-624a-49a5-bab8-4fdc5e51a267/request/1yjdje758zgyy3ksfr732yb1cl/report
{
"cluster": "34c3ecc5-624a-49a5-bab8-4fdc5e51a267",
"requestID": "38584huk209q82uhl8md5gsdxr",
"status": "processed",
"report": [
{
"rule_fqdn": "ccx_rules_ocp.external.rules.nodes_requirements_check.report",
"error_key": "NODES_MINIMUM_REQUIREMENTS_NOT_MET",
"description": "Lorem ipsum...",
"total_risk": 1
},
{
"rule_fqdn": "samples_op_failed_image_import_check.report",
"error_key": "SAMPLES_FAILED_IMAGE_IMPORT_ERR",
"description": "Lorem ipsum...",
"total_risk": 2
},
{
"rule_fqdn": "ccx_rules_ocp.external.bug_rules.bug_1766907.report",
"error_key": "BUGZILLA_BUG_1766907",
"description": "Lorem ipsum...",
"total_risk": 3
},
{
"rule_fqdn": "ccx_rules_ocp.external.rules.nodes_kubelet_version_check.report",
"error_key": "NODE_KUBELET_VERSION",
"description": "Lorem ipsum...",
"total_risk": 4
},
{
"rule_fqdn": "ccx_rules_ocp.external.rules.samples_op_failed_image_import_check.report",
"error_key": "SAMPLES_FAILED_IMAGE_IMPORT_ERR",
"description": "Lorem ipsum...",
"total_risk": 5
}
]
}
{
"cluster": "34c3ecc5-624a-49a5-bab8-4fdc5e51a267",
"requestID": "1yjdje758zgyy3ksfr732yb1cl",
"status": "processed",
"report": null
}
- HTTP code 400 is set in HTTP header
{
"status": "invalid UUID length: 35"
}
{
"status": "invalid request ID: '38584huk209q82uhl8md5gsdxr_'"
}
Returns the list of all DVO namespaces (i.e. array of objects) to which this particular account has access. Each object contains the namespace ID, the namespace display name if available, the cluster ID under which this namespace is created, and the number of affecting recommendations for this namespace as well.
curl -v localhost:8080/api/insights-results-aggregator/v2/namespaces/dvo
{
"status": "ok",
"workloads": [
{
"cluster": {
"uuid": "00000001-0001-0001-0001-000000000002",
"display_name": "Cluster name 00000001-0001-0001-0001-000000000002"
},
"namespace": {
"uuid": "d00b47da-fc6f-4c72-abc1-94f525441c75",
"name": "Namespace name d00b47da-fc6f-4c72-abc1-94f525441c75"
},
"metadata": {
"recommendations": 3,
"objects": 3,
"reported_at": "2023-10-05T07:37:59+02:00",
"last_checked_at": "2023-10-05T07:37:59+02:00",
"highest_severity": 4,
"hits_by_severity": {
"1": 0,
"2": 2,
"3": 0,
"4": 1
}
}
},
{
"cluster": {
"uuid": "00000001-0001-0001-0001-000000000002",
"display_name": "Cluster name 00000001-0001-0001-0001-000000000002"
},
"namespace": {
"uuid": "0fab74ee-61ce-498d-bcd4-070ad950b0d7",
"name": "Namespace name 0fab74ee-61ce-498d-bcd4-070ad950b0d7"
},
"metadata": {
"recommendations": 1,
"objects": 2,
"reported_at": "2023-10-05T07:37:59+02:00",
"last_checked_at": "2023-10-05T07:37:59+02:00",
"highest_severity": 3,
"hits_by_severity": {
"1": 0,
"2": 0,
"3": 1,
"4": 0
}
}
},
...
...
...
]
}
Returns recommendations for selected cluster and namespace. Please note that there are two REST API variants with different selector order, but the same results.
First variant:
curl localhost:8080/api/insights-results-aggregator/v2/namespaces/dvo/{namespace_uuid}/cluster/{cluster_uuid}
Second variant:
curl localhost:8080/api/insights-results-aggregator/v2/cluster/{cluster_name}/namespaces/dvo/{namespace}
curl localhost:8080/api/insights-results-aggregator/v2/namespaces/dvo/fbcbe2d3-e398-4b40-9d5e-4eb46fe8286f/cluster/00000001-0001-0001-0001-000000000002
{
"status": "ok",
"cluster": {
"uuid": "00000001-0001-0001-0001-000000000002",
"display_name": "Cluster name 00000001-0001-0001-0001-000000000002"
},
"namespace": {
"uuid": "fbcbe2d3-e398-4b40-9d5e-4eb46fe8286f",
"name": "Namespace name fbcbe2d3-e398-4b40-9d5e-4eb46fe8286f"
},
"metadata": {
"recommendations": 2,
"objects": 3,
"reported_at": "2023-12-12T10:35:17+01:00",
"last_checked_at": "2023-12-12T10:35:17+01:00",
"highest_severity": 4,
"hits_by_severity": {
"1": 0,
"2": 0,
"3": 0,
"4": 2
}
},
"recommendations": [
{
"check": "host_network",
"details": "Alert on pods/deployment-likes with sharing host's network namespace",
"resolution": "Ensure the host's network namespace is not shared.",
"modified": "2020-04-08T00:42:00Z",
"more_info": "For more info about the host network, refer to [documentation](https://www.google.com)",
"extra_data": {
"degraded_operators": [
{
"available": {
"last_trans_time": "2020-04-21T12:45:10Z",
"message": "Available: 2 nodes are active; 1 nodes are at revision 0; 2 nodes are at revision 2; 0 nodes have achieved new revision 3",
"reason": "AsExpected",
"status": true
},
"degraded": {
"last_trans_time": "2020-04-21T12:46:14Z",
"message": "NodeControllerDegraded: All master nodes are ready\nStaticPodsDegraded: nodes/ip-10-0-137-172.us-east-2.compute.internal pods/kube-apiserver-ip-10-0-137-172.us-east-2.compute.internal container=\"kube-apiserver-3\" is not ready",
"reason": "NodeInstallerDegradedInstallerPodFailed",
"status": true
},
"name": "kube-apiserver",
"progressing": {
"last_trans_time": "2020-04-21T12:43:00Z",
"message": "Progressing: 1 nodes are at revision 0; 2 nodes are at revision 2; 0 nodes have achieved new revision 3",
"reason": null,
"status": true
},
"upgradeable": {
"last_trans_time": "2020-04-21T12:42:52Z",
"message": null,
"reason": "AsExpected",
"status": true
},
"version": "4.3.13"
}
],
"error_key": "NODE_INSTALLER_DEGRADED",
"type": "rule"
},
"objects": [
{
"kind": "DaemonSet",
"uid": "be466de5-12fb-4710-bf70-62deb38ae563"
}
]
},
{
"check": "non_isolated_pod",
"details": "Alert on deployment-like objects that are not selected by any NetworkPolicy.",
"resolution": "Ensure pod does not accept unsafe traffic by isolating it with a NetworkPolicy. See https://cloud.redhat.com/blog/gUID:e-to-kubernetes-ingress-network-policies for more details.",
"modified": "2022-01-01T00:00:00Z",
"more_info": "There is no more info about this rule, sorry",
"extra_data": {
"type": "rule",
"error_key": "BUGZILLA_BUG_1766907"
},
"objects": [
{
"kind": "DaemonSet",
"uid": "be466de5-12fb-4710-bf70-62deb38ae563"
},
{
"kind": "DaemonSet",
"uid": "b51716a3-886b-4a67-b153-ce092fc91047"
}
]
}
]
}
The following endpoints needs to be enabled via configuration file by setting debug
option to true
.
Request to the service:
curl -X PUT -v localhost:8080/api/insights-results-aggregator/v2/exit
Response from the service:
None, the server will stop immediatelly.
Please look at DoD.md document for definition of done for new features and fixes.
Behaviour tests for this service are included in Insights Behavioral Spec repository. In order to run these tests, the following steps need to be made:
- clone the Insights Behavioral Spec repository
- go into the cloned subdirectory
insights-behavioral-spec
- run the
insights-results-aggregator-mock.sh
from this subdirectory
List of all test scenarios prepared for this service is available at https://github.com/RedHatInsights/insights-behavioral-spec#insights-results-aggregator-mock
Package manifest is available at docs/manifest.txt.