https://github.com/outtherelabs/openshift-slack-notifications
OpenShift slack notifications
https://github.com/outtherelabs/openshift-slack-notifications
kubernetes openshift ops slack-bot
Last synced: 9 months ago
JSON representation
OpenShift slack notifications
- Host: GitHub
- URL: https://github.com/outtherelabs/openshift-slack-notifications
- Owner: OutThereLabs
- License: mit
- Created: 2017-03-28T00:25:59.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-04-19T08:32:32.000Z (about 8 years ago)
- Last Synced: 2025-08-12T18:40:33.047Z (11 months ago)
- Topics: kubernetes, openshift, ops, slack-bot
- Language: Go
- Size: 38.1 KB
- Stars: 12
- Watchers: 2
- Forks: 11
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OpenShift Slack Notifications
A project to send OpenShift error messages to a slack channel of your choice.
## Cluster Deployment
First create a [Slack Incoming Webhook](https://my.slack.com/services/new/incoming-webhook).
Then deploy this bot to OpenShift with permissions via:
```shell
$ oc adm policy add-cluster-role-to-user cluster-reader system:serviceaccount::default --as=system:admin
$ oc new-app -f https://raw.githubusercontent.com/OutThereLabs/openshift-slack-notifications/master/template.yaml \
-p SLACK_WEBHOOK_URL=https://hooks.slack.com/services/ \
-p OPENSHIFT_CONSOLE_URL=https://:8443/console
$ oc start-build openshift-slack-notifications
```
Once the app is built and deployed, it will start sending notifications to slack when there are `Warning` type events.

## Local Development
### Cluster Requirements
First you need a running minishift cluster. This can be installed via homebrew:
```shell
$ brew install socat openshift-cli docker-machine-driver-xhyve
$ brew tap caskroom/versions
$ brew cask install minishift-beta
```
The xhyve hypervisor requires superuser privileges. To enable, execute:
```shell
$ sudo chown root:wheel /usr/local/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
$ sudo chmod u+s /usr/local/opt/docker-machine-driver-xhyve/bin/docker-machine-driver-xhyve
```
Then start the cluster with:
```shell
$ minishift start --memory 4048
```
### App Requirements
First add the privileges to mount volumes and read cluster state to your service account:
```shell
$ oc login -u system:admin
$ oc adm policy add-scc-to-user hostmount-anyuid system:serviceaccount:myproject:default --as=system:admin
$ oc adm policy add-cluster-role-to-user cluster-reader system:serviceaccount:myproject:default --as=system:admin
```
Then create your dev environment via the provided template
```shell
$ oc process -f debug-template.yaml -v SOURCE_PATH="${PWD}" SLACK_WEBHOOK_URL= OPENSHIFT_CONSOLE_URL=https://:8443/console | oc create -f -
$ oc start-build go
```
### Debugging the app
To run a local copy, start a debug pod
```shell
$ oc debug dc/go-dev
$ cd go/github.com/outtherelabs/openshift-slack-notifications && glide up
$ go run main.go
```