Closed octo47 closed 1 year ago
@octo47 Hey 👋 Yes, this is really useful. However, I think this parameter should be part of the KubernetesClientConfig
. The thing is, I haven't found a way yet, to make it easily configurable w/o providing the whole config object. And like you said, their is not much we can configure in the HTTPClient.Configuation
. The only other candidate would be redirectConfiguration
. I'll try a few things and report back 😉
thanks @iabudiab , definitely worth to think. I was noticing that KubernetesClientConfig is coming from .kube/config so thought that client timeout is something coming from the application using KubeClient rather k8s itself. That's why thought it could be external. But thanks for looking into, looking forward to get this fixed! Thanks.
@octo47 hey there, sorry for the delay 🙈 😅 I finally found some time to test some ideas and have settled on one variant. How about something like this:
let config = KubernetesClientConfig.initialize(
timeout: .init(connect: .seconds(1), read: .seconds(60)),
redirectConfiguration: .follow(max: 5, allowCycles: false)
)
let client = KubernetesClient(config: config!, logger: logger)
KubernetesClientConfig
now exposes a static method to initialise a config (by loading a local kubeconfig or a service account) while also accepting any override configurations. In this case the timeout
and redirectConfiguration
.
@octo47 This landed in https://github.com/swiftkube/client/releases/tag/0.12.0
I've made some changes as described in https://github.com/swiftkube/client/pull/18#issuecomment-1284616210
In some large Kubernetes deployments various techniques may be applied to protect API:
Suggestion:
Alternatives considered: