fix: env_file configmap name length (#1743)

* fix: env_file configmap name length

fix filename to configmap name transformer

* fix configmap names in tests

* add env-multiple fixture and test

* adjust to test

* disable env-multiple suite
This commit is contained in:
Thijs Broersen
2023-10-27 10:48:55 +01:00
committed by GitHub
parent b3a3656c73
commit 7826534666
9 changed files with 427 additions and 13 deletions
+8 -1
View File
@@ -853,8 +853,15 @@ func GetContentFromFile(file string) (string, error) {
// FormatEnvName format env name
func FormatEnvName(name string) string {
envName := strings.Trim(name, "./")
// only take string after the last slash only if the string contains a slash
if strings.Contains(envName, "/") {
envName = envName[strings.LastIndex(envName, "/")+1:]
}
// take only last 63 chars
if len(envName) > 63 {
envName = envName[len(envName)-63:]
}
envName = strings.Replace(envName, ".", "-", -1)
envName = strings.Replace(envName, "/", "-", -1)
return envName
}