{"id":13821457,"url":"https://github.com/maheshrayas/kube-saver","last_synced_at":"2025-04-05T02:31:07.537Z","repository":{"id":38009893,"uuid":"495087253","full_name":"maheshrayas/kube-saver","owner":"maheshrayas","description":"Cost saving K8s controller to scale down and up of resources during non-business hours","archived":false,"fork":false,"pushed_at":"2025-01-09T04:55:10.000Z","size":326,"stargazers_count":9,"open_issues_count":5,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-20T21:18:03.824Z","etag":null,"topics":["cost-optimization","deployment","downscaling","kubernetes","kubernetes-controller","namespaces","statefulsets"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maheshrayas.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-22T14:41:32.000Z","updated_at":"2025-01-09T04:54:32.000Z","dependencies_parsed_at":"2023-01-21T22:02:43.198Z","dependency_job_id":"5d06154d-c265-47a9-8563-25f969306348","html_url":"https://github.com/maheshrayas/kube-saver","commit_stats":{"total_commits":99,"total_committers":2,"mean_commits":49.5,"dds":"0.010101010101010055","last_synced_commit":"946ca09f0f018c95e43aa1553186230a7702daff"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maheshrayas%2Fkube-saver","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maheshrayas%2Fkube-saver/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maheshrayas%2Fkube-saver/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maheshrayas%2Fkube-saver/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maheshrayas","download_url":"https://codeload.github.com/maheshrayas/kube-saver/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247279379,"owners_count":20912874,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cost-optimization","deployment","downscaling","kubernetes","kubernetes-controller","namespaces","statefulsets"],"created_at":"2024-08-04T08:01:22.277Z","updated_at":"2025-04-05T02:31:06.046Z","avatar_url":"https://github.com/maheshrayas.png","language":"Rust","funding_links":[],"categories":["kubernetes"],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  \u003cp align=\"center\"\u003eKube-Saver\u003c/p\u003e\n\u003c/h1\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://github.com/maheshrayas/kube-saver/actions/workflows/ci.yaml\" alt=\"Build\"\u003e\u003cimg src=\"https://github.com/maheshrayas/kube-saver/actions/workflows/ci.yaml/badge.svg\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/maheshrayas/kube-saver/actions/workflows/integration.yaml\" alt=\"integrations\"\u003e\u003cimg src=\"https://github.com/maheshrayas/kube-saver/actions/workflows/integration.yaml/badge.svg\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://codecov.io/gh/maheshrayas/kube-saver\" alt=\"Lint\"\u003e\u003cimg src=\"https://codecov.io/gh/maheshrayas/kube-saver/branch/main/graph/badge.svg?token=A44LLJERHG\" /\u003e\u003c/a\u003e\n  \u003ca href=\"https://kubesaver.com\" alt=\"docs\"\u003e\u003cimg src=\"https://img.shields.io/badge/Documentation-blue.svg\" /\u003e\u003c/a\u003e\n\u003c/div\u003e\n\n## Motivation\n\n* Scale down cluster nodes by scaling down Deployments, StatefulSet, CronJob, Hpa\nduring non-business hours and save $$, but if you need to scale back the resources eventhough its a scaledown, don't worry, You will have a Custom Resource which will scale up all resources and wont scale down until next scaledown period.\n\n## Installation\n\n* Install CRD\n\n    ```bash\n    kubectl apply -f https://raw.githubusercontent.com/maheshrayas/kube-saver/main/k8s/crds/crd.yaml\n    ```\n\n* Configure your rules in [rules.yaml](k8s/rules.yaml)\n\n* Install kube-saver operator\n\n    ```bash\n    kubectl apply -k k8s/\n    ```\n\n## Examples\n\n```bash\nrules:\n  # scale down deployment with name go-app-deployment-2 when current time/day not in uptime\n  - id: rules-downscale-deployments\n    uptime: Mon-Fri 09:00-17:00 Australia/Sydney\n    jmespath: \"metadata.name == 'go-app-deployment-2'\" \n    resource:\n      - Deployment # type of resource\n    replicas: 0 # either set the replicas:0 or any number during nonuptime \n  # scale down all deployment, statefulset, cronjob, hpa in namespace kuber when current time/day not in uptime, in this case hpa will be set to 1 as the desired replicas is set as 0\n  - id: rules-downscale-all-deployments-in-namespace\n    uptime: Mon-Fri 09:00-17:00 Australia/Sydney\n    jmespath: \"metadata.name == 'kuber'\" \n    resource:\n      - Namespace # type of resource\n    replicas: 0 # either set the replicas:0 or any number during nonuptime \n  # scale down all statefulset in namespace kuber when current time/day not in uptime\n  - id: rules-downscale-all-statefulset\n    uptime: Mon-Fri 09:00-17:00 Australia/Sydney\n    jmespath: \"metadata.name == 'statefulset_name'\" \n    resource:\n      - StatefulSet # type of resource\n    replicas: 0 # either set the replicas:0 or any number during nonuptime \n  # disable all cronjob with the labels current time/day not in uptime\n  - id: rules-disable-all-cronjob\n    uptime: Mon-Fri 09:00-17:00 Australia/Sydney\n    jmespath: \"metadata.labels.app == 'some_random_app'\" \n    resource:\n      - cronjob # type of resource\n  # set minReplicas of HPA to 1\n  - id: rules-set-hpa\n    uptime: Mon-Fri 09:00-17:00 Australia/Sydney\n    jmespath: \"metadata.labels.app == 'some_random_app'\" \n    resource:\n      - hpa # type of resource\n    replicas:1\n  # set replicas to 0 when the resources has label app:some_random_app but not service:some_random_service\n  - id: combination-of-resources\n    uptime: Mon-Fri 09:00-17:00 Australia/Sydney\n    jmespath: \"metadata.labels.app == 'some_random_app' \u0026\u0026 metadata.labels.service != 'some_random_service'\" \n    resource:\n      - Deployment # type of resource\n      - Statefulset\n    replicas:0\n\n```\n\n* Define uptime in [Olson timezone](https://en.wikipedia.org/wiki/List_of_tz_database_time_zones) format\n\nMore Examples: [here](./examples/example.md)\n\n## How can I upscale resouce during the downtime.?\n\nkube-saver will automatically upscale the resoures to orignial number of replicas when the current time falls between the `uptime` configured in rules.yaml. But if you want to manually scale up single deployment/statefulset or all the deployment \u0026 stateulset resources in Namespace, you have following options and it won't be scaled down until next day downtime.\nChoose any of the option below:\n\n* Configure [upscaled.yaml](./k8s/crds/upscaler.yaml) and \n\n  ```bash\n  kubectl apply -f ./k8s/crds/upscaler.yaml\n\n  ```\n  \n  Or\n\n* Redeploy your deployment.\n\n  Or\n\n* Edit the uptime in [rules.yaml](./k8s/rules.yaml) and redeploy the operator\n\n    ```bash\n    kubectl apply -k k8s/\n    ```\n\n## Tested\n\n| Kubernetes Provider |  Tested |\n|----------------------|--------|\n| Google Kubernetes Engine |   ✅   |\n| KIND(no autoscaler)                 |   ✅   |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaheshrayas%2Fkube-saver","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaheshrayas%2Fkube-saver","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaheshrayas%2Fkube-saver/lists"}