fix(tiller): fix install function

Because, occur the following error when `createNS` flag is true.
`panic: template: redefinition of template "manifest"`
pull/772/head
Ladicle 9 years ago
parent e6a8045bea
commit 97a9586a1b

@ -40,17 +40,18 @@ func NewInstaller() *Installer {
func (i *Installer) Install(verbose, createNS bool) error { func (i *Installer) Install(verbose, createNS bool) error {
var b bytes.Buffer var b bytes.Buffer
t := template.New("manifest").Funcs(sprig.TxtFuncMap())
// Add namespace // Add namespace
if createNS { if createNS {
if err := template.Must(t.Parse(NamespaceYAML)).Execute(&b, i); err != nil { nstpl := template.New("namespace").Funcs(sprig.TxtFuncMap())
if err := template.Must(nstpl.Parse(NamespaceYAML)).Execute(&b, i); err != nil {
return err return err
} }
} }
// Add main install YAML // Add main install YAML
if err := template.Must(t.Parse(InstallYAML)).Execute(&b, i); err != nil { istpl := template.New("install").Funcs(sprig.TxtFuncMap())
if err := template.Must(istpl.Parse(InstallYAML)).Execute(&b, i); err != nil {
return err return err
} }

Loading…
Cancel
Save