Some fixes on "same-pod" and volumes + add some tests #82
@@ -405,7 +405,11 @@ func (d *Deployment) Yaml() ([]byte, error) {
|
|||||||
|
|
||||||
if strings.Contains(volume, "mountPath: ") {
|
if strings.Contains(volume, "mountPath: ") {
|
||||||
spaces = strings.Repeat(" ", utils.CountStartingSpaces(volume))
|
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, "-", "_")
|
varName = strings.ReplaceAll(varName, "-", "_")
|
||||||
content[line] = spaces + `{{- if .Values.` + serviceName + `.persistence.` + varName + `.enabled }}` + "\n" + volume
|
content[line] = spaces + `{{- if .Values.` + serviceName + `.persistence.` + varName + `.enabled }}` + "\n" + volume
|
||||||
changing = true
|
changing = true
|
||||||
|
@@ -87,6 +87,7 @@ func Generate(project *types.Project) (*HelmChart, error) {
|
|||||||
if target, ok := deployments[samepod]; ok {
|
if target, ok := deployments[samepod]; ok {
|
||||||
target.AddContainer(*service)
|
target.AddContainer(*service)
|
||||||
target.BindFrom(*service, deployments[service.Name])
|
target.BindFrom(*service, deployments[service.Name])
|
||||||
|
target.SetEnvFrom(*service, appName)
|
||||||
delete(deployments, service.Name)
|
delete(deployments, service.Name)
|
||||||
} else {
|
} else {
|
||||||
log.Printf("service %[1]s is declared as %[2]s, but %[2]s is not defined", service.Name, labels.LabelSamePod)
|
log.Printf("service %[1]s is declared as %[2]s, but %[2]s is not defined", service.Name, labels.LabelSamePod)
|
||||||
|
Reference in New Issue
Block a user