A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

kube-green

A k8s 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

observation mock archiving measur transforms compose conversion generic optimize projection

Last synced: about 17 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 you 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

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 you as an adopter!


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 4 days ago

Total Commits: 525
Total Committers: 17
Avg Commits per committer: 30.882
Development Distribution Score (DDS): 0.229

Commits in past year: 88
Committers in past year: 10
Avg Commits per committer in past year: 8.8
Development Distribution Score (DDS) in past year: 0.352

Name Email Commits
Davide Bianchi b****2@g****m 405
dependabot[bot] 4****] 91
Andrea Quintino a****0@g****m 11
Furkan s****r@g****m 3
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
Francesco Francomano s****i@g****m 1
Matheus Fidelis m****s 1
Natallia Savelyeva n****a@t****o 1
Victor Boissiere v****e@q****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: 1 day ago

Total issues: 92
Total pull requests: 444
Average time to close issues: 4 months
Average time to close pull requests: 16 days
Total issue authors: 57
Total pull request authors: 19
Average comments per issue: 3.39
Average comments per pull request: 1.41
Merged pull request: 185
Bot issues: 0
Bot pull requests: 338

Past year issues: 30
Past year pull requests: 95
Past year average time to close issues: about 2 months
Past year average time to close pull requests: 15 days
Past year issue authors: 19
Past year pull request authors: 7
Past year average comments per issue: 2.23
Past year average comments per pull request: 1.69
Past year merged pull request: 31
Past year bot issues: 0
Past year bot pull requests: 73

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

Top Issue Authors

  • davidebianchi (22)
  • blezoray (3)
  • AmitBaranes (3)
  • imdmahajankanika (3)
  • msfidelis (3)
  • giulioroggero (3)
  • slim-azaiz (2)
  • kernelold (2)
  • davidkarlsen (2)
  • kimllee (2)
  • GoranHalvarsson (1)
  • furkansb (1)
  • marandalucas (1)
  • valipashask26 (1)
  • ctienshi (1)

Top Pull Request Authors

  • dependabot[bot] (338)
  • davidebianchi (81)
  • furkansb (5)
  • abelhoula (2)
  • JGiola (2)
  • imdmahajankanika (2)
  • dirk39 (2)
  • hiromi-mi (1)
  • Mohiit70 (1)
  • nsavelyeva (1)
  • msfidelis (1)
  • pscanf (1)
  • k11h-de (1)
  • silversoul93 (1)
  • lazy-slackoth (1)

Top Issue Labels

  • enhancement (25)
  • bug (15)
  • deploy (5)
  • good first issue (4)
  • documentation (4)
  • question (3)
  • supported-resources (2)
  • duplicate (1)
  • tests (1)
  • helm-chart (1)

Top Pull Request Labels

  • dependencies (346)
  • go (166)
  • docker (44)
  • enhancement (31)
  • github_actions (30)
  • helm-chart (8)
  • bug (7)
  • deploy (4)
  • documentation (3)
  • breaking-change (2)
  • 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.0 (published 3 months ago)
  • Last Synced: 2025-04-25T13:05:17.505Z (1 day ago)
  • Versions: 16
  • 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%

Dependencies

.github/workflows/codeql-analysis.yml actions
  • actions/checkout v3 composite
  • github/codeql-action/analyze v2 composite
  • github/codeql-action/autobuild v2 composite
  • github/codeql-action/init v2 composite
.github/workflows/release.yml actions
  • actions/checkout v3 composite
  • azure/setup-kubectl v3.2 composite
  • softprops/action-gh-release v1 composite
.github/workflows/security.yml actions
  • actions/checkout v3 composite
  • securego/gosec master composite
.github/workflows/test.yml actions
  • actions/cache v3 composite
  • actions/checkout v3 composite
  • actions/setup-go v3 composite
  • docker/build-push-action v3 composite
  • docker/login-action v2 composite
  • docker/metadata-action v4 composite
  • docker/setup-buildx-action v2 composite
  • docker/setup-qemu-action v2 composite
  • shogo82148/actions-goveralls v1 composite
Dockerfile docker
  • gcr.io/distroless/static nonroot build
  • golang 1.19.5 build
go.mod go
  • github.com/BurntSushi/toml v1.0.0
  • github.com/Masterminds/semver/v3 v3.1.1
  • github.com/Microsoft/go-winio v0.5.1
  • github.com/alessio/shellescape v1.4.1
  • github.com/beorn7/perks v1.0.1
  • github.com/cespare/xxhash/v2 v2.2.0
  • github.com/davecgh/go-spew v1.1.1
  • github.com/docker/distribution v2.8.1+incompatible
  • github.com/docker/docker v20.10.21+incompatible
  • github.com/docker/go-connections v0.4.0
  • github.com/docker/go-units v0.4.0
  • github.com/dustin/go-humanize v1.0.0
  • github.com/dustinkirkland/golang-petname v0.0.0-20191129215211-8e5a1ed0cff0
  • github.com/emicklei/go-restful/v3 v3.10.1
  • github.com/evanphx/json-patch v5.6.0+incompatible
  • github.com/evanphx/json-patch/v5 v5.6.0
  • github.com/fsnotify/fsnotify v1.6.0
  • github.com/go-logr/logr v1.2.3
  • github.com/go-logr/zapr v1.2.3
  • github.com/go-openapi/jsonpointer v0.19.6
  • github.com/go-openapi/jsonreference v0.20.2
  • github.com/go-openapi/swag v0.22.3
  • github.com/gogo/protobuf v1.3.2
  • github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da
  • github.com/golang/protobuf v1.5.2
  • github.com/google/gnostic v0.6.9
  • github.com/google/go-cmp v0.5.9
  • github.com/google/gofuzz v1.2.0
  • github.com/google/safetext v0.0.0-20220905092116-b49f7bc46da2
  • github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
  • github.com/google/uuid v1.3.0
  • github.com/imdario/mergo v0.3.13
  • github.com/inconshreveable/mousetrap v1.0.1
  • github.com/josharian/intern v1.0.0
  • github.com/json-iterator/go v1.1.12
  • github.com/kudobuilder/kuttl v0.15.0
  • github.com/mailru/easyjson v0.7.7
  • github.com/mattn/go-isatty v0.0.14
  • github.com/matttproud/golang_protobuf_extensions v1.0.4
  • github.com/moby/spdystream v0.2.0
  • github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
  • github.com/modern-go/reflect2 v1.0.2
  • github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822
  • github.com/onsi/ginkgo/v2 v2.6.1
  • github.com/onsi/gomega v1.24.2
  • github.com/opencontainers/go-digest v1.0.0
  • github.com/opencontainers/image-spec v1.0.2
  • github.com/pelletier/go-toml v1.9.4
  • github.com/pkg/errors v0.9.1
  • github.com/pmezard/go-difflib v1.0.0
  • github.com/prometheus/client_golang v1.14.0
  • github.com/prometheus/client_model v0.3.0
  • github.com/prometheus/common v0.39.0
  • github.com/prometheus/procfs v0.9.0
  • github.com/robfig/cron/v3 v3.0.1
  • github.com/sirupsen/logrus v1.8.1
  • github.com/spf13/cobra v1.6.1
  • github.com/spf13/pflag v1.0.5
  • github.com/stretchr/testify v1.8.1
  • github.com/thoas/go-funk v0.9.2
  • github.com/vladimirvivien/gexe v0.2.0
  • go.uber.org/atomic v1.10.0
  • go.uber.org/multierr v1.9.0
  • go.uber.org/zap v1.24.0
  • golang.org/x/net v0.5.0
  • golang.org/x/oauth2 v0.4.0
  • golang.org/x/sys v0.4.0
  • golang.org/x/term v0.4.0
  • golang.org/x/text v0.6.0
  • golang.org/x/time v0.3.0
  • gomodules.xyz/jsonpatch/v2 v2.2.0
  • google.golang.org/appengine v1.6.7
  • google.golang.org/protobuf v1.28.1
  • gopkg.in/inf.v0 v0.9.1
  • gopkg.in/yaml.v2 v2.4.0
  • gopkg.in/yaml.v3 v3.0.1
  • k8s.io/api v0.26.1
  • k8s.io/apiextensions-apiserver v0.26.1
  • k8s.io/apimachinery v0.26.1
  • k8s.io/client-go v0.26.1
  • k8s.io/component-base v0.26.1
  • k8s.io/klog/v2 v2.90.0
  • k8s.io/kube-openapi v0.0.0-20230123231816-1cb3ae25d79a
  • k8s.io/utils v0.0.0-20230115233650-391b47cb4029
  • sigs.k8s.io/controller-runtime v0.14.4
  • sigs.k8s.io/e2e-framework v0.1.0
  • sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd
  • sigs.k8s.io/kind v0.17.0
  • sigs.k8s.io/structured-merge-diff/v4 v4.2.3
  • sigs.k8s.io/yaml v1.3.0
go.sum go
  • 295 dependencies
.github/workflows/community-operators.yml actions
  • actions/checkout v3 composite
  • peter-evans/create-pull-request v5 composite

Score: 13.763387445688865