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 6 additions and 1 deletions
Showing only changes of commit 48f6045cd3 - Show all commits

View File

@@ -405,7 +405,11 @@ func (d *Deployment) Yaml() ([]byte, error) {
if strings.Contains(volume, "mountPath: ") {
spaces = strings.Repeat(" ", utils.CountStartingSpaces(volume))
varName := d.volumeMap[volumeName]
varName, ok := d.volumeMap[volumeName]
if !ok {
// this case happens when the volume is a "bind" volume comming from a "same-pod" service.
continue
}
varName = strings.ReplaceAll(varName, "-", "_")
content[line] = spaces + `{{- if .Values.` + serviceName + `.persistence.` + varName + `.enabled }}` + "\n" + volume
changing = true

View File

@@ -87,6 +87,7 @@ func Generate(project *types.Project) (*HelmChart, error) {
if target, ok := deployments[samepod]; ok {
target.AddContainer(*service)
target.BindFrom(*service, deployments[service.Name])
target.SetEnvFrom(*service, appName)
delete(deployments, service.Name)
} else {
log.Printf("service %[1]s is declared as %[2]s, but %[2]s is not defined", service.Name, labels.LabelSamePod)