- image of container is now splitted in repository and tag (in values and deployment). The "tag" is tested in deployment - add "chart-version" option Code: - globalize the PVC generation - ensure types for environment values - refactored to make generic the container creation in a deployment - avoiding race condition on ServiceConfig by using a copy (then a pointer of this copy)
33 lines
803 B
Go
33 lines
803 B
Go
package writers
|
|
|
|
import (
|
|
"katenary/helm"
|
|
"log"
|
|
"os"
|
|
"path/filepath"
|
|
|
|
"gopkg.in/yaml.v3"
|
|
)
|
|
|
|
// BuildStorage writes the persistentVolumeClaim.
|
|
func BuildStorage(storage *helm.Storage, name, templatesDir string) {
|
|
kind := "pvc"
|
|
name = storage.Metadata.Labels[helm.K+"/component"]
|
|
pvcname := storage.Metadata.Labels[helm.K+"/pvc-name"]
|
|
fname := filepath.Join(templatesDir, name+"-"+pvcname+"."+kind+".yaml")
|
|
fp, err := os.Create(fname)
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
defer fp.Close()
|
|
volname := storage.K8sBase.Metadata.Labels[helm.K+"/pvc-name"]
|
|
|
|
fp.WriteString("{{ if .Values." + name + ".persistence." + volname + ".enabled }}\n")
|
|
enc := yaml.NewEncoder(fp)
|
|
enc.SetIndent(IndentSize)
|
|
if err := enc.Encode(storage); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
fp.WriteString("{{- end -}}")
|
|
}
|