Allow the same release name on different tillerNamespaces (#529)
Closes #528
This commit is contained in:
parent
eb36e93c5a
commit
fa95e0dd92
|
|
@ -202,13 +202,20 @@ func (a *App) VisitDesiredStatesWithReleasesFiltered(fileOrDir string, converge
|
|||
}
|
||||
}
|
||||
|
||||
releaseNameCounts := map[string]int{}
|
||||
type Key struct {
|
||||
TillerNamespace, Name string
|
||||
}
|
||||
releaseNameCounts := map[Key]int{}
|
||||
for _, r := range st.Releases {
|
||||
releaseNameCounts[r.Name]++
|
||||
tillerNamespace := st.HelmDefaults.TillerNamespace
|
||||
if r.TillerNamespace != "" {
|
||||
tillerNamespace = r.TillerNamespace
|
||||
}
|
||||
releaseNameCounts[Key{tillerNamespace, r.Name}]++
|
||||
}
|
||||
for name, c := range releaseNameCounts {
|
||||
if c > 1 {
|
||||
return false, []error{fmt.Errorf("duplicate release \"%s\" found: there were %d releases named \"%s\" matching specified selector", name, c, name)}
|
||||
return false, []error{fmt.Errorf("duplicate release \"%s\" found in \"%s\": there were %d releases named \"%s\" matching specified selector", name.Name, name.TillerNamespace, c, name.Name)}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -247,6 +247,8 @@ releases:
|
|||
chart: stable/prometheus
|
||||
`,
|
||||
"/path/to/helmfile.d/b.yaml": `
|
||||
helmDefaults:
|
||||
tillerNamespace: zoo
|
||||
releases:
|
||||
- name: grafana
|
||||
chart: stable/grafana
|
||||
|
|
@ -258,6 +260,16 @@ releases:
|
|||
chart: charts/foo
|
||||
labels:
|
||||
duplicated: yes
|
||||
- name: bar
|
||||
chart: charts/foo
|
||||
tillerNamespace: bar1
|
||||
labels:
|
||||
duplicatedOK: yes
|
||||
- name: bar
|
||||
chart: charts/foo
|
||||
tillerNamespace: bar2
|
||||
labels:
|
||||
duplicatedOK: yes
|
||||
`,
|
||||
}
|
||||
|
||||
|
|
@ -272,7 +284,8 @@ releases:
|
|||
{label: "name!=", expectedCount: 0, expectErr: true, errMsg: "failed processing /path/to/helmfile.d/a1.yaml: Malformed label: name!=. Expected label in form k=v or k!=v"},
|
||||
{label: "name", expectedCount: 0, expectErr: true, errMsg: "failed processing /path/to/helmfile.d/a1.yaml: Malformed label: name. Expected label in form k=v or k!=v"},
|
||||
// See https://github.com/roboll/helmfile/issues/193
|
||||
{label: "duplicated=yes", expectedCount: 0, expectErr: true, errMsg: "failed processing /path/to/helmfile.d/b.yaml: duplicate release \"foo\" found: there were 2 releases named \"foo\" matching specified selector"},
|
||||
{label: "duplicated=yes", expectedCount: 0, expectErr: true, errMsg: "failed processing /path/to/helmfile.d/b.yaml: duplicate release \"foo\" found in \"zoo\": there were 2 releases named \"foo\" matching specified selector"},
|
||||
{label: "duplicatedOK=yes", expectedCount: 2, expectErr: false},
|
||||
}
|
||||
|
||||
for _, testcase := range testcases {
|
||||
|
|
|
|||
Loading…
Reference in New Issue