diff --git a/cmd/dkl-dir2config/render-cluster.go b/cmd/dkl-dir2config/render-cluster.go index 1637108..b273148 100644 --- a/cmd/dkl-dir2config/render-cluster.go +++ b/cmd/dkl-dir2config/render-cluster.go @@ -101,12 +101,18 @@ func renderAddons(cluster *clustersconfig.Cluster) string { return "" } - addons := src.Addons[cluster.Addons] - if addons == nil { - log.Fatalf("cluster %q: no addons with name %q", cluster.Name, 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, addonSet) + } + + buf.Write(renderClusterTemplates(cluster, "addons", addons)) } - return string(renderClusterTemplates(cluster, "addons", addons)) + return buf.String() } type namePod struct { diff --git a/pkg/clustersconfig/clustersconfig.go b/pkg/clustersconfig/clustersconfig.go index df8f298..131b440 100644 --- a/pkg/clustersconfig/clustersconfig.go +++ b/pkg/clustersconfig/clustersconfig.go @@ -221,7 +221,7 @@ type Cluster struct { Annotations map[string]string Domain string - Addons string + Addons []string Subnets struct { Services string Pods string diff --git a/pkg/clustersconfig/dir.go b/pkg/clustersconfig/dir.go index 5f5a50f..c60bc87 100644 --- a/pkg/clustersconfig/dir.go +++ b/pkg/clustersconfig/dir.go @@ -102,21 +102,23 @@ func FromDir( // cluster addons for _, cluster := range config.Clusters { - addonSet := cluster.Addons - if len(addonSet) == 0 { + addonSets := cluster.Addons + if len(addonSets) == 0 { continue } - if _, ok := config.Addons[addonSet]; ok { - continue - } + for _, addonSet := range addonSets { + if _, ok := config.Addons[addonSet]; ok { + continue + } - templates := make([]*Template, 0) - if err = loadTemplates(path.Join("addons", addonSet), &templates); err != nil { - return nil, err - } + templates := make([]*Template, 0) + if err = loadTemplates(path.Join("addons", addonSet), &templates); err != nil { + return nil, err + } - config.Addons[addonSet] = templates + config.Addons[addonSet] = templates + } } // cluster bootstrap pods