-
Hello! First of all, I've had a great time with this library so far. Part of that is Rust being a great language to play with, but kube-rs has also contributed a lot to my enjoyment here, so thanks a lot! I've been playing with making an operator that looks at Pods with a special label that we add to every Pod spawned by a Job, and then shuts off every container that isn't the main container once the main container has terminated; sidecars will usually not know what's going on with sibling containers and shut themselves down after all. Ideally, this cluster-wide operator would look at every Pod matching that label regardless of namespace, so I'm doing the watching with The Pod is namespaced, but my Is this particularly expensive, I wonder? And maybe if it is, have I overlooked a way to continue using my one Now, I've only skimmed a few seemingly relevant issues and discussion threads, so I apologise if a similar thing has been brought up already! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
hey there! glad you're getting things to work well. Cool idea for a project (and great name). Cloning the The reasoning behind why cloning is cheap, lies in what the (There are some prototype thoughts floating around on tuning the |
Beta Was this translation helpful? Give feedback.
hey there! glad you're getting things to work well. Cool idea for a project (and great name).
Cloning the
Client
or theApi
should not be an operation that has noteworthy cost. It's designed so that it can be done pretty frequently in controllers because (as you have seen) you need oneApi
instance per scope (and also type) - so you are doing things idiomatically in my book.The reasoning behind why cloning is cheap, lies in what the
Client
contains and how they are wrapped. The main interface to the http client goes through thetower::Service
(orBoxService
in our case), and it's wrapped in a tower::Buffer designed to cheaply clone services.(There are some prototype thoughts floating ar…