Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/henrywhitaker3/sre-operator
https://github.com/henrywhitaker3/sre-operator
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/henrywhitaker3/sre-operator
- Owner: henrywhitaker3
- Created: 2024-03-06T14:54:26.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-10-24T02:34:03.000Z (about 2 months ago)
- Last Synced: 2024-10-24T19:13:32.731Z (about 2 months ago)
- Language: Go
- Size: 140 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SRE Operator
Automate repetitive actions using kubernetes.
## Overview
### Triggers
There are 2 ways to trigger an action:
#### Webhooks
You can define a webhook resource:
```yaml
apiVersion: sre.henrywhitaker.com/v1alpha1
kind: Webhook
metadata:
name: demo-webhook
spec:
id: demo-hook
```Then you can trigger it manually by running:
```
curl -X POST {domain}/webhook/demo-hook
```Or setup your monitoring/alerting platform to call the webhook when a monitor is triggered.
#### Schedule
You can schedule actions to be triggered based on a cron schedule:
```yaml
apiVersion: sre.henrywhitaker.com/v1alpha1
kind: Schedule
metadata:
name: demo-schedule
spec:
id: demo-cron
cron: 0 * * * *
```### Actions
You can then create actions that subscribe to defined triggers:
#### Rollout
You can trigger the equivalent of `kubectl rollout {action} {kind} {name}`:
```yaml
apiVersion: sre.henrywhitaker.com/v1alpha1
kind: Rollout
metadata:
name: demo-rollout
spec:
triggers:
- demo-hook
- demo-cron
target:
kind: deployment
name: coredns
namespace: kube-system
# The rolout action, one of: restart, pause, resume
action: restart
# This is an optional field to throttle actions once for
# every specified period
throttle: 10m
```#### Script
You can define a script to be run:
```yaml
apiVerison: sre.henrywhitaker.com/v1alpha1
kind: Script
metadata:
name: demo-script
spec:
triggers:
- demo-hook
- demo-cron
# Optional: specifcy the image to use, defaults to alpine:latest
image: alpine:latest
# Optional: specify the shell to run the script with, defaults to: /bin/sh
shell: /bin/sh
script: |
echo Demo script!
# Optional: define secrets to be mounted to /var/sre/secrets and to populate env with
# These must be in the same namespace as the sre-operator
secrets:
- example-secret
```