-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow secrets #32
Allow secrets #32
Conversation
Make list functions dynamic by allowing the resource type to be passed in as an argument. In case of the endless watching loop the second loop (if both resources are watched) is run in a separate thread
sidecar/resources.py
Outdated
Thread(target=_watch_resource_loop, | ||
args=(label, targetFolder, url, method, payload, | ||
current, folderAnnotation, resources[1], True) | ||
).start() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will an exception in the thread be raised to the main thread too? If not we would not have a change of restarting if that thread fails or?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. That is why I put the error check inside the loop.
But if we get a 500 error it is raised and dies... I will think about it this evening a bit and put in a change (I am thinking about checking in the main thread if the loop thread is still running and raising there otherwise...)
Use processes (easier to terminate than threads) for watching over resource changes In the main process it is regularly checked, that the "subprocesses" are still running
Running one loop in the main thread and another in a separate one complicated things... Now I handle it consistently and run each loop in its own process (easier to terminate). |
Anything outstanding I can do to help merge this PR? |
PR relating to issue 31.
The first commit was simple refactoring according to flake8.
The second commit touched a lot of files as the single file approach would have been to messy in my opinion. I separated the logic into three files.
There was also a little problem with running two endless iterators in python, which I solved using Threads (only when we really want to watch secrets and configmaps both)