Skip to content

Commit

Permalink
Add Sprig template functions to provisioner (#5099)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaspersjo committed Jun 18, 2024
1 parent 12bd9e9 commit 0e15265
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion admin/provisioner/kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"text/template"
"time"

"github.com/Masterminds/sprig/v3"
"github.com/c2h5oh/datasize"
retryablehttp "github.com/hashicorp/go-retryablehttp"
"go.uber.org/multierr"
Expand Down Expand Up @@ -87,8 +88,14 @@ func NewKubernetes(spec json.RawMessage) (*KubernetesProvisioner, error) {
return nil, err
}

// Add Sprig template functions (removing functions that leak host info)
// Derived from Helm: https://github.com/helm/helm/blob/main/pkg/engine/funcs.go
funcMap := sprig.TxtFuncMap()
delete(funcMap, "env")
delete(funcMap, "expandenv")

// Parse the template definitions
templates := template.Must(template.New("").ParseFiles(
templates := template.Must(template.New("").Funcs(funcMap).ParseFiles(
ksp.TemplatePaths.HTTPIngress,
ksp.TemplatePaths.GRPCIngress,
ksp.TemplatePaths.Service,
Expand Down

1 comment on commit 0e15265

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Published on https://ui.rilldata.com as production
🚀 Deployed on https://6671ac2081326006e047148b--rill-ui.netlify.app

Please sign in to comment.