squadron/internal/helm/doc.go
2023-09-21 10:25:54 +02:00

28 lines
549 B
Go

package helm
import (
"fmt"
"os"
"gopkg.in/yaml.v3"
)
const (
chartAPIVersionV2 = "v2"
defaultChartType = "application" // application or library
chartFile = "Chart.yaml"
valuesFile = "values.yaml"
)
func loadChart(path string) (*Chart, error) {
c := Chart{}
file, err := os.ReadFile(path)
if err != nil {
return nil, fmt.Errorf("error while opening file: %v", err)
}
if err := yaml.Unmarshal(file, &c); err != nil {
return nil, fmt.Errorf("error while unmarshalling template file: %s", err)
}
return &c, nil
}