fluxcd / source-controller

The GitOps Toolkit source management component
https://fluxcd.io
Apache License 2.0
239 stars 186 forks source link

Fix unknown build error when reconciling HelmChart from an OCI Registry #894

Open souleb opened 2 years ago

souleb commented 2 years ago

HelmCharts reconciliation sometime result in unknown build error and Unknown reason with auth failure It happens when HelmChart build is attempted when the associated HelmRepository isn't ready because of the auth failure. It then returns *conditions.TrueCondition(sourcev1.FetchFailedCondition, "Unknown", "unknown build error: failed to login to OCI registry").

Around source-controller/controllers/helmchart_controller.go we have a check for non-OCI charts to ensures that the HelmRepo has artifact before proceeding further. We can add a similar check for OCI where we make sure that the HelmRepo is ready before proceeding to build it. That way, we can avoid such Unknown errors and show better status conditions.

Santosh1176 commented 2 years ago

Hey @souleb, Can I work on this?

Could you also please point me to some resources for reproducing this locally? Thanks

souleb commented 2 years ago

Thanks for working on this @Santosh1176

If you create a helmrepository of type oci with wrong credentials, it should fail reconciliation. If you then use it as source in a helmrelease, you should be able to reproduce. You will have to look for the helmChart custom resource declared by the helm-controller.

souleb commented 1 year ago

hello @Santosh1176, did you have the chance to look at this?

Santosh1176 commented 1 year ago

@souleb Sorry, I tried but could not reproduce the issue, I'll take a closer look this weekend. if this task is of importance, please go ahead. Thank you!

souleb commented 1 year ago

I think we can close this? cc @darkowlzz

darkowlzz commented 1 year ago

@souleb I don't remember any fix for this and looking at the code, I don't see any check for OCI HelmRepository to be ready. So it should still be an issue.