kube-green

A K8s operator to reduce CO2 footprint of your clusters

https://github.com/kube-green/kube-green

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (15.4%) to scientific vocabulary

Keywords

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

Keywords from Contributors

projection interactive serializer cycles packaging charts network-simulation archival shellcodes hacking
Last synced: 6 months ago · JSON representation

Repository

A K8s operator to reduce CO2 footprint of your clusters

Basic Info
  • Host: GitHub
  • Owner: kube-green
  • License: mit
  • Language: Go
  • Default Branch: main
  • Homepage: https://kube-green.dev
  • Size: 1.63 MB
Statistics
  • Stars: 1,217
  • Watchers: 12
  • Forks: 84
  • Open Issues: 38
  • Releases: 14
Topics
climate-change cloud-native downscale green-software hacktoberfest k8s kubernetes resources
Created almost 5 years ago · Last pushed 6 months ago
Metadata Files
Readme Changelog Contributing License

README.md

Go Report Card Coverage Security Coverage Status Documentations Adopters CNCF Landscape

Dark kube-green logo

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:

golang go get

Running the tests

There are different types of tests in this repository.

It is possible to run all the unit tests with

sh make test

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

sh make e2e-test-kustomize

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

sh make e2e-test

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

sh 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:

sh 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:

yaml 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:

yaml 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

  • Name: kube-green
  • Login: kube-green
  • Kind: organization

GitHub Events

Total
  • Create event: 80
  • Issues event: 31
  • Release event: 4
  • Watch event: 176
  • Delete event: 72
  • Issue comment event: 195
  • Push event: 87
  • Pull request review event: 19
  • Pull request review comment event: 7
  • Pull request event: 130
  • Fork event: 17
Last Year
  • Create event: 80
  • Issues event: 31
  • Release event: 4
  • Watch event: 176
  • Delete event: 72
  • Issue comment event: 195
  • Push event: 87
  • Pull request review event: 19
  • Pull request review comment event: 7
  • Pull request event: 130
  • Fork event: 17

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 546
  • Total Committers: 21
  • Avg Commits per committer: 26.0
  • Development Distribution Score (DDS): 0.238
Past Year
  • Commits: 78
  • Committers: 10
  • Avg Commits per committer: 7.8
  • Development Distribution Score (DDS): 0.295
Top Committers
Name Email Commits
Davide Bianchi b****2@g****m 416
dependabot[bot] 4****] 96
Andrea Quintino a****0@g****m 11
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
Matheus Fidelis m****s 1
Mr. Burton 6****n 1
Natallia Savelyeva n****a@t****o 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 (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 93
  • Total pull requests: 595
  • Average time to close issues: 4 months
  • Average time to close pull requests: 18 days
  • Total issue authors: 59
  • Total pull request authors: 23
  • Average comments per issue: 2.63
  • Average comments per pull request: 1.33
  • Merged pull requests: 237
  • Bot issues: 3
  • Bot pull requests: 448
Past Year
  • Issues: 20
  • Pull requests: 136
  • Average time to close issues: 5 days
  • Average time to close pull requests: 16 days
  • Issue authors: 16
  • Pull request authors: 8
  • Average comments per issue: 0.8
  • Average comments per pull request: 1.13
  • Merged pull requests: 40
  • Bot issues: 2
  • Bot pull requests: 105
Top Authors
Issue Authors
  • davidebianchi (20)
  • blezoray (3)
  • AmitBaranes (3)
  • giulioroggero (3)
  • dependabot[bot] (3)
  • slim-azaiz (2)
  • imdmahajankanika (2)
  • msfidelis (2)
  • kernelold (2)
  • amitkbaid (2)
  • davidkarlsen (2)
  • kimllee (2)
  • GoranHalvarsson (1)
  • marandalucas (1)
  • furkansb (1)
Pull Request Authors
  • dependabot[bot] (447)
  • davidebianchi (102)
  • furkansb (8)
  • abelhoula (4)
  • christianhuth (3)
  • JGiola (3)
  • imdmahajankanika (3)
  • dirk39 (3)
  • hiromi-mi (2)
  • msfidelis (2)
  • dejanu (2)
  • k11h-de (2)
  • BenjaminBurton (2)
  • lazy-slackoth (2)
  • zyue110026 (1)
Top Labels
Issue Labels
enhancement (18) bug (10) question (4) documentation (4) good first issue (3) deploy (3) dependencies (3) go (2) duplicate (1) tests (1) docker (1) helm-chart (1)
Pull Request Labels
dependencies (460) go (242) docker (62) enhancement (47) github_actions (45) helm-chart (13) bug (8) deploy (8) documentation (5) breaking-change (4) security-fix (1)

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total docker downloads: 46
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 17
proxy.golang.org: github.com/kube-green/kube-green
  • Versions: 17
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Docker Downloads: 46
Rankings
Stargazers count: 2.0%
Forks count: 3.3%
Average: 5.4%
Dependent packages count: 7.0%
Dependent repos count: 9.3%
Last synced: 6 months ago

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