Comments (9)
cc @simon3z
@iterion
There is currently an api that should provide you with this functionality via the generic update_entityType methods. (update_pod, update_service, etc) It is not very tested at the moment since so far the gem was more focused on the "GET" part and less on create and updates.
So, you can fetch a replication controller, fill the new number of replicas in the right field, and call to client.update_replication_controller with that entity.
Please check if that api works for you and let me know.
Thank you.
from kubeclient.
Thanks, I'll try that out, it'll be useful in the interim.
I think scaling of replicas is something that users might do fairly often, so it'd be useful to have a method to do just that. But, I suppose it's up for discussion if that should be part of this gem or part of a gem that utilizes this one. A specific utility for scaling replicas is part of the Kubernetes CLI, so it might be good to mirror what is offered there.
from kubeclient.
Ok, I tried what you suggested but ran into some issues:
My method for scaling:
rc = client.get_replication_controller(rc_name, namespace)
rc.spec.replicas = scale
begin
resp = client.update_replication_controller(rc)
puts "Updated rc #{rc.metadata.name}"
resp
rescue KubeException => e
puts "Failed to update replication controller: #{e}"
end
I'm guessing it has to do with the difference between PUT and PATCH in the API, I'll do some more investigation.
from kubeclient.
Nvm, above issue was due to bug that has already been patched by #97. Scaling as @abonas outlined works correctly!
from kubeclient.
Thanks, I'll try that out, it'll be useful in the interim.
I think scaling of replicas is something that users might do fairly often, so it'd be useful to have a method to do just that. But, I suppose it's up for discussion if that should be part of this gem or part of a gem that utilizes this one. A specific utility for scaling replicas is part of the Kubernetes CLI, so it might be good to mirror what is offered there.
I'm currently not in favor of adding custom methods per entity, it's hard to maintain and the goal here is not to mimic the cli, but to allow the work with REST api which is by itself pretty standard and has no custom actions/methods for those things in the server.
Having said that, nothing is carved in stone, and it can be re-evaluated in the future.
from kubeclient.
Nvm, above issue was due to bug that has already been patched by #97. Scaling as @abonas outlined works correctly!
Glad to hear! If you want/can add tests for that, you're more than welcome, the gem currently lacks tests for update, and since they also serve as examples for other users, it has a broader impact.
from kubeclient.
@iterion I'm closing the issue, feel free to reopen if needed.
from kubeclient.
No problem, I totally understand your position and appreciate that this gem even exists! Users might want some utilities around the API, but, I dunno what those are yet and they could be very use case specific (which only strengthens your argument). I'll try to open source any solutions I come up with if they're generic enough.
I do wonder if we could make this gem pluggable in some way? It would be nice if other gems could hook into kubeclient and add any utility methods they like. It might be the best way to preserve the stability of this gem while adding great flexibility and usability for end users. I'd be happy to open an issue for discussion on this topic if you think it might fit within the scope of kubeclient.
from kubeclient.
I do wonder if we could make this gem pluggable in some way? It would be nice if other gems could hook into kubeclient and add any utility methods they like. It might be the best way to preserve the stability of this gem while adding great flexibility and usability for end users. I'd be happy to open an issue for discussion on this topic if you think it might fit within the scope of kubeclient.
Please have a look at openshift_client gem - it reuses most of kubeclient's code - maybe it can give you some ideas.
https://github.com/abonas/openshift_client
Also, Ruby is flexible and dynamic, so there should be no restrictions on dynamically adding additional methods defined on top of the existing ones, I'd just currently prefer to not keep such things as part of kubeclient itself.
from kubeclient.
Related Issues (20)
- v4.11.0 was released but isn't noted in the CHANGELOG
- Informer.watch is not guaranteed to receive all changes during restart
- CVE-2022-44571 (High) detected in rack-2.2.3.gem - autoclosed HOT 1
- CVE-2022-44570 (High) detected in rack-2.2.3.gem - autoclosed HOT 1
- CVE-2023-22796 (High) detected in activesupport-7.0.2.3.gem - autoclosed HOT 1
- CVE-2022-44572 (High) detected in rack-2.2.3.gem - autoclosed HOT 1
- Word breaking fails for kind `APIService` HOT 1
- CVE-2023-27530 (High) detected in rack-3.0.4.1.gem - autoclosed HOT 1
- CVE-2023-27539 (Medium) detected in rack-3.0.4.1.gem - autoclosed HOT 1
- 6 tests fail KubeclientConfigTest#test_explicit_secure Expected false to be truthy. HOT 3
- Dependency Dashboard
- Is it possible to fetch ingress information? HOT 2
- getting large resources on slow connection is slow
- v5 first request is ~10x slower than v4
- CVE-2023-38037 (Medium) detected in activesupport-7.0.4.3.gem - autoclosed HOT 1
- CVE-2023-51774 (High) detected in json-jwt-1.15.3.gem - autoclosed HOT 1
- CVE-2024-25126 (Medium) detected in rack-3.0.7.gem - autoclosed HOT 1
- CVE-2024-26146 (Medium) detected in rack-3.0.7.gem - autoclosed HOT 1
- CVE-2024-26141 (Medium) detected in rack-3.0.7.gem - autoclosed HOT 1
- documentation doesn't match current Ruby gem exposed version(s) 4.11.0 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from kubeclient.