Skip to content

Commit 8216e87

Browse files
committed
review adjustments
1 parent 9852ee0 commit 8216e87

9 files changed

+364
-197
lines changed

Documentation/resources.adoc

Lines changed: 120 additions & 60 deletions
Large diffs are not rendered by default.

Documentation/resources.md

Lines changed: 96 additions & 60 deletions
Large diffs are not rendered by default.

test/e2e/test_command/scripts/openshift-monitoring_alertmanager-main_service_port_9092.yaml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
tests:
22
- script: |
3-
# The following example exercises permissions granted by the monitoring-rules-edit Cluster Role.
4-
# The binding commands are supposed to run by a user with the necessary privileges.
3+
## The following example exercises permissions granted by the `monitoring-rules-edit` cluster role.
4+
## The binding commands must be run by a user with the necessary privileges.
5+
# Create a test namespace and a service account.
56
oc create namespace test-alertmanager-tenancy-monitoring-rules-edit
67
oc create serviceaccount am-client --namespace=test-alertmanager-tenancy-monitoring-rules-edit
7-
# The binding is done to a Service Account, but it can also be applied to any other user.
8+
# Bind the role to the service account.
9+
# The binding in this example is applied to a service account but can also be applied to any user.
810
oc create rolebinding test-alertmanager-tenancy-monitoring-rules-edit \
911
--namespace=test-alertmanager-tenancy-monitoring-rules-edit \
1012
--clusterrole=monitoring-rules-edit \
1113
--serviceaccount=test-alertmanager-tenancy-monitoring-rules-edit:am-client
12-
# The token can then be used to access the endpoints on the port.
14+
# Generate a token to access the endpoints.
1315
TOKEN=$(oc create token am-client --namespace=test-alertmanager-tenancy-monitoring-rules-edit)
14-
# Because the port is not exposed by default, the endpoint is assumed to be accessed from within the cluster.
16+
# Access Alertmanager endpoints from within the cluster. The port is not exposed externally by default.
1517
curl -k -f -H "Authorization: Bearer $TOKEN" "https://alertmanager-main.openshift-monitoring:9092/api/v2/alerts?namespace=test-alertmanager-tenancy-monitoring-rules-edit"
1618
curl -k -X POST -f "https://alertmanager-main.openshift-monitoring:9092/api/v2/silences?namespace=test-alertmanager-tenancy-monitoring-rules-edit" \
1719
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
@@ -31,18 +33,20 @@ tests:
3133
tearDown: |
3234
oc delete namespace test-alertmanager-tenancy-monitoring-rules-edit --wait=false
3335
- script: |
34-
# The following example exercises permissions granted by the monitoring-edit Cluster Role.
35-
# The binding commands are supposed to run by a user with the necessary privileges.
36+
## The following example exercises permissions granted by the `monitoring-edit` cluster role.
37+
## The binding commands must be run by a user with the necessary privileges.
38+
# Create a test namespace and a service account.
3639
oc create namespace test-alertmanager-tenancy-monitoring-edit
3740
oc create serviceaccount am-client --namespace=test-alertmanager-tenancy-monitoring-edit
38-
# The binding is done to a Service Account, but it can also be applied to any other user.
41+
# Bind the role to the service account.
42+
# The binding in this example is applied to a service account but can also be applied to any user.
3943
oc create rolebinding test-alertmanager-tenancy-monitoring-edit \
4044
--namespace=test-alertmanager-tenancy-monitoring-edit \
4145
--clusterrole=monitoring-edit \
4246
--serviceaccount=test-alertmanager-tenancy-monitoring-edit:am-client
43-
# The token can then be used to access the endpoints on the port.
47+
# Generate a token to access the endpoints.
4448
TOKEN=$(oc create token am-client --namespace=test-alertmanager-tenancy-monitoring-edit)
45-
# Because the port is not exposed by default, the endpoint is assumed to be accessed from within the cluster.
49+
# Access Alertmanager endpoints from within the cluster. The port is not exposed externally by default.
4650
curl -k -f -H "Authorization: Bearer $TOKEN" "https://alertmanager-main.openshift-monitoring:9092/api/v2/alerts?namespace=test-alertmanager-tenancy-monitoring-edit"
4751
curl -k -X POST -f "https://alertmanager-main.openshift-monitoring:9092/api/v2/silences?namespace=test-alertmanager-tenancy-monitoring-edit" \
4852
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \

test/e2e/test_command/scripts/openshift-monitoring_alertmanager-main_service_port_9094.yaml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,41 @@
11
tests:
22
- script: |
3-
# The following example exercises permissions granted by the monitoring-alertmanager-view Role.
4-
# The binding commands are supposed to run by a user with the necessary privileges.
3+
## The following example exercises permissions granted by the `monitoring-alertmanager-view` role.
4+
## The binding commands must be run by a user with the necessary privileges.
5+
# Create a test namespace and a service account.
56
oc create namespace test-alertmanager-web-monitoring-alertmanager-view
67
oc create serviceaccount am-client --namespace=test-alertmanager-web-monitoring-alertmanager-view
7-
# The binding is done to a Service Account, but it can also be applied to any other user.
8+
# Bind the role to the service account.
9+
# The binding in this example is applied to a service account but can also be applied to any user.
810
oc create rolebinding test-alertmanager-web-monitoring-alertmanager-view \
911
--namespace=openshift-monitoring \
1012
--role=monitoring-alertmanager-view \
1113
--serviceaccount=test-alertmanager-web-monitoring-alertmanager-view:am-client
12-
# The token can then be used to access the endpoints.
14+
# Generate a token to access the endpoints.
1315
TOKEN=$(oc create token am-client --namespace=test-alertmanager-web-monitoring-alertmanager-view)
16+
# Access Alertmanager endpoints externally.
1417
ROUTE=$(oc get route alertmanager-main --namespace=openshift-monitoring -ojsonpath={.spec.host})
1518
curl -k -H "Authorization: Bearer $TOKEN" "https://$ROUTE/api/v2/alerts?filter=alertname=Watchdog"
16-
# The endpoints can also be accessed from within the cluster.
19+
# Access Alertmanager endpoints from within the cluster.
1720
curl -k -H "Authorization: Bearer $TOKEN" "https://alertmanager-main.openshift-monitoring:9094/api/v2/alerts?filter=alertname=Watchdog"
1821
tearDown: |
1922
oc delete rolebinding test-alertmanager-web-monitoring-alertmanager-view --namespace=openshift-monitoring
2023
oc delete namespace test-alertmanager-web-monitoring-alertmanager-view --wait=false
2124
- script: |
22-
# The following example exercises permissions granted by the monitoring-alertmanager-edit Role.
23-
# The binding commands are supposed to run by a user with the necessary privileges.
25+
## The following example exercises permissions granted by the `monitoring-alertmanager-edit` role.
26+
## The binding commands must be run by a user with the necessary privileges.
27+
# Create a test namespace and a service account.
2428
oc create namespace test-alertmanager-web-monitoring-alertmanager-edit
2529
oc create serviceaccount am-client --namespace=test-alertmanager-web-monitoring-alertmanager-edit
26-
# The binding is done to a Service Account, but it can also be applied to any other user.
30+
# Bind the role to the service account.
31+
# The binding in this example is applied to a service account but can also be applied to any user.
2732
oc create rolebinding test-alertmanager-web-monitoring-alertmanager-edit \
2833
--namespace=openshift-monitoring \
2934
--role=monitoring-alertmanager-edit \
3035
--serviceaccount=test-alertmanager-web-monitoring-alertmanager-edit:am-client
31-
# The token can then be used to access the endpoints on the port.
36+
# Generate a token to access the endpoints.
3237
TOKEN=$(oc create token am-client --namespace=test-alertmanager-web-monitoring-alertmanager-edit)
38+
# Access Alertmanager endpoints externally.
3339
ROUTE=$(oc get route alertmanager-main --namespace=openshift-monitoring -ojsonpath={.spec.host})
3440
curl -k -X POST "https://$ROUTE/api/v2/silences" \
3541
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
@@ -46,7 +52,7 @@ tests:
4652
"createdBy": "test-alertmanager-web-monitoring-alertmanager-edit/am-client",
4753
"comment": "Silence test"
4854
}'
49-
# The endpoints can also be accessed from within the cluster.
55+
# Access Alertmanager endpoints from within the cluster.
5056
curl -k -X POST "https://alertmanager-main.openshift-monitoring:9094/api/v2/silences" \
5157
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
5258
-d '{

test/e2e/test_command/scripts/openshift-monitoring_prometheus-k8s_service_port_9091.yaml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,44 @@
11
tests:
22
- script: |
3-
# The following example exercises permissions granted by the cluster-monitoring-view Cluster Role.
4-
# The binding commands are supposed to run by a user with the necessary privileges.
3+
## The following example exercises permissions granted by the `cluster-monitoring-view` cluster role.
4+
## The binding commands must be run by a user with the necessary privileges.
5+
# Create a test namespace and a service account.
56
oc create namespace test-prometheus-web-cluster-monitoring-view
67
oc create serviceaccount prom-client --namespace=test-prometheus-web-cluster-monitoring-view
7-
# The binding is done to a Service Account, but it can also be applied to any other user.
8+
# Bind the role to the service account.
9+
# The binding in this example is applied to a service account but can also be applied to any user.
810
oc create rolebinding test-prometheus-web-cluster-monitoring-view \
911
--namespace=openshift-monitoring \
1012
--clusterrole=cluster-monitoring-view \
1113
--serviceaccount=test-prometheus-web-cluster-monitoring-view:prom-client
12-
# The token can then be used to access the endpoints.
14+
# Generate a token to access the endpoints.
1315
TOKEN=$(oc create token prom-client --namespace=test-prometheus-web-cluster-monitoring-view)
16+
# Access Prometheus endpoints externally.
1417
ROUTE=$(oc get route prometheus-k8s --namespace=openshift-monitoring -ojsonpath={.spec.host})
1518
curl -k -H "Authorization: Bearer $TOKEN" "https://$ROUTE/api/v1/query?query=up"
16-
# The endpoints can also be accessed from within the cluster.
19+
# Access Prometheus endpoints from within the cluster.
1720
curl -k -H "Authorization: Bearer $TOKEN" "https://prometheus-k8s.openshift-monitoring:9091/api/v1/query?query=up"
1821
tearDown: |
1922
oc delete rolebinding test-prometheus-web-cluster-monitoring-view --namespace=openshift-monitoring
2023
oc delete namespace test-prometheus-web-cluster-monitoring-view --wait=false
2124
- script: |
22-
# The following example exercises permissions granted by the cluster-monitoring-metrics-api Role.
23-
# The binding commands are supposed to run by a user with the necessary privileges.
25+
## The following example exercises permissions granted by the `cluster-monitoring-metrics-api` role.
26+
## The binding commands must be run by a user with the necessary privileges.
27+
# Create a test namespace and a service account.
2428
oc create namespace test-prometheus-web-cluster-monitoring-metrics-api
2529
oc create serviceaccount prom-client --namespace=test-prometheus-web-cluster-monitoring-metrics-api
26-
# The binding is done to a Service Account, but it can also be applied to any other user.
30+
# Bind the role to the service account.
31+
# The binding in this example is applied to a service account but can also be applied to any user.
2732
oc create rolebinding test-prometheus-web-cluster-monitoring-metrics-api \
2833
--namespace=openshift-monitoring \
2934
--role=cluster-monitoring-metrics-api \
3035
--serviceaccount=test-prometheus-web-cluster-monitoring-metrics-api:prom-client
31-
# The token can then be used to access the endpoints.
36+
# Generate a token to access the endpoints.
3237
TOKEN=$(oc create token prom-client --namespace=test-prometheus-web-cluster-monitoring-metrics-api)
38+
# Access Prometheus endpoints externally.
3339
ROUTE=$(oc get route prometheus-k8s --namespace=openshift-monitoring -ojsonpath={.spec.host})
3440
curl -k -H "Authorization: Bearer $TOKEN" "https://$ROUTE/api/v1/query?query=up"
35-
# The endpoints can also be accessed from within the cluster.
41+
# Access Prometheus endpoints from within the cluster.
3642
curl -k -H "Authorization: Bearer $TOKEN" "https://prometheus-k8s.openshift-monitoring:9091/api/v1/query?query=up"
3743
tearDown: |
3844
oc delete rolebinding test-prometheus-web-cluster-monitoring-metrics-api --namespace=openshift-monitoring

test/e2e/test_command/scripts/openshift-monitoring_thanos-querier_service_port_9091.yaml

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,44 @@
11
tests:
22
- script: |
3-
# The following example exercises permissions granted by the cluster-monitoring-view Cluster Role.
4-
# The binding commands are supposed to run by a user with the necessary privileges.
3+
## The following example exercises permissions granted by the `cluster-monitoring-view` cluster role.
4+
## The binding commands must be run by a user with the necessary privileges.
5+
# Create a test namespace and a service account.
56
oc create namespace test-thanos-querier-web-cluster-monitoring-view
67
oc create serviceaccount thanos-client --namespace=test-thanos-querier-web-cluster-monitoring-view
7-
# The binding is done to a Service Account, but it can also be applied to any other user.
8+
# Bind the role to the service account.
9+
# The binding in this example is applied to a service account but can also be applied to any user.
810
oc create rolebinding test-thanos-querier-web-cluster-monitoring-view \
911
--namespace=openshift-monitoring \
1012
--clusterrole=cluster-monitoring-view \
1113
--serviceaccount=test-thanos-querier-web-cluster-monitoring-view:thanos-client
12-
# The token can then be used to access the endpoints.
14+
# Generate a token to access the endpoints.
1315
TOKEN=$(oc create token thanos-client --namespace=test-thanos-querier-web-cluster-monitoring-view)
16+
# Access Thanos Querier endpoints externally.
1417
ROUTE=$(oc get route thanos-querier --namespace=openshift-monitoring -ojsonpath={.spec.host})
1518
curl -k -H "Authorization: Bearer $TOKEN" "https://$ROUTE/api/v1/query?query=up"
16-
# The endpoints can also be accessed from within the cluster.
19+
# Access Thanos Querier endpoints from within the cluster.
1720
curl -k -H "Authorization: Bearer $TOKEN" "https://thanos-querier.openshift-monitoring:9091/api/v1/query?query=up"
1821
tearDown: |
1922
oc delete rolebinding test-thanos-querier-web-cluster-monitoring-view --namespace=openshift-monitoring
2023
oc delete namespace test-thanos-querier-web-cluster-monitoring-view --wait=false
2124
- script: |
22-
# The following example exercises permissions granted by the cluster-monitoring-metrics-api Role.
23-
# The binding commands are supposed to run by a user with the necessary privileges.
25+
## The following example exercises permissions granted by the `cluster-monitoring-metrics-api` role.
26+
## The binding commands must be run by a user with the necessary privileges.
27+
# Create a test namespace and a service account.
2428
oc create namespace test-thanos-querier-web-cluster-monitoring-metrics-api
2529
oc create serviceaccount thanos-client --namespace=test-thanos-querier-web-cluster-monitoring-metrics-api
26-
# The binding is done to a Service Account, but it can also be applied to any other user.
30+
# Bind the role to the service account.
31+
# The binding in this example is applied to a service account but can also be applied to any user.
2732
oc create rolebinding test-thanos-querier-web-cluster-monitoring-metrics-api \
2833
--namespace=openshift-monitoring \
2934
--role=cluster-monitoring-metrics-api \
3035
--serviceaccount=test-thanos-querier-web-cluster-monitoring-metrics-api:thanos-client
31-
# The token can then be used to access the endpoints.
36+
# Generate a token to access the endpoints.
3237
TOKEN=$(oc create token thanos-client --namespace=test-thanos-querier-web-cluster-monitoring-metrics-api)
38+
# Access Thanos Querier endpoints externally.
3339
ROUTE=$(oc get route thanos-querier --namespace=openshift-monitoring -ojsonpath={.spec.host})
3440
curl -k -H "Authorization: Bearer $TOKEN" "https://$ROUTE/api/v1/query?query=up"
35-
# The endpoints can also be accessed from within the cluster.
41+
# Access Thanos Querier endpoints from within the cluster.
3642
curl -k -H "Authorization: Bearer $TOKEN" "https://thanos-querier.openshift-monitoring:9091/api/v1/query?query=up"
3743
tearDown: |
3844
oc delete rolebinding test-thanos-querier-web-cluster-monitoring-metrics-api --namespace=openshift-monitoring
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
tests:
22
- script: |
3-
# The following example exercises permissions granted by the view Cluster Role.
4-
# The binding commands are supposed to run by a user with the necessary privileges.
3+
## The following example exercises permissions granted by the `view` cluster role.
4+
## The binding commands must be run by a user with the necessary privileges.
5+
# Create a test namespace and a service account.
56
oc create namespace test-thanos-querier-tenancy-view
67
oc create serviceaccount thanos-client --namespace=test-thanos-querier-tenancy-view
7-
# The binding is done to a Service Account, but it can also be applied to any other user.
8+
# Bind the role to the service account.
9+
# The binding in this example is applied to a service account but can also be applied to any user.
810
oc create rolebinding test-thanos-querier-tenancy-view \
911
--namespace=test-thanos-querier-tenancy-view \
1012
--clusterrole=view \
1113
--serviceaccount=test-thanos-querier-tenancy-view:thanos-client
12-
# The token can then be used to access the endpoints.
14+
# Generate a token to access the endpoints.
1315
TOKEN=$(oc create token thanos-client --namespace=test-thanos-querier-tenancy-view)
14-
# Because the port is not exposed by default, the endpoint is assumed to be accessed from within the cluster.
16+
# Access Thanos Querier endpoints from within the cluster. The port is not exposed externally by default.
1517
curl -k -f -H "Authorization: Bearer $TOKEN" "https://thanos-querier.openshift-monitoring:9092/api/v1/query?query=up&namespace=test-thanos-querier-tenancy-view"
1618
tearDown: |
1719
oc delete namespace test-thanos-querier-tenancy-view --wait=false

0 commit comments

Comments
 (0)