About project
This container exposes GIT webhooks that will trigger kubernetes cluster helm deployment removal on branch deletion. Once webhook request is received, it will log on to Google Kubernetes Cluster and remove the deployment.
Compatibility:
- Github webhooks (webhook documentation)
- Payload URL:
<domain>/webhooks
- Content type:
application/x-www-form-urlencoded
- Secret:
<same as WEBHOOKS_SECRET>
- Individual events:
Branch or tag deletion
- Payload URL:
- Azure Repos service Hooks (webhook documentation):
- Service:
Web Hooks
- Trigger on this type of event:
Code pushed
- URL:
<domain>/webhooks
- Basic authentication username:
<any>
- Basic authentication password:
<same as WEBHOOKS_SECRET>
- Service:
- (untested) GitLab (webhook documentation)
- (untested) Bitbucket (webhook documentation)
Deployment requirements
-
Redis server for task queue
-
Provide following environment variables for the container
- WEBHOOKS_SECRET
- REDIS_HOST
- REDIS_PASSWORD
- Do deployment with a
serviceAccountName
that has permissions to remove other pods and helm releases.
Configuration
-
You have to add a custom application to your Github organisation (
https://github.com/organizations/<org name>/settings/apps/new
). Minimal configuration needsWebhook URL
andWebhook secret (optional)
defined. -
Application permissions & webhooks section, add
Repository contents
r/o permission and checkDelete (Branch or tag deleted.)
option inSubscribe to events
section. -
Enable this application in your organisation (
https://github.com/organizations/<org name>/settings/apps/<app name>/installations
). URL address is<host>/webhooks
(port 80)
Docker image build
Automated builds:
Tag a new release in github, docker hub integration will build and publish the images automatically.
Manual builds (only when automated builds are not working):
docker build --tag 'wunderio/silta-deployment-remover:latest' --tag 'wunderio/silta-deployment-remover:v1' --tag 'wunderio/silta-deployment-remover:v1.X' --tag 'wunderio/silta-deployment-remover:v1.X.Y' .
docker push wunderio/silta-deployment-remover:v1
docker push wunderio/silta-deployment-remover:v1.X
docker push wunderio/silta-deployment-remover:v1.X.Y