Refactor bare metal provider machine cleanup #1831
Merged
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.
What this PR does / why we need it:
In Tinkerbell a workflow brings together Hardware and a Template for execution.. The status field of the workflow can be used to determine the current state of the workflow and to identify any issues that may have occurred during the execution of it. Thus, it is important to keep track of those workflows even if they were executed to keep track of the provisioning processes. This PR makes the workflows of a hardware unique and it opens up the possibility to run a workflow multiple times and treat them as an idempotent process which can't be resumed in terms of failures. Those workflows must be deleted in two situations:
1- The workflow has a pending state however the machine deployment has been deleted. Thus we should get rid of those workflows to prevent triggering them in the future.
2- The workflow is stuck in a timeout state and it cannot be resumed thus they don't have any real value.
This PR cleans up those workflows based on the criteria above.
Which issue(s) this PR fixes:
Fixes #
What type of PR is this?
/kind feature
Special notes for your reviewer:
Does this PR introduce a user-facing change? Then add your Release Note here:
Documentation: