fix inherit chart empty check issue (#635)

Signed-off-by: yxxhero <aiopsclub@163.com>

Signed-off-by: yxxhero <aiopsclub@163.com>
This commit is contained in:
yxxhero 2023-01-19 09:37:22 +08:00 committed by GitHub
parent 44b473ebe8
commit a724ab73f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 8 deletions

View File

@ -220,12 +220,6 @@ func (ld *desiredStateLoader) load(env, overrodeEnv *environment.Environment, ba
return nil, err
}
for i, r := range currentState.Releases {
if r.Chart == "" {
return nil, fmt.Errorf("error during %s parsing: encountered empty chart while reading release %q at index %d", id, r.Name, i)
}
}
if finalState == nil {
finalState = currentState
} else {

View File

@ -131,6 +131,10 @@ func (st *HelmState) ExecuteTemplates() (*HelmState, error) {
return nil, fmt.Errorf("failed executing templates in release \"%s\".\"%s\": %s", st.FilePath, release.Name,
"recursive references can't be resolved")
}
if st.Releases[i].Chart == "" {
return nil, fmt.Errorf("encountered empty chart while reading release %q", st.Releases[i].Name)
}
}
return &r, nil

View File

@ -8,6 +8,7 @@ templates:
- base: base
labels:
base: base
chart: ../../charts/raw-0.1.0
template1:
values:
- template1: template1
@ -34,7 +35,6 @@ templates:
releases:
- name: foo1
chart: ../../charts/raw-0.1.0
inherit:
template: template1
values:
@ -48,7 +48,6 @@ releases:
data:
{{` {{ (unset .Values "templates") | toYaml | nindent 2 }} `}}
- name: foo2
chart: ../../charts/raw-0.1.0
inherit:
template: template2
values: