kubermatic / machine-controller

Apache License 2.0
309 stars 131 forks source link

Refactor bare metal provider machine cleanup #1831

Closed moadqassem closed 4 months ago

moadqassem commented 4 months ago

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:

Tinerkebll: cleanup workflows that are either in a pending state or timeout state.

Documentation:

None
kubermatic-bot commented 4 months ago

LGTM label has been added.

Git tree hash: 11cbe759836e19d2ee58a281e9924cda69a1bbce

kubermatic-bot commented 4 months ago

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: xrstf

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files: - ~~[OWNERS](https://github.com/kubermatic/machine-controller/blob/main/OWNERS)~~ [xrstf] Approvers can indicate their approval by writing `/approve` in a comment Approvers can cancel approval by writing `/approve cancel` in a comment