cluster-api-provider-ibmcloud
cluster-api-provider-ibmcloud copied to clipboard
Refactor reconcilation of resources
What this PR does / why we need it:
This PR refactors the reconciliation of resources to follow a unit format as below
- Fetch ID from IBMPowerVSCluster status object. If ID exists, check the status of the resource in cloud and return
- If ID is not present in the status, try to fetch it from the IBMPowerVSCluster spec and check if the resource exists in cloud. Here we can check either via name or ID passed in the spec. If resource with given ID doesn't exist, return err, or else check the status of the resource in cloud and set IBMPowerVSCluster.status accordingly
- If resource with given name doesn't exist, proceed with creating the resource. If it exists, check the status of the resource in cloud. Set IBMPowerVSCluster.status accordingly in both cases
The changes in this PR has been tested with the following scenarios
- Resource names are set in spec and they do not exist
- Resource names are set in spec and they exist
- Resource IDs are set in spec and they do not exist
- Resource IDs are set in spec and they exist
- Spec with only required fields
Note:
- Adjustments were made to support if ID or Name are set in spec
- The changes in this PR were also tested with TG changes from existing PR https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud/pull/1901
- Caveats noticed where in terms of handling existing DHCP server ID set in spec and it has been documented in https://github.com/kubernetes-sigs/cluster-api-provider-ibmcloud/issues/1933
Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #1907
Special notes for your reviewer:
/area provider/ibmcloud
- Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.
Release note:
Refactor reconcilation of resources
Deploy Preview for kubernetes-sigs-cluster-api-ibmcloud ready!
| Name | Link |
|---|---|
| Latest commit | ec8b9dbd0c37488521e4b2052148f0e5dd982b42 |
| Latest deploy log | https://app.netlify.com/sites/kubernetes-sigs-cluster-api-ibmcloud/deploys/6704fdbfca8fba0008a735d2 |
| Deploy Preview | https://deploy-preview-1937--kubernetes-sigs-cluster-api-ibmcloud.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.
/cc @Karthik-K-N
/cc @dharaneeshvrd
/hold
Testing the changes after rebase.
/unhold
PR is ready for review, PTAL
@Karthik-K-N, added a couple of minor changes. PTAL!
@mkumatag, PTAL! The following/open UT PRs will require changes as per refactoring being added in this PR.
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: Amulyam24, mkumatag
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~OWNERS~~ [mkumatag]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment