Overview ENTERPRISE
Notifications can be generated by a notification
policy from a system or stack. The notification
policy allows, for example, all denied decisions to generate a notification. Additionally, notifications can be generated by specific monitor
or enforce
rules.
Create Notifications
A notification is created only when a rule matches a resource.
The following shows an example monitor
rule that creates a notification sent to the Slack channel #channel-name
:
package policy["com.styra.kubernetes.validating"].rules.rules
# This rule will create a notification when it matches a resource.
monitor[decision] {
decision := {
"message": "Example monitor rule to trigger a notification",
"allowed": true,
"notify": {
{
"type": "slack",
"channel": "#channel-name"
}
}
}
}
note
-
For more information on how to configure out-of-the-box notification rules or how to write Rego rules to select which decisions to post to Slack channels, see the Slack Integration page.
-
All policies are written in Rego, the language provided by Open Policy Agent. Learn more about policy authoring at Styra Academy.