Loading
Fix secrets pruning
Secrets were not properly stored in managedResources, causing the operator to prune them once sylva-units HelmRelease was reconciled
The culprit is the additional (and useless) get on created secret that was resetting the TypeMeta of the object.
This issue is documented here: https://github.com/kubernetes-sigs/controller-runtime/issues/1517
Additionally, using a Get right after a Patch may give inaccurate results, as Patch uses a direct Client, but Get relies on the informer cache that may not be up to date (see discussions to fix that issue here).
Avoiding this Get is safer and more efficient, there also was an logic issue in error management:
if err != nil && !apierrors.IsNotFound(err) {
return fmt.Errorf("failed to get %s %s in cluster: %w", objKind.Kind, obj.GetName(), err)Closes: #109 (closed)
Edited by Francois Eleouet