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 18 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: 2 days ago

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

Commits in past year: 43
Committers in past year: 4
Avg Commits per committer in past year: 10.75
Development Distribution Score (DDS) in past year: 0.233

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: 107
Total pull requests: 728
Average time to close issues: 4 months
Average time to close pull requests: 17 days
Total issue authors: 68
Total pull request authors: 33
Average comments per issue: 2.95
Average comments per pull request: 1.27
Merged pull request: 321
Bot issues: 4
Bot pull requests: 548

Past year issues: 10
Past year pull requests: 73
Past year average time to close issues: about 2 months
Past year average time to close pull requests: 25 days
Past year issue authors: 9
Past year pull request authors: 10
Past year average comments per issue: 1.6
Past year average comments per pull request: 0.81
Past year merged pull request: 37
Past year bot issues: 0
Past year bot pull requests: 57

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)
  • msfidelis (3)
  • davidkarlsen (3)
  • giulioroggero (3)
  • AmitBaranes (3)
  • imdmahajankanika (2)
  • amitkbaid (2)
  • kernelold (2)
  • SA-KIRA (2)
  • kimllee (2)
  • adityaatpeak (1)
  • Tchoupinax (1)
  • motizzz (1)

Top Pull Request Authors

  • dependabot[bot] (548)
  • davidebianchi (117)
  • furkansb (8)
  • zdtsw (5)
  • msfidelis (4)
  • abelhoula (3)
  • imdmahajankanika (3)
  • Justinuiterloo (3)
  • dirk39 (3)
  • JGiola (3)
  • christianhuth (3)
  • dejanu (2)
  • k11h-de (2)
  • gustavobini (2)
  • hiromi-mi (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 (566)
  • go (267)
  • github_actions (118)
  • docker (68)
  • enhancement (53)
  • helm-chart (12)
  • bug (9)
  • deploy (9)
  • breaking-change (7)
  • documentation (6)
  • no-recent-activity (1)
  • 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 over 1 year ago)
  • Last Synced: 2026-11-04T06:11:55.393Z (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%

Dependencies

go.sum go
  • 202 dependencies
.github/workflows/codeql-analysis.yml actions
  • ./.github/actions/setup-go-with-cache * composite
  • actions/checkout de0fac2e4500dabe0009e67214ff5f5447ce83dd composite
  • github/codeql-action/analyze v4 composite
  • github/codeql-action/init v4 composite
.github/workflows/release.yml actions
  • actions/checkout de0fac2e4500dabe0009e67214ff5f5447ce83dd composite
  • azure/setup-kubectl 776406bce94f63e41d621b960d78ee25c8b76ede composite
  • softprops/action-gh-release a06a81a03ee405af7f2048a818ed3f03bbf83c7b composite
.github/workflows/security.yml actions
  • actions/checkout de0fac2e4500dabe0009e67214ff5f5447ce83dd composite
  • securego/gosec master composite
.github/workflows/test.yml actions
  • ./.github/actions/setup-go-with-cache * composite
  • actions/checkout de0fac2e4500dabe0009e67214ff5f5447ce83dd composite
  • actions/upload-artifact 043fb46d1a93c77aae656e7c1c64a875d1fc6a0a composite
  • azure/setup-helm dda3372f752e03dde6b3237bc9431cdc2f7a02a2 composite
  • docker/build-push-action 10e90e3645eae34f1e60eeb005ba3a3d33f178e8 composite
  • docker/login-action b45d80f862d83dbcd57f89517bcf500b2ab88fb2 composite
  • docker/metadata-action c299e40c65443455700f0fdfc63efafe5b349051 composite
  • docker/setup-buildx-action 8d2750c68a42422c14e847fe6c8ac0403b4cbd6f composite
  • docker/setup-qemu-action ce360397dd3f832beb865e1373c09c0e9f86d70a composite
  • shogo82148/actions-goveralls 25f5320d970fb565100cf1993ada29be1bb196a1 composite
Dockerfile docker
  • docker.io/library/alpine 3.23.4@sha256 build
  • gcr.io/distroless/static nonroot build
.github/workflows/community-operators.yml actions
  • actions/checkout de0fac2e4500dabe0009e67214ff5f5447ce83dd composite
  • peter-evans/create-pull-request c0f553fe549906ede9cf27b5156039d195d2ece0 composite
.github/workflows/helm.yaml actions
  • actions/checkout de0fac2e4500dabe0009e67214ff5f5447ce83dd composite
  • actions/setup-go 4a3601121dd01d1626a1e23e37211e3254c1c06c composite
  • azure/setup-helm dda3372f752e03dde6b3237bc9431cdc2f7a02a2 composite
  • helm/chart-testing-action 6ec842c01de15ebb84c8627d2744a0c2f2755c9f composite
  • kube-green/chart-releaser-action 0b33fc8b8c73d4d8eb2c94570c871bf5262a5955 composite
.github/actions/setup-go-with-cache/action.yml actions
  • actions/cache 5a3ec84eff668545956fd18022155c47e93e2684 composite
  • actions/setup-go d35c59abb061a4a6fb18e82ac0862c26744d6ab5 composite
go.mod go
  • al.essio.dev/pkg/shellescape v1.5.1
  • cel.dev/expr v0.25.1
  • github.com/BurntSushi/toml v1.4.0
  • github.com/Masterminds/semver/v3 v3.4.0
  • github.com/Microsoft/go-winio v0.5.1
  • github.com/antlr4-go/antlr/v4 v4.13.0
  • github.com/beorn7/perks v1.0.1
  • github.com/blang/semver/v4 v4.0.0
  • github.com/cenkalti/backoff/v4 v4.3.0
  • github.com/cespare/xxhash/v2 v2.3.0
  • github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
  • github.com/distribution/reference v0.6.0
  • github.com/docker/docker v28.0.0+incompatible
  • github.com/docker/go-connections v0.5.0
  • github.com/docker/go-units v0.5.0
  • github.com/dustin/go-humanize v1.0.1
  • github.com/dustinkirkland/golang-petname v0.0.0-20191129215211-8e5a1ed0cff0
  • github.com/emicklei/go-restful/v3 v3.12.2
  • github.com/evanphx/json-patch/v5 v5.9.11
  • github.com/felixge/httpsnoop v1.0.4
  • github.com/fsnotify/fsnotify v1.9.0
  • github.com/fxamacker/cbor/v2 v2.9.0
  • github.com/go-logr/logr v1.4.3
  • github.com/go-logr/stdr v1.2.2
  • github.com/go-logr/zapr v1.3.0
  • github.com/go-openapi/jsonpointer v0.21.0
  • github.com/go-openapi/jsonreference v0.20.2
  • github.com/go-openapi/swag v0.23.0
  • github.com/gogo/protobuf v1.3.2
  • github.com/google/btree v1.1.3
  • github.com/google/cel-go v0.26.0
  • github.com/google/gnostic-models v0.7.0
  • github.com/google/go-cmp v0.7.0
  • github.com/google/safetext v0.0.0-20220905092116-b49f7bc46da2
  • github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
  • github.com/google/uuid v1.6.0
  • github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674
  • github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3
  • github.com/inconshreveable/mousetrap v1.1.0
  • github.com/josharian/intern v1.0.0
  • github.com/json-iterator/go v1.1.12
  • github.com/kube-green/kuttl v0.0.0-20251008222632-45c034bd0c10
  • github.com/kylelemons/godebug v1.1.0
  • github.com/mailru/easyjson v0.7.7
  • github.com/mattn/go-isatty v0.0.20
  • github.com/moby/docker-image-spec v1.3.1
  • github.com/moby/spdystream v0.5.1
  • github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd
  • github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee
  • github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822
  • github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f
  • github.com/onsi/ginkgo/v2 v2.25.1
  • github.com/onsi/gomega v1.38.1
  • github.com/opencontainers/go-digest v1.0.0
  • github.com/opencontainers/image-spec v1.0.2
  • github.com/pelletier/go-toml v1.9.5
  • github.com/pkg/errors v0.9.1
  • github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2
  • github.com/prometheus/client_golang v1.23.2
  • github.com/prometheus/client_model v0.6.2
  • github.com/prometheus/common v0.66.1
  • github.com/prometheus/procfs v0.16.1
  • github.com/robfig/cron/v3 v3.0.1
  • github.com/spf13/cobra v1.9.1
  • github.com/spf13/pflag v1.0.7
  • github.com/stoewer/go-strcase v1.3.0
  • github.com/stretchr/testify v1.11.1
  • github.com/thoas/go-funk v0.9.3
  • github.com/vladimirvivien/gexe v0.5.0
  • github.com/x448/float16 v0.8.4
  • go.opentelemetry.io/auto/sdk v1.2.1
  • go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.58.0
  • go.opentelemetry.io/otel v1.41.0
  • go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0
  • go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0
  • go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.31.0
  • go.opentelemetry.io/otel/metric v1.41.0
  • go.opentelemetry.io/otel/sdk v1.39.0
  • go.opentelemetry.io/otel/trace v1.41.0
  • go.opentelemetry.io/proto/otlp v1.5.0
  • go.uber.org/multierr v1.11.0
  • go.uber.org/zap v1.27.0
  • go.yaml.in/yaml/v2 v2.4.2
  • go.yaml.in/yaml/v3 v3.0.4
  • golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56
  • golang.org/x/net v0.48.0
  • golang.org/x/oauth2 v0.34.0
  • golang.org/x/sync v0.19.0
  • golang.org/x/sys v0.39.0
  • golang.org/x/term v0.38.0
  • golang.org/x/text v0.32.0
  • golang.org/x/time v0.9.0
  • gomodules.xyz/jsonpatch/v2 v2.4.0
  • google.golang.org/genproto/googleapis/api v0.0.0-20251202230838-ff82c1b0f217
  • google.golang.org/genproto/googleapis/rpc v0.0.0-20251202230838-ff82c1b0f217
  • google.golang.org/grpc v1.79.3
  • google.golang.org/protobuf v1.36.10
  • gopkg.in/evanphx/json-patch.v4 v4.12.0
  • 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.34.3
  • k8s.io/apiextensions-apiserver v0.34.1
  • k8s.io/apimachinery v0.34.3
  • k8s.io/apiserver v0.34.1
  • k8s.io/client-go v0.34.3
  • k8s.io/component-base v0.34.1
  • k8s.io/klog/v2 v2.130.1
  • k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b
  • k8s.io/utils v0.0.0-20250604170112-4c0f3b243397
  • sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2
  • sigs.k8s.io/controller-runtime v0.22.4
  • sigs.k8s.io/e2e-framework v0.6.0
  • sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8
  • sigs.k8s.io/kind v0.27.0
  • sigs.k8s.io/randfill v1.0.0
  • sigs.k8s.io/structured-merge-diff/v6 v6.3.0
  • sigs.k8s.io/yaml v1.6.0

Score: 14.302680990831876