operator-utils: EnforcingReconciler doesn't update the existing resources according to the new lockedresources
I encountered this issue when I attempted reconciling by modifying the CR instance, which in turn changed the LockedResource.
For an understanding of this particular situation, suppose one of the lockedresource is StatefulSet and the operator increased the number of replicas in its spec.
Now, it’s expected that on reconcilation, the LockedResourceManager will know there’s some difference in the locked resource and do the needed change. However, that doesn’t actually happen, rather it considers the new set of resources to be same here (sameResources is true):
https://github.com/redhat-cop/operator-utils/blob/15706af3de5795048ca301e88155cd2a52ef3e53/pkg/util/lockedresourcecontroller/enforcing-reconciler.go#L81
It’s probably since it uses the GroupVersionKind, Namespace and Name as part of the key in the lockedresourceset:
https://github.com/redhat-cop/operator-utils/blob/15706af3de5795048ca301e88155cd2a52ef3e53/pkg/util/lockedresourcecontroller/lockedresource/lockedresourceset/lockedresourceset.go#L42
https://github.com/redhat-cop/operator-utils/blob/15706af3de5795048ca301e88155cd2a52ef3e53/pkg/util/lockedresourcecontroller/lockedresource/locked-resource.go#L36
Using hash of the Unstructured object as the key of the set would fix it, but I’m not sure if it is supposed to be a part of the current operator-utils design?
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 16
@shivanshs9 you were right, we had a regression. it’s been fixed in v0.3.2.