This PR aims to update the way the workspace controller updates CR Status. It now uses the patch method instead of update. This primarily helps with the edge case when the CR gets updated during initial reconciliation. In this situation, the controller fails to perform an update operation, leading to a scenario where the Workspace is created in HCP Terraform, but the CR status does not have information about the Workspace ID. Consequently, it attempts to create it again once it recovers from the failure. The controller will continue to fail because the name is already taken.
This PR mainly fixes the Workspace controller, however, the same issue can happen with other controllers. We need to revise all controllers' logic along with predicate logic(described in this PR) to make it more flexible, straightforward, and clean.
Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
If you are interested in working on this issue or have submitted a pull request, please leave a comment.
Description
This PR aims to update the way the workspace controller updates CR Status. It now uses the
patch
method instead ofupdate
. This primarily helps with the edge case when the CR gets updated during initial reconciliation. In this situation, the controller fails to perform an update operation, leading to a scenario where the Workspace is created in HCP Terraform, but the CR status does not have information about the Workspace ID. Consequently, it attempts to create it again once it recovers from the failure. The controller will continue to fail because the name is already taken.This PR mainly fixes the Workspace controller, however, the same issue can happen with other controllers. We need to revise all controllers' logic along with predicate logic(described in this PR) to make it more flexible, straightforward, and clean.
Tests
Usage Example
N/A.
References
Community Note