amelbakry / kube-schedule-scaler Goto Github PK
View Code? Open in Web Editor NEWKubernetes Controller which provides schedule scaling to Kubernetes deployments and other custom resources in the cluster
License: GNU General Public License v3.0
Kubernetes Controller which provides schedule scaling to Kubernetes deployments and other custom resources in the cluster
License: GNU General Public License v3.0
I built and ran this on my 1.13.11 Cluster running in Azure Kubernetes Service. I get an error in the logs that it couldn't query the namespaces API. I installed the serviceaccount in the default namespace. Is there a specific role and rolebinding this code needs to query correctly?
Logs:
kubectl logs -f kube-schedule-scaler-858d5697c-rx82q
Traceback (most recent call last):
File "/root/schedule_scaling/schedule_scaling.py", line 273, in <module>
deploy_job_creator()
File "/root/schedule_scaling/schedule_scaling.py", line 74, in deploy_job_creator
deployments__to_scale = deployments_to_scale()
File "/root/schedule_scaling/schedule_scaling.py", line 52, in deployments_to_scale
for namespace in list(pykube.Namespace.objects(api)):
File "/usr/local/lib/python3.5/dist-packages/pykube/query.py", line 133, in __iter__
return iter(self.query_cache["objects"])
File "/usr/local/lib/python3.5/dist-packages/pykube/query.py", line 123, in query_cache
cache["response"] = self.execute().json()
File "/usr/local/lib/python3.5/dist-packages/pykube/query.py", line 108, in execute
r.raise_for_status()
File "/usr/local/lib/python3.5/dist-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://10.0.0.1:443/api/v1/namespaces
Running the Jobs of the last 5 minutes
I'm trying to start the container without errors, not defining any stackset (my case, I don't need them) and I got this error:
Deployments collected for scaling:
Deployment: php-apache, Namespace: default, Replicas: None, MinReplicas: 10, MaxReplicas: None, Schedule: 30 4 * * 1,2,3,4,5
Deployment: php-apache, Namespace: default, Replicas: None, MinReplicas: 5, MaxReplicas: None, Schedule: 00 8 * * 1,2,3,4,5
Deployment: php-apache, Namespace: default, Replicas: None, MinReplicas: 7, MaxReplicas: None, Schedule: 00 21 * * 1,2,3,4,5
Deployment: php-apache, Namespace: default, Replicas: None, MinReplicas: 12, MaxReplicas: None, Schedule: 30 5 * * 6,7
Deployment: php-apache, Namespace: default, Replicas: None, MinReplicas: 2, MaxReplicas: None, Schedule: 00 9 * * 6,7
Deployment: php-apache, Namespace: default, Replicas: None, MinReplicas: 20, MaxReplicas: None, Schedule: 00 21 * * 6,7
Traceback (most recent call last):
File "/root/schedule_scaling/schedule_scaling.py", line 274, in
stack_job_creator()
File "/root/schedule_scaling/schedule_scaling.py", line 155, in stack_job_creator
stacks__to_scale = stacks_to_scale()
File "/root/schedule_scaling/schedule_scaling.py", line 127, in stacks_to_scale
for stackset in StackSet.objects(api).filter(namespace=namespace):
File "/usr/local/lib/python3.5/dist-packages/pykube/query.py", line 133, in iter
return iter(self.query_cache["objects"])
File "/usr/local/lib/python3.5/dist-packages/pykube/query.py", line 123, in query_cache
cache["response"] = self.execute().json()
File "/usr/local/lib/python3.5/dist-packages/pykube/query.py", line 108, in execute
r.raise_for_status()
File "/usr/local/lib/python3.5/dist-packages/requests/models.py", line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://10.0.0.1:443/apis/zalando.org/v1/namespaces/custom-metrics/stacksets
As far as I can understand clear_cron()
will commit the deletion before the rest of the code can determine the new jobs and commit them. This might lead to the following issues:
clear_cron()
and the rest of the code in which the crontab is empty: what happens to the jobs that are supposed to run exactly in the moment the crontab is temporarily empty?Wouldn't it be better to share a global instance of the crontab object and commit the changes only at the end? Possibly there must be a way to design this so that a single syntax error won't compromise the integrity of the whole crontab.
I wish to schedule downtime for stateful sets
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.