Refactor migrations commands to prevent subtle concurrency bugs #162
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
stacked on top of: #161
6dd5f56 - fixes 159: modify draconctl compiling make target to always build binary
The previous version of the draconctl compiling make target would only
compile the binary if the binary didn't exist in the expected path. This
however is a problem if the code changes, because Makefile doesn't have
the ability to track that and recompile the binary. This commit changes
the target to be a phony one so that the binary is always recompiled if
necessary. Go internally is able to track changes and produce a new
binary only when needed, so this shouldn't cause anything to slow down
but it will definitely improve the development process.
1e01522 - fixes 153: refactor 'draconctl migrations apply' command
The previous version of the 'migrations apply' command suffered from a
couple of shortcomings:
fairly complex and monolithic
would not show in the output the logs of the pod and it would exit
immediately which could cause a user to misunderstand what was
happening.
leader election loop was not terminated cleanly
returned which could be the signal handler having its channel closed
or the leader election failure hook being invoked because the success
of the command triggered the code to release the lock.
All the above issues are fixed with this commit that does the following:
pkg/k8s
packagefunctionality and the job watching functionality to make it easier to
test.
object to make sure that only the first error that triggers the exit
of the main loop is recorded, so that we can get a better idea of
what happened.
with timeouts is used to ensure that the code gracefully shuts down.