mirror of
https://github.com/outbackdingo/cozystack.git
synced 2026-01-27 10:18:39 +00:00
[lineage] Check for nil chart in HelmRelease (#1525)
## What this PR does Some HelmReleases use `chartRef` instead of `chart`. If the lineage webhook finds such a HelmRelease, a nil pointer dereference happens. This patch adds a nil check to guard against this. ### Release note ```release-note [lineage] Add a nil check to guard against HelmReleases with a nil .spec.chart field when traversing the ownership tree. ```
This commit is contained in:
@@ -38,6 +38,9 @@ func (l *LineageControllerWebhook) Map(hr *helmv2.HelmRelease) (string, string,
|
||||
if !ok {
|
||||
return "", "", "", fmt.Errorf("failed to load chart-app mapping from config")
|
||||
}
|
||||
if hr.Spec.Chart == nil {
|
||||
return "", "", "", fmt.Errorf("cannot map helm release %s/%s to dynamic app", hr.Namespace, hr.Name)
|
||||
}
|
||||
s := hr.Spec.Chart.Spec
|
||||
val, ok := cfg.chartAppMap[chartRef{s.SourceRef.Name, s.Chart}]
|
||||
if !ok {
|
||||
|
||||
Reference in New Issue
Block a user