New ๐ŸŒŠ wave for @helm

Commit cefba71c

cefba71c75ecMerged

Dmitriy Zhilyaev <[email protected]> ยท 5 years ago ยท 1 file ยท ~1 modified

Description

fix uniqname for release

Details

Commit
cefba71c75ec
Parent
b65b657c6c1e

pkg/plan/validate.gomodifiedView file

@@ -6,6 +6,7 @@
66 "os"
77 "regexp"
88
9+ "github.com/helmwave/helmwave/pkg/release/uniqname"
910 log "github.com/sirupsen/logrus"
1011 )
1112
@@ -73,16 +74,12 @@
7374 }
7475
7576 func (p *planBody) ValidateReleases() error {
76- a := make(map[string]int8)
77+ a := make(map[uniqname.UniqName]int8)
7778 for _, r := range p.Releases {
7879 if r.Name == "" {
7980 return errors.New("release name is empty")
8081 }
8182
82- if !r.Uniq().Validate() {
83- return errors.New("bad uniqname: " + string(r.Uniq()))
84- }
85-
8683 if r.Namespace == "" {
8784 log.Warnf("namespace for %q is empty. I will use the namespace of your k8s context.", r.Uniq())
8885 }
@@ -91,9 +88,13 @@
9188 return errors.New("bad namespace: " + r.Namespace)
9289 }
9390
94- a[r.Name]++
95- if a[r.Name] > 1 {
96- return errors.New("release name duplicate: " + r.Name)
91+ if !r.Uniq().Validate() {
92+ return errors.New("bad uniqname: " + string(r.Uniq()))
93+ }
94+
95+ a[r.Uniq()]++
96+ if a[r.Uniq()] > 1 {
97+ return errors.New("release duplicate: " + string(r.Uniq()))
9798 }
9899 }
99100