kube-green

A Kubernetes operator to reduce CO2 footprint of your clusters.
https://github.com/kube-green/kube-green

Category: Consumption
Sub Category: Computation and Communication

Keywords

climate-change cloud-native downscale green-software hacktoberfest k8s kubernetes resources

Keywords from Contributors

mock

Last synced: about 23 hours ago
JSON representation

Repository metadata

A K8s operator to reduce CO2 footprint of your clusters

README.md

Go Report Card
Coverage
Security
Coverage Status
Documentations
Adopters
CNCF Landscape

How many of your dev/preview pods stay on during weekends? Or at night? It's a waste of resources! And money! But fear not, kube-green is here to the rescue.

kube-green is a simple k8s addon that automatically shuts down (some of) your resources when you don't need them.

If you already use kube-green, add yourself as an adopter!

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See how to install the project on a live system in our docs.

Prerequisites

Make sure you have Go installed (download). Version 1.19 or higher is required.

Installation

To have kube-green running locally just clone this repository and install the dependencies running:

go get

Running the tests

There are different types of tests in this repository.

It is possible to run all the unit tests with

make test

To run integration tests installing kube-green with kustomize, run:

make e2e-test-kustomize

otherwise, to run integration tests installing kube-green with helm, run:

make e2e-test

It is possible to run only a specific harness integration test, running e2e-test with the OPTION variable:

make e2e-test OPTION="-run=TestSleepInfoE2E/kuttl/run_e2e_tests/harness/{TEST_NAME}"

Deployment

To deploy kube-green in live systems, follow the docs.

To run kube-green for development purpose, you can use ko to deploy
in a KinD cluster.
It is possible to start a KinD cluster running kind create cluster --name kube-green-development.
To deploy kube-green using ko, run:

make local-run clusterName=kube-green-development

Usage

The use of this operator is very simple. Once installed on the cluster, configure the desired CRD to make it works.

See here the documentation about the configuration of the CRD.

CRD Examples

Note: The timeZone field uses IANA time zone identifiers. If not set, it defaults to UTC. You can set it to any valid timezone such as Europe/Rome, America/New_York, etc.

Pods running during working hours with Europe/Rome timezone, suspend CronJobs and exclude a deployment named api-gateway:

apiVersion: kube-green.com/v1alpha1
kind: SleepInfo
metadata:
  name: working-hours
spec:
  weekdays: "1-5"
  sleepAt: "20:00"
  wakeUpAt: "08:00"
  timeZone: "Europe/Rome"
  suspendCronJobs: true
  excludeRef:
    - apiVersion: "apps/v1"
      kind:       Deployment
      name:       api-gateway

Pods sleep every night without restore:

apiVersion: kube-green.com/v1alpha1
kind: SleepInfo
metadata:
  name: working-hours-no-wakeup
spec:
  sleepAt: "20:00"
  timeZone: Europe/Rome
  weekdays: "*"

To see other examples, go to our docs.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the release on this repository.

How to upgrade the version

To upgrade the version:

  1. make release version=v{{NEW_VERSION_TO_TAG}} where {{NEW_VERSION_TO_TAG}} should be replaced with the next version to upgrade. N.B.: version should include v as first char.
  2. git push --tags origin v{{NEW_VERSION_TO_TAG}}

API Reference documentation

API reference is automatically generated with this tool. To generate it automatically, are added in api versioned folder a file doc.go with the content of file groupversion_info.go and a comment with +genclient in the sleepinfo_types.go file for the resource type.

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgement

Special thanks to JGiola for the tech review.

Give a Star! ⭐

If you like or are using this project, please give it a star. Thanks!

Adopters

Here the list of adopters of kube-green.

If you already use kube-green, add yourself as an adopter!


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 5 days ago

Total Commits: 620
Total Committers: 24
Avg Commits per committer: 25.833
Development Distribution Score (DDS): 0.308

Commits in past year: 72
Committers in past year: 5
Avg Commits per committer in past year: 14.4
Development Distribution Score (DDS) in past year: 0.278

Name Email Commits
Davide Bianchi b****2@g****m 429
dependabot[bot] 4****] 150
Andrea Quintino a****0@g****m 11
Wen Zhou w****u@r****m 5
Furkan s****r@g****m 3
Christian Huth c****n@k****t 2
Jacopo Andrea Giola j****o@g****g 2
Paolo Scanferla p****a@g****m 2
Ahméd Belhoula 4****a 1
David J. M. Karlsen d****d@d****m 1
Forlot Romain r****t@y****m 1
Francesco Francomano s****i@g****m 1
Gustavo Bini 6****i 1
Matheus Fidelis m****s 1
Mr. Burton 6****n 1
Natallia Savelyeva n****a@t****o 1
Rover van der Noort 3****t 1
Victor Boissiere v****e@q****m 1
dejanualex d****u@g****m 1
hiromi-mi 3****i 1
imdmahajankanika 4****a 1
k11h.de 1****e 1
lazy-slackoth 1****h 1
zyue110026 9****6 1

Committer domains:


Issue and Pull Request metadata

Last synced: 2 days ago

Total issues: 105
Total pull requests: 723
Average time to close issues: 4 months
Average time to close pull requests: 17 days
Total issue authors: 66
Total pull request authors: 29
Average comments per issue: 3.01
Average comments per pull request: 1.27
Merged pull request: 322
Bot issues: 4
Bot pull requests: 547

Past year issues: 13
Past year pull requests: 117
Past year average time to close issues: about 1 month
Past year average time to close pull requests: 16 days
Past year issue authors: 12
Past year pull request authors: 9
Past year average comments per issue: 1.54
Past year average comments per pull request: 0.86
Past year merged pull request: 70
Past year bot issues: 1
Past year bot pull requests: 91

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/kube-green/kube-green

Top Issue Authors

  • davidebianchi (22)
  • dependabot[bot] (4)
  • blezoray (3)
  • AmitBaranes (3)
  • msfidelis (3)
  • giulioroggero (3)
  • davidkarlsen (3)
  • SA-KIRA (2)
  • amitkbaid (2)
  • kernelold (2)
  • kimllee (2)
  • imdmahajankanika (2)
  • valipashask26 (1)
  • furkansb (1)
  • GoranHalvarsson (1)

Top Pull Request Authors

  • dependabot[bot] (547)
  • davidebianchi (117)
  • furkansb (8)
  • zdtsw (5)
  • abelhoula (4)
  • msfidelis (4)
  • christianhuth (3)
  • JGiola (3)
  • imdmahajankanika (3)
  • dirk39 (3)
  • hiromi-mi (2)
  • gustavobini (2)
  • dejanu (2)
  • k11h-de (2)
  • lazy-slackoth (2)

Top Issue Labels

  • enhancement (26)
  • bug (13)
  • documentation (6)
  • good first issue (5)
  • question (5)
  • dependencies (4)
  • deploy (4)
  • supported-resources (3)
  • helm-chart (3)
  • tests (2)
  • go (2)
  • github_actions (1)
  • duplicate (1)
  • docker (1)

Top Pull Request Labels

  • dependencies (564)
  • go (266)
  • github_actions (118)
  • docker (68)
  • enhancement (52)
  • helm-chart (13)
  • deploy (9)
  • bug (9)
  • breaking-change (7)
  • documentation (6)
  • tests (1)
  • security-fix (1)

Package metadata

proxy.golang.org: github.com/kube-green/kube-green

  • Homepage: https://github.com/kube-green/kube-green
  • Documentation: https://pkg.go.dev/github.com/kube-green/kube-green#section-documentation
  • Licenses: mit
  • Latest release: v0.7.1 (published about 1 year ago)
  • Last Synced: 2026-08-30T22:02:15.482Z (2 days ago)
  • Versions: 17
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Docker Downloads: 46
  • Rankings:
    • Stargazers count: 2.045%
    • Forks count: 3.277%
    • Average: 5.417%
    • Dependent packages count: 6.999%
    • Dependent repos count: 9.346%

Score: 14.28802104242119