Coder Social home page Coder Social logo

gioamato / kube-cleanup-operator Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lwolf/kube-cleanup-operator

1.0 0.0 0.0 22.7 MB

Kubernetes Operator to automatically delete completed Jobs and their Pods

License: MIT License

Makefile 13.87% Go 84.09% Dockerfile 2.04%

kube-cleanup-operator's Introduction

Kubernetes cleanup operator

Build Status Go Report Card Docker Repository on Quay

Experimental Kubernetes Operator to automatically delete completed Jobs and their Pods. Controller listens for changes in Pods created by Jobs and deletes it on Completion.

Some defaults:

  • All Namespaces are monitored by default
  • Only Pods created by Jobs are monitored

Usage

screensharing

# remember to change namespace in RBAC manifests for monitoring namespaces other than "default"

kubectl create -f https://raw.githubusercontent.com/lwolf/kube-cleanup-operator/master/deploy/rbac.yaml

# create deployment
kubectl create -f https://raw.githubusercontent.com/lwolf/kube-cleanup-operator/master/deploy/deployment.yaml


kubectl logs -f $(kubectl get pods --namespace default -l "run=cleanup-operator" -o jsonpath="{.items[0].metadata.name}")

# Use simple job to test it
kubectl create -f https://k8s.io/examples/controllers/job.yaml

Docker images

docker pull quay.io/lwolf/kube-cleanup-operator

or you can build it yourself as follows:

$ make install_deps
$ make build
$ cp bin/kube-cleanup-operator .
$ docker build .

Development

$ make install_deps
$ make build
$ ./bin/kube-cleanup-operator --help
Usage of ./bin/kube-cleanup-operator:
  -namespace string
    	Watch only this namespaces (omit to operate clusterwide)
  -run-outside-cluster
    	Set this flag when running outside of the cluster.
  -keep-successful
        the number of hours to keep a succesfull job
        -1 - forever 
        0  - never (default)
        >0 - number of hours
  -keep-failures
        the number of hours to keep a failed job
        -1 - forever (default)
        0  - never
        >0 - number of hours
  -keep-pending
        the number of hours to keep a pending job
        -1 - forever (default)
        0  - forever
        >0 - number of hours
  -dry-run
        Perform dry run, print only
        
$ ./bin/kube-cleanup-operator --run-outside-cluster --namespace=default --keep-successful=0 --keep-failures=-1 --keep-pending=-1

Optional parameters

DISCLAIMER: These parameters are not supported on this project since they are implemented by the underlying libraries. Any malfunction regarding the use them is not covered by this GitHub repository. They are included in this documentation since the debugging process is simplified.

-alsologtostderr
  log to standard error as well as files
-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
-vmodule value
  comma-separated list of pattern=N settings for file-filtered logging

kube-cleanup-operator's People

Contributors

aalubin avatar dvrkps avatar gtseres avatar lwolf avatar okumin avatar sqisch avatar tripledogdare avatar

Stargazers

 avatar

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.