notification/slack
¶
The notification/slack
task posts a Slack message about current state of the experiment.
Example¶
The following task notifies a Slack channel with id C0138103183
and using the token contained in the secret slack-token
in the ns
namespace.
task: notification/slack
with:
channel: C0138103183
secret: ns/slack-token
Inputs¶
Field name | Field type | Description | Required |
---|---|---|---|
channel | string | Name of the Slack channel to which messages should be posted. | Yes |
secret | string | Identifies a secret containing a token to be used for authentication. Expressed as namespace/name . If namespace is not specified, the namespace of the experiment is used. | Yes |
ignoreFailure | bool | A flag indicating whether or not to ignore failures. If failures are not ignored, they cause the experiment to fail. Default is true . | No |
Result¶
A Slack message describing the experiment will be posted to the specified channel. Below is a sample Slack notification from this task.
Requirements¶
Slack API token¶
An API token allowing posting messages to the desired Slack channel is needed. To obtain a suitable token, see Sending messages using Incoming Webhooks. Once you have the token, store it in a Kubernetes secret. For example, to create the secret slack-secret in the default namespace:
kubectl create secret generic slack-secret --from-literal=token=<slack token>
Permission to read secret with Slack token¶
The Iter8 task runner needs permission to read the identified secret. For example the following RBAC changes will allow the task runner read the secret from the default namespace:
kubectl apply -f https://raw.githubusercontent.com/iter8-tools/iter8/master/samples/tasks/rbac/read-secrets.yaml
Inspect role and rolebinding
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
|
Slack channel ID¶
A Slack channel is identified by an id. To find the id, open the Slack channel in a web browser. The channel id is the portion of the URL of the form: CXXXXXXXX