Skip to content
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

Merged
merged 3 commits into from
Jul 8, 2019
Merged

Allow secrets #32

merged 3 commits into from
Jul 8, 2019

Conversation

fr-ser
Copy link
Contributor

@fr-ser fr-ser commented May 16, 2019

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)

fr-ser added 2 commits May 16, 2019 21:04
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
Thread(target=_watch_resource_loop,
args=(label, targetFolder, url, method, payload,
current, folderAnnotation, resources[1], True)
).start()
Copy link
Contributor

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?

Copy link
Contributor Author

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
@fr-ser
Copy link
Contributor Author

fr-ser commented May 27, 2019

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).
The main process checks each 5 seconds if the loops are still running

@fr-ser
Copy link
Contributor Author

fr-ser commented Jun 21, 2019

Anything outstanding I can do to help merge this PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants