cluster: addons as list

This commit is contained in:
Mikaël Cluseau 2023-05-15 14:47:53 +02:00
parent 76c1861017
commit 74abbf9eda
3 changed files with 23 additions and 15 deletions

View File

@ -101,12 +101,18 @@ func renderAddons(cluster *clustersconfig.Cluster) string {
return "" return ""
} }
addons := src.Addons[cluster.Addons] buf := new(bytes.Buffer)
for _, addonSet := range cluster.Addons {
addons := src.Addons[addonSet]
if addons == nil { 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 { type namePod struct {

View File

@ -221,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

View File

@ -102,11 +102,12 @@ func FromDir(
// cluster addons // cluster addons
for _, cluster := range config.Clusters { for _, cluster := range config.Clusters {
addonSet := cluster.Addons addonSets := cluster.Addons
if len(addonSet) == 0 { if len(addonSets) == 0 {
continue continue
} }
for _, addonSet := range addonSets {
if _, ok := config.Addons[addonSet]; ok { if _, ok := config.Addons[addonSet]; ok {
continue continue
} }
@ -118,6 +119,7 @@ func FromDir(
config.Addons[addonSet] = templates config.Addons[addonSet] = templates
} }
}
// cluster bootstrap pods // cluster bootstrap pods
for _, host := range config.Hosts { for _, host := range config.Hosts {