Compare commits
No commits in common. "50bb60823f0d72376d805057eed1df6dd6bfca83" and "76c1861017568a784532d2a6ffab8d6f707842cd" have entirely different histories.
50bb60823f
...
76c1861017
@ -52,7 +52,7 @@ func clusterFuncs(clusterSpec *clustersconfig.Cluster) map[string]interface{} {
|
|||||||
|
|
||||||
"hosts_by_group": func(group string) (hosts []interface{}) {
|
"hosts_by_group": func(group string) (hosts []interface{}) {
|
||||||
for _, host := range src.Hosts {
|
for _, host := range src.Hosts {
|
||||||
if host.Cluster == cluster && host.Group == group {
|
if host.Group == group {
|
||||||
hosts = append(hosts, asMap(host))
|
hosts = append(hosts, asMap(host))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,18 +101,12 @@ func renderAddons(cluster *clustersconfig.Cluster) string {
|
|||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
buf := new(bytes.Buffer)
|
addons := src.Addons[cluster.Addons]
|
||||||
|
if addons == nil {
|
||||||
for _, addonSet := range cluster.Addons {
|
log.Fatalf("cluster %q: no addons with name %q", cluster.Name, cluster.Addons)
|
||||||
addons := src.Addons[addonSet]
|
|
||||||
if addons == nil {
|
|
||||||
log.Fatalf("cluster %q: no addons with name %q", cluster.Name, addonSet)
|
|
||||||
}
|
|
||||||
|
|
||||||
buf.Write(renderClusterTemplates(cluster, "addons", addons))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return buf.String()
|
return string(renderClusterTemplates(cluster, "addons", addons))
|
||||||
}
|
}
|
||||||
|
|
||||||
type namePod struct {
|
type namePod struct {
|
||||||
|
@ -135,11 +135,6 @@ func (t *Template) Execute(contextName, elementName string, wr io.Writer, data i
|
|||||||
indented = indent + strings.Replace(s, "\n", "\n"+indent, -1)
|
indented = indent + strings.Replace(s, "\n", "\n"+indent, -1)
|
||||||
return
|
return
|
||||||
},
|
},
|
||||||
"yaml": func(v any) (s string, err error) {
|
|
||||||
ba, err := yaml.Marshal(v)
|
|
||||||
s = string(ba)
|
|
||||||
return
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for name, f := range extraFuncs {
|
for name, f := range extraFuncs {
|
||||||
@ -226,7 +221,7 @@ type Cluster struct {
|
|||||||
Annotations map[string]string
|
Annotations map[string]string
|
||||||
|
|
||||||
Domain string
|
Domain string
|
||||||
Addons []string
|
Addons string
|
||||||
Subnets struct {
|
Subnets struct {
|
||||||
Services string
|
Services string
|
||||||
Pods string
|
Pods string
|
||||||
|
@ -102,23 +102,21 @@ func FromDir(
|
|||||||
|
|
||||||
// cluster addons
|
// cluster addons
|
||||||
for _, cluster := range config.Clusters {
|
for _, cluster := range config.Clusters {
|
||||||
addonSets := cluster.Addons
|
addonSet := cluster.Addons
|
||||||
if len(addonSets) == 0 {
|
if len(addonSet) == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, addonSet := range addonSets {
|
if _, ok := config.Addons[addonSet]; ok {
|
||||||
if _, ok := config.Addons[addonSet]; ok {
|
continue
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
templates := make([]*Template, 0)
|
|
||||||
if err = loadTemplates(path.Join("addons", addonSet), &templates); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
config.Addons[addonSet] = templates
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
templates := make([]*Template, 0)
|
||||||
|
if err = loadTemplates(path.Join("addons", addonSet), &templates); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
config.Addons[addonSet] = templates
|
||||||
}
|
}
|
||||||
|
|
||||||
// cluster bootstrap pods
|
// cluster bootstrap pods
|
||||||
|
Loading…
Reference in New Issue
Block a user