fix(generation): fix the volume var/path name
Underscores are forbidden by Kubernetes (should be a valid URL string), we replace "_" by "-" in names, and we leave the values file using the original name. So a volume named "foo_bar" in compose file, is registered as "foo_bar" in the values file, but "foo-bar" is used as volume name in deployments, volume claims, ...
This commit is contained in:
@@ -117,6 +117,7 @@ func PathToName(path string) string {
|
||||
path = strings.ReplaceAll(path, "_", "-")
|
||||
path = strings.ReplaceAll(path, "/", "-")
|
||||
path = strings.ReplaceAll(path, ".", "-")
|
||||
path = strings.ToLower(path)
|
||||
return path
|
||||
}
|
||||
|
||||
@@ -192,3 +193,8 @@ func EncodeBasicYaml(data any) ([]byte, error) {
|
||||
}
|
||||
return buf.Bytes(), nil
|
||||
}
|
||||
|
||||
// FixedResourceName returns a resource name without underscores to respect the kubernetes naming convention.
|
||||
func FixedResourceName(name string) string {
|
||||
return strings.ReplaceAll(name, "_", "-")
|
||||
}
|
||||
|
Reference in New Issue
Block a user