cluster: addons as list
This commit is contained in:
		| @ -101,12 +101,18 @@ func renderAddons(cluster *clustersconfig.Cluster) string { | |||||||
| 		return "" | 		return "" | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	addons := src.Addons[cluster.Addons] | 	buf := new(bytes.Buffer) | ||||||
| 	if addons == nil { |  | ||||||
| 		log.Fatalf("cluster %q: no addons with name %q", cluster.Name, cluster.Addons) | 	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 { | type namePod struct { | ||||||
|  | |||||||
| @ -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 | ||||||
|  | |||||||
| @ -102,21 +102,23 @@ 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 | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		if _, ok := config.Addons[addonSet]; ok { | 		for _, addonSet := range addonSets { | ||||||
| 			continue | 			if _, ok := config.Addons[addonSet]; ok { | ||||||
| 		} | 				continue | ||||||
|  | 			} | ||||||
|  |  | ||||||
| 		templates := make([]*Template, 0) | 			templates := make([]*Template, 0) | ||||||
| 		if err = loadTemplates(path.Join("addons", addonSet), &templates); err != nil { | 			if err = loadTemplates(path.Join("addons", addonSet), &templates); err != nil { | ||||||
| 			return nil, err | 				return nil, err | ||||||
| 		} | 			} | ||||||
|  |  | ||||||
| 		config.Addons[addonSet] = templates | 			config.Addons[addonSet] = templates | ||||||
|  | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	// cluster bootstrap pods | 	// cluster bootstrap pods | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user