Some fixes on "same-pod" and volumes + add some tests #82

Merged
metal3d merged 20 commits from develop into master 2024-11-25 22:17:56 +00:00
2 changed files with 7 additions and 1 deletions
Showing only changes of commit 3b51f41716 - Show all commits

View File

@@ -273,7 +273,7 @@ func buildVolumes(service types.ServiceConfig, chart *HelmChart, deployments map
}
switch v.Type {
case "volume":
v.Source = strings.ReplaceAll(v.Source, "-", "_")
v.Source = utils.AsResourceName(v.Source)
pvc := NewVolumeClaim(service, v.Source, appName)
// if the service is integrated in another deployment, we need to add the volume

View File

@@ -198,3 +198,9 @@ func EncodeBasicYaml(data any) ([]byte, error) {
func FixedResourceName(name string) string {
return strings.ReplaceAll(name, "_", "-")
}
// AsResourceName returns a resource name with underscores to respect the kubernetes naming convention.
// It's the opposite of FixedResourceName.
func AsResourceName(name string) string {
return strings.ReplaceAll(name, "-", "_")
}