fix: renew the session token when the token expires
This PR fix https://github.com/peak/s5cmd/issues/678
In a Kubernetes context, when running a very long process, we can easily fall into the ExpiredToken error. In order to not introduce any performance degradation, I propose to keep to global variable caching the session token but clear it when catching this specific error. The session will be renewed by reading again the projected volume /var/run/secrets/eks.amazonaws.com/serviceaccount/token.
this is also an issue on our side and could speed up the review & release process? thank you.
+1, this would be great to have!
@MqllR does the error only happen if s5cmd runs for more than hour? or it happens when trying to run short s5cmd on pod that is older than an hour?