Kubernetes operator for Slack
Slack operator is used to automate the process of setting up a Slack channel for alertmanager in a k8s native way. By using CRDs it lets you:
- Manage Channels
- Configure Issues
It uses Slack Api in it's underlying layer and can be extended to perform other tasks that are supported via the REST API.
- Slack account
- API Token to access Slack API (https://api.slack.com/)
Create the following secret which is required for slack-operator:
kind: Secret
apiVersion: v1
metadata:
name: slack-secret
type: Opaque
data:
APIToken: <SLACK_API_TOKEN>
- Make sure that certman is deployed in your cluster since webhooks require certman to generate valid certs since webhooks serve using HTTPS
- To install certman
$ kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/download/v1.3.1/cert-manager.yaml
- Deploy operator
$ oc apply -f bundle/manifests
- Operator-sdk v1.7.2 is required for local development.
-
Create
slack-secret
secret -
Run
make run ENABLE_WEBHOOKS=false WATCH_NAMESPACE=default OPERATOR_NAMESPACE=default
whereWATCH_NAMESPACE
denotes the namespaces that the operator is supposed to watch andOPERATOR_NAMESPACE
is the namespace in which it's supposed to be deployed. -
Before committing your changes run the following to ensure that everything is verified and up-to-date:
make verify
- Create a namespace with the name
test
- Create
slack-secret
secret in test namespace
Use the following command to run tests:
make test OPERATOR_NAMESPACE=test USE_EXISTING_CLUSTER=true