A big commit to fix more things, see details

- ingress can now have annotations
- configmaps are better named and there is a label to know from where
  the content is taken
- fixed bad "nil" pointer checks
- we force to not resolve paths from compose file, this should be a
  problem when we call the compose file from outside. So, TODO: check
  this!
- the "project" label is now the Chart Name, not a static string
- minor fixes
This commit is contained in:
2022-05-06 20:18:10 +02:00
parent baeb8a612a
commit b1b96d8318
8 changed files with 68 additions and 22 deletions

View File

@@ -16,7 +16,10 @@ import (
"gopkg.in/yaml.v3"
)
type HelmFile interface{}
type HelmFile interface {
GetType() string
GetPathRessource() string
}
type HelmFileGenerator chan HelmFile
var PrefixRE = regexp.MustCompile(`\{\{.*\}\}-?`)
@@ -179,7 +182,15 @@ func Generate(p *compose.Parser, katernayVersion, appName, appVersion, chartVers
case *helm.ConfigMap, *helm.Secret:
// there could be several files, so let's force the filename
name := c.(helm.Named).Name()
name := c.(helm.Named).Name() + "-" + c.GetType()
suffix := c.GetPathRessource()
if suffix != "" {
charToRemove := []string{"/", ".", " "}
for _, char := range charToRemove {
suffix = strings.Replace(suffix, char, "-", -1)
}
}
name += suffix
name = PrefixRE.ReplaceAllString(name, "")
writers.BuildConfigMap(c, kind, n, name, templatesDir)