Handling provider-added fields to maps and slices #120
Labels
bug
Something isn't working
enhancement
New feature or request
stale
wontfix
This will not be worked on
What problem are you facing?
Currently, if there is a configurable slice of fields on a managed resource, we check to make sure that the external resource and the managed resource have the same elements of that slice. One example of this is with
labels
. We want to add all labels that a user provides, and remove any that get set outside the context of Crossplane. However, this becomes an issue if the provider itself adds some elements to the slice. For example, whengVisor
is enabled on a GKENodePool
, GCP adds the following tolabels
andtaints
:When we compare the external resource and the managed resource, we see that there is a diff and attempt to remove the additional fields. This can cause a continuous update loop as we remove the fields and GCP keeps adding them back.
How could Crossplane help solve your problem?
The solution here will be more of a design decision than a bug fix. One could argue that the controller is acting correctly here and a user should provide these labels and taints in their spec if they want Crossplane to not try and remove them. However, that results in a rather poor user experience.
The most straight-forward solution is that we late initialize any slice values that we deem "mergeable" with values the cloud provider adds. This would be in accordance with the Kubernetes late initialization patterns. However, this would necessitate some sort of change in our managed reconciler because we currently late initialize before updating an external resource. This leads to the situation where a user:
Another option is to manually implement logic that strategically ignores some field updates (such as the
gVisor
ones above), but that does not scale well across all API types.The text was updated successfully, but these errors were encountered: