Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bjhaid/oga
initializer kubernetes slack
Last synced: 22 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/bjhaid/oga
- Owner: bjhaid
- Created: 2017-10-04T03:54:02.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-10-05T01:24:17.000Z (over 7 years ago)
- Last Synced: 2024-11-18T09:22:25.908Z (3 months ago)
- Topics: initializer, kubernetes, slack
- Language: Go
- Size: 21.4 MB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Oga
_Let the bots deploy and the humans approve._
Oga is a [Kubernetes
intializer](https://kubernetes.io/docs/admin/extensible-admission-controllers/#configure-initializers-on-the-fly)
that blocks a deployment from initializing and requests approval from
slack(this can be extended with different requesters in the future see
[fake_requester](initializer/fake_requester.go) as an example) before allowing
the deployment to continue.## Usage
Create the initializer resource in k8s e.g:
```bash
$> kubectl apply -f examples/initializer.yaml
```Run the bot:
```
$> ./oga -bot-name oga -slack-token ""`
```_this will be updated with a k8s deployment in the future_
On deployments that require approval, define the below annotation on them:
```yaml
metadata:
annotations:
"initializer.kubernetes.io/oga": |
slack:
channel: "#testoga"
approvers:
- "@bjhaid"
```Apply the deployment and you should get a message like below in slack if it's
configured correctly:
![approval image](examples/approval_screenshot.png)On successful approval oga will update the deployment metadata as below:
```yaml
metadata:
annotations:
deployment.kubernetes.io/revision: "1"
initializer.kubernetes.io/oga: |
approved_by: |
Username: bjhaid, Fullname: Ayodele, Email: [email protected]
slack:
approvers:
- '@bjhaid'
channel: '#testoga'
```Including the details of the person who responded to the approval request on the annotation.
If you need to override `oga`'s approval request for any reason you can declare
an empty initializer on your deployment configuration as below:```yaml
metadata:
initializers:
annotations:
"initializer.kubernetes.io/oga": |
slack:
channel: "#testoga"
approvers:
- "@bjhaid"
```**Note this will remove all initializers including `oga`**
```bash
Usage of ./oga:
-alsologtostderr
log to standard error as well as files
-annotation string
The annotation to trigger initialization (default "initializer.kubernetes.io/oga")
-bot-name string
The username of the oga bot as created in slack
-initializer-name string
The initializer name (default "oga.initializer.kubernetes.io")
-kubeconfig string
(optional) absolute path to the kubeconfig file (default "/Users/bjhaid/.kube/config")
-log_backtrace_at value
when logging hits line file:N, emit a stack trace
-log_dir string
If non-empty, write log files in this directory
-logtostderr
log to standard error instead of files
-slack-token string
Slack API token
-stderrthreshold value
logs at or above this threshold go to stderr
-v value
log level for V logs
-vmodule value
comma-separated list of pattern=N settings for file-filtered logging
```## TODO:
- [ ] Add k8s configuration files for deploying oga to k8s.
- [ ] Add support for slack groups.
- [ ] High Availability of oga, currently can run only a single oga instance.