-
Notifications
You must be signed in to change notification settings - Fork 174
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Check source for nil artifact before loading chart #768
Conversation
artifact := source.GetArtifact() | ||
if artifact == nil { | ||
return nil, fmt.Errorf("source '%s/%s' has no artifact", source.GetNamespace(), source.GetName()) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would do this before the creation of the temporary file, as we do not need it without the Artifact being present.
artifactURL := source.GetArtifact().URL | ||
artifact := source.GetArtifact() | ||
if artifact == nil { | ||
return nil, fmt.Errorf("source '%s/%s' has no artifact", source.GetNamespace(), source.GetName()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return nil, fmt.Errorf("source '%s/%s' has no artifact", source.GetNamespace(), source.GetName()) | |
return nil, fmt.Errorf("can not load Helm chart: source '%s/%s' has no artifact", source.GetNamespace(), source.GetName()) |
would probably be more descriptive.
@@ -231,7 +231,8 @@ func (r *HelmReleaseReconciler) reconcile(ctx context.Context, hr v2.HelmRelease | |||
} | |||
|
|||
// Check chart readiness | |||
if hc.Generation != hc.Status.ObservedGeneration || !apimeta.IsStatusConditionTrue(hc.Status.Conditions, meta.ReadyCondition) { | |||
if hc.Generation != hc.Status.ObservedGeneration || | |||
!apimeta.IsStatusConditionTrue(hc.Status.Conditions, meta.ReadyCondition) || hc.GetArtifact() == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given it should really be an edge case, doing this in one place (before attempting to load) should be sufficient IMHO.
56f05a4
to
6efb5b6
Compare
Signed-off-by: Somtochi Onyekwere <[email protected]>
6efb5b6
to
c1d77ad
Compare
This pull request adds a check for nil artifact when determining if the source chart is ready.
A recovered nil panic was reported on Slack.
https://cloud-native.slack.com/archives/CLAJ40HV3/p1694379977158039?thread_ts=1694280268.559579&cid=CLAJ40HV3