Skip to content

Commit 372c7bc

Browse files
committed
RHDEVDOCS-3419 - Document support for alertmanager routing CRD
1 parent 04e7009 commit 372c7bc

10 files changed

+255
-3
lines changed

_topic_maps/_topic_map.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2001,6 +2001,8 @@ Topics:
20012001
File: configuring-the-monitoring-stack
20022002
- Name: Enabling monitoring for user-defined projects
20032003
File: enabling-monitoring-for-user-defined-projects
2004+
- Name: Enabling alert routing for user-defined projects
2005+
File: enabling-alert-routing-for-user-defined-projects
20042006
- Name: Managing metrics
20052007
File: managing-metrics
20062008
- Name: Managing metrics targets
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * monitoring/managing-alerts.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="creating-alert-routing-for-user-defined-projects_{context}"]
7+
= Creating alert routing for user-defined projects
8+
9+
[IMPORTANT]
10+
====
11+
[subs="attributes+"]
12+
Alert routing for user-defined projects is a Technology Preview feature only. Technology Preview features are not supported with Red Hat production service level agreements (SLAs) and might not be functionally complete. Red Hat does not recommend using them in production. These features provide early access to upcoming product features, enabling customers to test functionality and provide feedback during the development process.
13+
14+
For more information about the support scope of Red Hat Technology Preview features, see link:https://access.redhat.com/support/offerings/techpreview[https://access.redhat.com/support/offerings/techpreview].
15+
====
16+
17+
[role="_abstract"]
18+
If you are a non-administrator user who has been given the `alert-routing-edit` role, you can create or edit alert routing for user-defined projects.
19+
20+
.Prerequisites
21+
22+
* A cluster administrator has enabled monitoring for user-defined projects.
23+
* A cluster administrator has enabled alert routing for user-defined projects.
24+
* You are logged in as a user that has the `alert-routing-edit` role for the project for which you want to create alert routing.
25+
* You have installed the OpenShift CLI (`oc`).
26+
27+
.Procedure
28+
29+
. Create a YAML file for alert routing. The example in this procedure uses a file called `example-app-alert-routing.yaml`.
30+
31+
. Add an `AlertmanagerConfig` YAML definition to the file. For example:
32+
+
33+
[source,yaml]
34+
----
35+
apiVersion: monitoring.coreos.com/v1alpha1
36+
kind: AlertmanagerConfig
37+
metadata:
38+
name: example-routing
39+
namespace: ns1
40+
spec:
41+
route:
42+
receiver: default
43+
groupBy: [job]
44+
receivers:
45+
- name: default
46+
webhookConfigs:
47+
- url: https://example.org/post
48+
----
49+
+
50+
[NOTE]
51+
====
52+
For user-defined alerting rules, user-defined routing is scoped to the namespace in which the resource is defined.
53+
For example, a routing configuration defined in the `AlertmanagerConfig` object for namespace `ns1` only applies to `PrometheusRules` resources in the same namespace.
54+
====
55+
+
56+
. Save the file.
57+
58+
. Apply the resource to the cluster:
59+
+
60+
[source,terminal]
61+
----
62+
$ oc apply -f example-app-alert-routing.yaml
63+
----
64+
+
65+
The configuration is automatically applied to the Alertmanager pods.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * monitoring/enabling-alert-routing-for-user-defined-projects.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="disabling-alert-routing-for-user-defined-projects_{context}"]
7+
= Disabling alert routing for user-defined projects
8+
9+
[role="_abstract"]
10+
If you have enabled alert routing for user-defined projects, you can disable it. By doing so, you prevent users with the **alert-routing-edit** role from configuring alert routing for user-defined projects in Alertmanager.
11+
12+
[NOTE]
13+
====
14+
Alert routing for user-defined projects is disabled by default. You do not need to disable it if the feature is not already enabled.
15+
====
16+
17+
.Prerequisites
18+
19+
* You have enabled monitoring for user-defined projects.
20+
* You have enabled alert routing for user-defined projects.
21+
* You have access to the cluster as a user with the `cluster-admin` role.
22+
* You have installed the OpenShift CLI (`oc`).
23+
24+
.Procedure
25+
26+
. Edit the `cluster-monitoring-config` `ConfigMap` object:
27+
+
28+
[source,terminal]
29+
----
30+
$ oc -n openshift-monitoring edit configmap cluster-monitoring-config
31+
----
32+
+
33+
. Change the value to `false` for `enableUserAlertmanagerConfig` under the `alertmanagerMain` key in `data/config.yaml`:
34+
+
35+
[source,yaml]
36+
----
37+
apiVersion: v1
38+
kind: ConfigMap
39+
metadata:
40+
name: cluster-monitoring-config
41+
namespace: openshift-monitoring
42+
data:
43+
config.yaml: |
44+
enableUserWorkload: true
45+
alertmanagerMain:
46+
enableUserAlertmanagerConfig: false <1>
47+
----
48+
<1> When set to `false`, the `enableUserAlertmanagerConfig` parameter disables alert routing for user-defined projects in a cluster.
49+
+
50+
. Save the file to apply the changes. Alert routing for user-defined projects is disabled automatically.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * monitoring/enabling-alert-routing-for-user-defined-projects.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="enabling-alert-routing-for-user-defined-projects_{context}"]
7+
= Enabling alert routing for user-defined projects
8+
9+
[role="_abstract"]
10+
You can enable alert routing for user-defined projects. By doing so, you enable users with the **alert-routing-edit** role to configure alert routing and receivers for user-defined projects in Alertmanager.
11+
12+
.Prerequisites
13+
14+
* You have enabled monitoring for user-defined projects.
15+
* You have access to the cluster as a user with the `cluster-admin` role.
16+
* You have installed the OpenShift CLI (`oc`).
17+
18+
.Procedure
19+
20+
. Edit the `cluster-monitoring-config` `ConfigMap` object:
21+
+
22+
[source,terminal]
23+
----
24+
$ oc -n openshift-monitoring edit configmap cluster-monitoring-config
25+
----
26+
+
27+
. Add `enableUserAlertmanagerConfig: true` under the `alertmanagerMain` key in `data/config.yaml`:
28+
+
29+
[source,yaml]
30+
----
31+
apiVersion: v1
32+
kind: ConfigMap
33+
metadata:
34+
name: cluster-monitoring-config
35+
namespace: openshift-monitoring
36+
data:
37+
config.yaml: |
38+
enableUserWorkload: true
39+
alertmanagerMain:
40+
enableUserAlertmanagerConfig: true <1>
41+
----
42+
<1> When set to `true`, the `enableUserAlertmanagerConfig` parameter enables alert routing for user-defined projects in a cluster.
43+
+
44+
. Save the file to apply the changes. Alert routing for user-defined projects is enabled automatically.
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * monitoring/enabling-alert-routing-for-user-defined-projects.adoc
4+
5+
:_content-type: PROCEDURE
6+
[id="granting-users-permission-to-configure-alert-routing-for-user-defined-projects_{context}"]
7+
= Granting users permission to configure alert routing for user-defined projects
8+
9+
[role="_abstract"]
10+
You can grant users permission to configure alert routing for user-defined projects.
11+
12+
.Prerequisites
13+
14+
* You have access to the cluster as a user with the `cluster-admin` role.
15+
* The user account that you are assigning the role to already exists.
16+
* You have installed the OpenShift CLI (`oc`).
17+
* You have enabled monitoring for user-defined projects.
18+
19+
.Procedure
20+
21+
* Assign the `alert-routing-edit` role to a user in the user-defined project:
22+
+
23+
[source,terminal]
24+
----
25+
$ oc -n <namespace> adm policy add-role-to-user alert-routing-edit <user> <1>
26+
----
27+
<1> For `<namespace>`, substitute the namespace for the user-defined project, such as `ns1`. For `<user>`, substitute the username for the account to which you want to assign the role.

modules/monitoring-granting-users-permission-to-monitor-user-defined-projects.adoc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ Cluster administrators can grant developers and other users permission to monito
1717

1818
You can also grant users permission to configure the components that are responsible for monitoring user-defined projects:
1919

20-
* The *user-workload-monitoring-config-edit* role in the `openshift-user-workload-monitoring` project enables you to edit the `user-workload-monitoring-config` `ConfigMap` object. With this role, you can edit the `ConfigMap` object to configure Prometheus, Prometheus Operator and Thanos Ruler for user-defined workload monitoring.
20+
* The *user-workload-monitoring-config-edit* role in the `openshift-user-workload-monitoring` project enables you to edit the `user-workload-monitoring-config` `ConfigMap` object. With this role, you can edit the `ConfigMap` object to configure Prometheus, Prometheus Operator, and Thanos Ruler for user-defined workload monitoring.
21+
22+
You can also grant users permission to configure alert routing for user-defined projects:
23+
24+
* The **alert-routing-edit** role grants a user permission to create, update, and delete `AlertmanagerConfig` custom resources for a project.
2125

2226
This section provides details on how to assign these roles by using the {product-title} web console or the CLI.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Module included in the following assemblies:
2+
//
3+
// * monitoring/enabling-alert-routing-for-user-defined-projects.adoc
4+
5+
:_content-type: CONCEPT
6+
[id="understanding-alert-routing-for-user-defined-projects_{context}"]
7+
= Understanding alert routing for user-defined projects
8+
9+
[role="_abstract"]
10+
As a cluster administrator, you can enable alert routing for user-defined projects. After doing so, you can allow users to configure alert routing for their user-defined projects. Users can then create and configure user-defined alert routing by creating or editing the `AlertmanagerConfig` objects.
11+
12+
After a user has defined alert routing for a user-defined project, user-defined alerts are routed to the `alertmanager-main` pods in the `openshift-monitoring` namespace.
13+
14+
Note the following limitations and features of alert routing for user-defined projects:
15+
16+
* For user-defined alerting rules, user-defined routing is scoped to the namespace in which the resource is defined.
17+
For example, a routing configuration in namespace `ns1` only applies to `PrometheusRules` resources in the same namespace.
18+
19+
* The Cluster Monitoring Operator (CMO) does not deploy a second Alertmanager service dedicated to user-defined alerts.
20+
Cluster administrators continue to define the main Alertmanager configuration by using a custom secret or the {product-title} web console.
21+
22+
* When a namespace is excluded from user-defined monitoring, `AlertmanagerConfig` resources in the namespace cease to be part of the Alertmanager configuration.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
:_content-type: ASSEMBLY
2+
[id="enabling-alert-routing-for-user-defined-projects"]
3+
= Enabling alert routing for user-defined projects
4+
include::modules/common-attributes.adoc[]
5+
:context: enabling-alert-routing-for-user-defined-projects
6+
7+
toc::[]
8+
9+
:FeatureName: Alert routing for user-defined projects
10+
include::modules/technology-preview.adoc[leveloffset=+1]
11+
12+
[role="_abstract"]
13+
In {product-title} {product-version}, a cluster administrator can enable alert routing for user-defined projects.
14+
15+
//Overview of alert routing for user-defined projects
16+
include::modules/monitoring-understanding-alert-routing-for-user-defined-projects.adoc[leveloffset=+1]
17+
18+
// Enabling alert routing for user-defined projects
19+
include::modules/monitoring-enabling-alert-routing-for-user-defined-projects.adoc[leveloffset=+1]
20+
21+
// Granting users permission to configure alert routing for user-defined projects
22+
include::modules/monitoring-granting-users-permission-to-configure-alert-routing-for-user-defined-projects.adoc[leveloffset=+1]
23+
24+
// Disabling alert routing for user-defined projects
25+
include::modules/monitoring-disabling-alert-routing-for-user-defined-projects.adoc[leveloffset=+1]
26+
27+
.Additional resources
28+
29+
* xref:../monitoring/enabling-monitoring-for-user-defined-projects.adoc#enabling-monitoring-for-user-defined-projects[Enabling monitoring for user defined projects]
30+
* xref:../monitoring/managing-alerts.adoc#managing-alerts[Managing alerts]
31+
32+
== Next steps
33+
34+
* xref:../monitoring/managing-alerts.adoc#creating-alert-routing-for-user-defined-projects_managing-alerts[Creating alert routing for user defined projects]
35+
36+

monitoring/enabling-monitoring-for-user-defined-projects.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ include::modules/common-attributes.adoc[]
66

77
toc::[]
88

9-
In {product-title} {product-version}, you can enable monitoring for user-defined projects in addition to the default platform monitoring. You can now monitor your own projects in {product-title} without the need for an additional monitoring solution. Using this new feature centralizes monitoring for core platform components and user-defined projects.
9+
In {product-title} {product-version}, you can enable monitoring for user-defined projects in addition to the default platform monitoring. You can monitor your own projects in {product-title} without the need for an additional monitoring solution. Using this feature centralizes monitoring for core platform components and user-defined projects.
1010

1111
[NOTE]
1212
====
@@ -41,4 +41,4 @@ include::modules/monitoring-disabling-monitoring-for-user-defined-projects.adoc[
4141

4242
== Next steps
4343

44-
* xref:../monitoring/managing-metrics.adoc#managing-metrics[Managing metrics]
44+
* xref:../monitoring/enabling-alert-routing-for-user-defined-projects.adoc#enabling-alert-routing-for-user-defined-projects[Enabling alert routing for user defined projects]

monitoring/managing-alerts.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ include::modules/monitoring-expiring-silences.adoc[leveloffset=+2]
5757
// Sending notifications to external systems
5858
include::modules/monitoring-sending-notifications-to-external-systems.adoc[leveloffset=+1]
5959
include::modules/monitoring-configuring-alert-receivers.adoc[leveloffset=+2]
60+
// Creating alert routing for user-defined projects
61+
include::modules/monitoring-creating-alert-routing-for-user-defined-projects.adoc[leveloffset=+2]
6062

6163
// Applying a custom Alertmanager configuration
6264
include::modules/monitoring-applying-custom-alertmanager-configuration.adoc[leveloffset=+1]

0 commit comments

Comments
 (0)