Fix problems of new line + add comments
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
|||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// BuildConfigMap writes the configMap.
|
||||||
func BuildConfigMap(c interface{}, kind, servicename, name, templatesDir string) {
|
func BuildConfigMap(c interface{}, kind, servicename, name, templatesDir string) {
|
||||||
fname := filepath.Join(templatesDir, servicename+"."+name+"."+kind+".yaml")
|
fname := filepath.Join(templatesDir, servicename+"."+name+"."+kind+".yaml")
|
||||||
fp, _ := os.Create(fname)
|
fp, _ := os.Create(fname)
|
||||||
|
@@ -10,6 +10,7 @@ import (
|
|||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// BuildDeployment builds a deployment.
|
||||||
func BuildDeployment(deployment *helm.Deployment, name, templatesDir string) {
|
func BuildDeployment(deployment *helm.Deployment, name, templatesDir string) {
|
||||||
kind := "deployment"
|
kind := "deployment"
|
||||||
fname := filepath.Join(templatesDir, name+"."+kind+".yaml")
|
fname := filepath.Join(templatesDir, name+"."+kind+".yaml")
|
||||||
|
@@ -23,6 +23,7 @@ apiVersion: extensions/v1beta1
|
|||||||
{{- end }}`
|
{{- end }}`
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// BuildIngress generates the ingress yaml file with conditions.
|
||||||
func BuildIngress(ingress *helm.Ingress, name, templatesDir string) {
|
func BuildIngress(ingress *helm.Ingress, name, templatesDir string) {
|
||||||
// Set the backend for 1.18
|
// Set the backend for 1.18
|
||||||
for _, b := range ingress.Spec.Rules {
|
for _, b := range ingress.Spec.Rules {
|
||||||
@@ -63,7 +64,7 @@ func BuildIngress(ingress *helm.Ingress, name, templatesDir string) {
|
|||||||
n := CountSpaces(l)
|
n := CountSpaces(l)
|
||||||
l = strings.Repeat(" ", n) + versionCondition118 +
|
l = strings.Repeat(" ", n) + versionCondition118 +
|
||||||
l + "\n" +
|
l + "\n" +
|
||||||
strings.Repeat(" ", n) + "{{- end -}}"
|
strings.Repeat(" ", n) + "{{- end }}"
|
||||||
}
|
}
|
||||||
|
|
||||||
if strings.Contains(l, "ingressClassName") {
|
if strings.Contains(l, "ingressClassName") {
|
||||||
@@ -82,7 +83,7 @@ func BuildIngress(ingress *helm.Ingress, name, templatesDir string) {
|
|||||||
if !backendHit {
|
if !backendHit {
|
||||||
l = strings.Repeat(" ", n) + "{{- else }}\n" + l
|
l = strings.Repeat(" ", n) + "{{- else }}\n" + l
|
||||||
} else {
|
} else {
|
||||||
l = l + "\n" + strings.Repeat(" ", n) + "{{- end }}"
|
l = l + "\n" + strings.Repeat(" ", n) + "{{- end }}\n"
|
||||||
}
|
}
|
||||||
backendHit = true
|
backendHit = true
|
||||||
}
|
}
|
||||||
|
@@ -8,6 +8,7 @@ import (
|
|||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// BuildService writes the service (external or not).
|
||||||
func BuildService(service *helm.Service, name, templatesDir string) {
|
func BuildService(service *helm.Service, name, templatesDir string) {
|
||||||
kind := "service"
|
kind := "service"
|
||||||
suffix := ""
|
suffix := ""
|
||||||
|
@@ -8,6 +8,7 @@ import (
|
|||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// BuildStorage writes the persistentVolumeClaim.
|
||||||
func BuildStorage(storage *helm.Storage, name, templatesDir string) {
|
func BuildStorage(storage *helm.Storage, name, templatesDir string) {
|
||||||
kind := "pvc"
|
kind := "pvc"
|
||||||
name = storage.Metadata.Labels[helm.K+"/component"]
|
name = storage.Metadata.Labels[helm.K+"/component"]
|
||||||
|
Reference in New Issue
Block a user