remove bootstrap pods from cluster, and render in hosts' context
This commit is contained in:
@ -5,9 +5,11 @@ import (
|
||||
"crypto/sha1"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"path"
|
||||
"reflect"
|
||||
"strings"
|
||||
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
|
||||
@ -154,6 +156,12 @@ func (ctx *renderContext) Config() string {
|
||||
}
|
||||
|
||||
func (ctx *renderContext) renderConfig(configTemplate *clustersconfig.Template) string {
|
||||
buf := new(strings.Builder)
|
||||
ctx.renderConfigTo(buf, configTemplate)
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
func (ctx *renderContext) renderConfigTo(buf io.Writer, configTemplate *clustersconfig.Template) {
|
||||
ctxName := ctx.Name()
|
||||
|
||||
ctxMap := ctx.asMap()
|
||||
@ -189,7 +197,7 @@ func (ctx *renderContext) renderConfig(configTemplate *clustersconfig.Template)
|
||||
}
|
||||
|
||||
extraFuncs["bootstrap_pods_files"] = func(dir string) (string, error) {
|
||||
namePods := renderBootstrapPods(ctx.Cluster)
|
||||
namePods := ctx.renderBootstrapPods()
|
||||
|
||||
defs := make([]config.FileDef, 0)
|
||||
|
||||
@ -217,12 +225,9 @@ func (ctx *renderContext) renderConfig(configTemplate *clustersconfig.Template)
|
||||
return hex.EncodeToString(ba[:])
|
||||
}
|
||||
|
||||
buf := bytes.NewBuffer(make([]byte, 0, 4096))
|
||||
if err := configTemplate.Execute(ctxName, "config", buf, ctxMap, extraFuncs); err != nil {
|
||||
log.Fatalf("failed to render config %q for host %q: %v", ctx.Group.Config, ctx.Host.Name, err)
|
||||
}
|
||||
|
||||
return buf.String()
|
||||
}
|
||||
|
||||
func (ctx *renderContext) StaticPods() (ba []byte, err error) {
|
||||
|
Reference in New Issue
Block a user