Skip to content

Commit

Permalink
feat: Adding template arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerstin Albers authored and Kerstin Albers committed Nov 13, 2024
1 parent 6fbcd04 commit fd63118
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions chartify.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ type ChartifyOpts struct {
TemplateFuncs template.FuncMap
// TemplateData is the data available via {{ . }} within .gotmpl files
TemplateData interface{}

// TemplateArgs
TemplateArgs string

}

type ChartifyOption interface {
Expand Down Expand Up @@ -401,6 +405,7 @@ func (r *Runner) Chartify(release, dirOrChart string, opts ...ChartifyOption) (s
Validate: u.Validate,
KubeVersion: u.KubeVersion,
ApiVersions: u.ApiVersions,
TemplateArgs: u.TemplateArgs,

WorkaroundOutputDirIssue: u.WorkaroundOutputDirIssue,
}
Expand Down
7 changes: 7 additions & 0 deletions replace.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ type ReplaceWithRenderedOpts struct {
// templating in contrast to --validate
ApiVersions []string

// TemplateArgs
TemplateArgs string

// WorkaroundOutputDirIssue prevents chartify from using `helm template --output-dir` and let it use `helm template > some.yaml` instead to
// workaround the potential helm issue
// See https://github.com/roboll/helmfile/issues/1279#issuecomment-636839395
Expand Down Expand Up @@ -84,6 +87,10 @@ func (r *Runner) ReplaceWithRendered(name, chartName, chartPath string, o Replac
}
additionalFlags += createFlagChain("api-versions", o.ApiVersions)

if o.TemplateArgs != "" {
additionalFlags += fmt.Sprintf(" %s", o.TemplateArgs)
}

r.Logf("options: %v", o)

helmOutputDir := filepath.Join(chartPath, "helmx.1.rendered")
Expand Down

0 comments on commit fd63118

Please sign in to comment.