mirror of
https://github.com/mudler/luet.git
synced 2025-09-02 07:45:02 +00:00
Enhance CLI output
This commit is contained in:
@@ -1,15 +1,14 @@
|
||||
package helpers
|
||||
|
||||
import (
|
||||
|
||||
"github.com/pkg/errors"
|
||||
"helm.sh/helm/v3/pkg/chart"
|
||||
"helm.sh/helm/v3/pkg/chartutil"
|
||||
"helm.sh/helm/v3/pkg/engine"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
||||
// RenderHelm renders the template string with helm
|
||||
func RenderHelm(template string, values map[string]interface{}) (string,error) {
|
||||
func RenderHelm(template string, values map[string]interface{}) (string, error) {
|
||||
c := &chart.Chart{
|
||||
Metadata: &chart.Metadata{
|
||||
Name: "",
|
||||
@@ -18,17 +17,17 @@ func RenderHelm(template string, values map[string]interface{}) (string,error) {
|
||||
Templates: []*chart.File{
|
||||
{Name: "templates", Data: []byte(template)},
|
||||
},
|
||||
Values: map[string]interface{}{"Values":values},
|
||||
Values: map[string]interface{}{"Values": values},
|
||||
}
|
||||
|
||||
v, err := chartutil.CoalesceValues(c, map[string]interface{}{})
|
||||
if err != nil {
|
||||
return "",errors.Wrap(err,"while rendering template")
|
||||
return "", errors.Wrap(err, "while rendering template")
|
||||
}
|
||||
out, err := engine.Render(c, v)
|
||||
if err != nil {
|
||||
return "",errors.Wrap(err,"while rendering template")
|
||||
return "", errors.Wrap(err, "while rendering template")
|
||||
}
|
||||
|
||||
return out["templates"],nil
|
||||
return out["templates"], nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user