SAP / SAP/crossplane-provider-cloudfoundry
`IsUpToDate` should exclude `unset` fields
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 6
- Forks
- 10
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 4
Description
Context
In a take-over scenario existing resource - (import) - resource represented by an CR - (take over), we need to make sure that the controller does not override settings of external resource by accident.
This requires that "IsUpToDate" only check fields that are explicitly set in the CR.
Technical Steps
Compare a forProvider field only when it is explicitly provided.
Example: space
- Before: This implementation does not distinguish unset and default thus could disable ssh for an exiting space.
func IsUpToDate(spec v1alpha1.SpaceParameters, observed *resource.Space, ssh bool) bool {
return spec.Name == observed.Name && spec.AllowSSH == ssh
}
- After:
func IsUpToDate(spec v1alpha1.SpaceParameters, observed *resource.Space, ssh bool) bool {
if spec.AllowSSH != nil && *spec.AllowSSH != ssh {
return false
}
return spec.Name == observed.Name
** Alternative **
- We always late initialize unset fields according to the current state before calling drift detection.
Required Steps
- Review all resources
IsUpToDateimplementations
Acceptance Criteria
- Create followup items in
IsUpToDatefields that need to be improved
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review every IsUpToDate implementation and the related forProvider fields, starting with the SpaceParameters example in the issue. Compare how unset fields are handled and record follow-up items for each field that needs improvement. Done means all resources have been reviewed and the required follow-up items are created.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100