Open loicmathieu opened 6 months ago
@loicmathieu : Are you able to reproduce the same issue with kubectl
? I'm not 100% sure if KubernetesClient does anything different when uploading to a container or initContainer (need to check).
@rohanKanojia just tested it and uploading via kubectk
is immediate so the issue is only with the KubernetesClient
It might have to do with the newer enforced readiness waits we added for Pods (#4637 / #4695 / #5229 / #5245).
Have you noticed if this is a fixed time. I'm assuming that it's always ~10s~ 5s plus the time needed for the effective upload.
I've faced similar issues while trying to retrieve the logs too and not being able to do so until the pod became ready (which sometime never happens in case of crash).
Could you try to set .withReadyWaitTimeout(0)
before the call and see if it fixes it?
@manusa using .withReadyWaitTimeout(0)
fixes the issue, the upload is no immediate and I verify the file is present.
It's more 15s delay than 5s
It's more 15s delay than 5s
Probably there's a retry involved
using .withReadyWaitTimeout(0) fixes the issue
We need to properly document this in the Javadocs.
I've faced similar issues while trying to retrieve the logs too and not being able to do so until the pod became ready (which sometime never happens in case of crash).
At least in the latest versions the only condition the logic should wait on is if the Pod is stuck in Pending, otherwise it should let the operation continue.
Probably there's a retry involved
It's likely that 3 separate operations are being performed that trigger a wait. These waits are soft - that is we just log and keep going if they are exceeded.
We need to properly document this in the Javadocs.
You can also consider setting the default to 0 for release 7 and let the behavior be opt-in instead. We could also optimize the 0 wait case so that it doesn't start a watch.
We can consider switching the defaults for v7.
As a pending task, we need to add this information to the current Javadocs.
This issue has been automatically marked as stale because it has not had any activity since 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions!
Describe the bug
Uploading a file in an init-container is very slow, it took more than 15s (Minikube kind to launch a Kuberenes cluster).
I send a little reproducer project, in this project there is an init-container and a container. If I try to upload a file in the container, it is done almost instantly, if I try to do the same in the init-container it took more than 15s.``
Fabric8 Kubernetes Client version
SNAPSHOT
Steps to reproduce
The following example can be used:
This code runs in 18s locally using a Kubernetes cluster with Minikube.
If you remove the init container and change the code to upload the same file in the regular container, the code runs in 3s.
Expected behavior
Uploaded a file is as quick in an init-container than in a regular container.
Runtime
minikube
Kubernetes API Server version
1.25.3@latest
Environment
Linux
Fabric8 Kubernetes Client Logs
Additional context
No response