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