kiwigrid / k8s-sidecar

This is a docker container intended to run inside a kubernetes cluster to collect config maps with a specified label and store the included files in a local folder.
MIT License
563 stars 181 forks source link

#minor Remove unnecessary sleep before each watch cycle #326

Closed ahtohio closed 6 months ago

ahtohio commented 6 months ago

During my work with this project I've discovered that some DELETE k8s events are skipped for unknown reason. After some digging, I've managed to discover that if a DELETE event is sent while sidecar in its 5 seconds sleep between watch cycles, this event is simply gets skipped. There's no one to receive it. And after ERROR_THROTTLE_SLEEP seconds watch cycle starts, receives all modified and added k8s resources, but it doesn't get any events about deleted stuff. And sidecar lacks a reconciliation loop to handle deleted resources based on received list of resources.

By shifting sleep throttle to only exceptions case we should manage to catch most of the DELETE events.

ChristianGeie commented 6 months ago

lgtm. @jekkel we recently talked about the fact that files had not been deleted from the file system, even though the source configmap had already been deleted. Surely this would address such a problem?