From de0dde3ae850647737d26bfa7c8529aab8b9000c Mon Sep 17 00:00:00 2001 From: Patrice Ferlet Date: Wed, 1 Dec 2021 12:02:44 +0100 Subject: [PATCH] Fixup configMap names + add logs --- generator/main.go | 7 ++++++- helm/configMap.go | 2 -- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/generator/main.go b/generator/main.go index b2a36a3..d0725e9 100644 --- a/generator/main.go +++ b/generator/main.go @@ -43,7 +43,11 @@ func CreateReplicaObject(name string, s compose.Service) (ret []interface{}) { container := helm.NewContainer(name, s.Image, s.Environment, s.Labels) for _, envfile := range s.EnvFiles { - configMap := helm.NewConfigMap(name) + f := strings.ReplaceAll(envfile, "_", "-") + f = strings.ReplaceAll(f, ".env", "") + cf := f + "-" + name + Bluef("Generating configMap %s\n", cf) + configMap := helm.NewConfigMap(cf) if err := configMap.AddEnvFile(envfile); err != nil { Red(err.Error()) os.Exit(2) @@ -55,6 +59,7 @@ func CreateReplicaObject(name string, s compose.Service) (ret []interface{}) { }) ret = append(ret, configMap) + Greenf("Done configMap %s\n", cf) } container.Image = "{{ .Values." + name + ".image }}" diff --git a/helm/configMap.go b/helm/configMap.go index 254d43a..ce82b41 100644 --- a/helm/configMap.go +++ b/helm/configMap.go @@ -3,7 +3,6 @@ package helm import ( "errors" "io/ioutil" - "log" "strings" ) @@ -35,7 +34,6 @@ func (c *ConfigMap) AddEnvFile(file string) error { continue } parts := strings.SplitN(l, "=", 2) - log.Printf("%d %v\n", len(parts), parts) if len(parts) < 2 { return errors.New("The environment file " + file + " is not valid") }