This commit is contained in:
2022-05-05 08:59:31 +02:00
parent 979206d3bf
commit 13f74c9e4d

View File

@@ -42,7 +42,12 @@ func BuildIngress(ingress *helm.Ingress, name, templatesDir string) {
enc.Encode(ingress) enc.Encode(ingress)
buffer.WriteString("{{- end -}}") buffer.WriteString("{{- end -}}")
fp, _ := os.Create(fname) fp, err := os.Create(fname)
if err != nil {
panic(err)
}
defer fp.Close()
content := string(buffer.Bytes()) content := string(buffer.Bytes())
lines := strings.Split(content, "\n") lines := strings.Split(content, "\n")
@@ -67,7 +72,7 @@ func BuildIngress(ingress *helm.Ingress, name, templatesDir string) {
l = ` ` + cond + l + "\n" + ` {{- end }}` l = ` ` + cond + l + "\n" + ` {{- end }}`
} }
// manage the backend format following the Kubernetes 1.18-0 version or higher // manage the backend format following the Kubernetes 1.19-0 version or higher
if strings.Contains(l, "service:") { if strings.Contains(l, "service:") {
n := CountSpaces(l) n := CountSpaces(l)
l = strings.Repeat(" ", n) + versionCondition119 + l l = strings.Repeat(" ", n) + versionCondition119 + l
@@ -81,9 +86,6 @@ func BuildIngress(ingress *helm.Ingress, name, templatesDir string) {
} }
backendHit = true backendHit = true
} }
fp.WriteString(l + "\n") fp.WriteString(l + "\n")
} }
fp.Close()
} }