This commit is contained in:
Mikaël Cluseau
2019-10-09 16:58:28 +11:00
parent ee2779cc9d
commit dde0ad6975
9 changed files with 238 additions and 51 deletions

View File

@ -37,7 +37,10 @@ func FromDir(dirPath, defaultsPath string) (*Config, error) {
return nil
}
config := &Config{Addons: make(map[string][]*Template)}
config := &Config{
Addons: make(map[string][]*Template),
BootstrapPods: make(map[string][]*Template),
}
// load clusters
names, err := store.List("clusters")
@ -127,7 +130,8 @@ func FromDir(dirPath, defaultsPath string) (*Config, error) {
}
if Debug {
log.Printf("group %q: config=%q static_pods=%q", group.Name, group.Config, group.StaticPods)
log.Printf("group %q: config=%q static_pods=%q",
group.Name, group.Config, group.StaticPods)
}
group.StaticPods, err = template(group.Rev(), "static-pods", group.StaticPods, &config.StaticPods)
@ -189,6 +193,7 @@ func FromDir(dirPath, defaultsPath string) (*Config, error) {
return nil
}
// cluster addons
for _, cluster := range config.Clusters {
addonSet := cluster.Addons
if len(addonSet) == 0 {
@ -207,6 +212,25 @@ func FromDir(dirPath, defaultsPath string) (*Config, error) {
config.Addons[addonSet] = templates
}
// cluster bootstrap pods
for _, cluster := range config.Clusters {
bpSet := cluster.BootstrapPods
if bpSet == "" {
continue
}
if _, ok := config.BootstrapPods[bpSet]; ok {
continue
}
templates := make([]*Template, 0)
if err = loadTemplates(cluster.Rev(), path.Join("bootstrap-pods", bpSet), &templates); err != nil {
return nil, err
}
config.BootstrapPods[bpSet] = templates
}
// load SSL configuration
if ba, err := ioutil.ReadFile(filepath.Join(dirPath, "ssl-config.json")); err == nil {
config.SSLConfig = string(ba)