GithubHelp home page GithubHelp logo

zakkg3 / drone-cleanup Goto Github PK

View Code? Open in Web Editor NEW

This project forked from cargoxio/drone-cleanup

0.0 1.0 0.0 11 KB

Clean up completed drone.io jobs and pods from the Kubernetes cluster

License: Apache License 2.0

Dockerfile 22.98% Shell 77.02%

drone-cleanup's Introduction

Remove finished drone jobs and pods from cluster

Why

We've created this simple image and corresponding files to deal with the fact that Drone does not clean up jobs after itself.

Official documentation will tell you to enable TTLAfterFinished feature gate.

However, for some, that's simply not possible, as the TTL controller is available only from Kubernetes v1.12 on. And it's alpha so it's bound to change.

If you're on older version (e.g. kops only supports 1.11), you're left out in the dark.

How

This is a simple script which should be scheduler to run on your cluster every now and then - suggested timeout is 10 minutes, but you can set it to anything you like. Please see the attached example for more info.

Please note that you'll need to deploy a service account with this tool to access your cluster from inside the pod, if you have RBAC enabled.

Configuration

Nothing much to configure. Defaults should work in most cases. However, if you have any specifics, you can set up the following environment variables:

  • TTL_TIMEOUT timeout after which completed jobs and pods are deleted. By default it's set to 3600 seconds - so jobs and pods get cleared out after one hour.

Installation

kubectl apply -f drone-cleanup.yml

Please make sure that you set an appropriate namespace (drone, by default) in drone-cleanup.yml as the script will look for jobs in the current namespace only.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.