refactor: eliminate hidden mutations in HelmRepository client opts
Summary
Refactors HelmRepository client options generation to use explicit configuration pattern. The previous implementation had hidden mutable side effects where ClientOpts was modified through configuration functions, making the code harder to reason about.
Changes
- Replace hidden mutation functions with explicit configuration pattern
- Add
CertsTempDirfield toClientOptsand updateGetClientOptssignature to return(*ClientOpts, error)instead of(*ClientOpts, string, error)- Update all callers to use
clientOpts.CertsTempDir
- Update all callers to use
- Improve error messages to include namespace/name for better debugging
Related
Addresses similar error message clarity issues identified in https://github.com/fluxcd/source-controller/pull/1852#discussion_r2224416104
@cappyzawa can you please rebase and solve conflicts, would be great to get this merged.
Previously, I discussed refactoring with @matheuscscp once helm/helm#31076 was merged and available, but I forgot to mention it here—sorry about that.
Since it looks like helm/helm#31076 is still planned only for Helm 4 and there haven’t been any updates, I suppose any improvements to this PR will have to wait until then.
Yeah I think we can wait until we can remove this tmp dir altogether to merge this one