Selection des charts

This commit is contained in:
admju
2024-09-03 15:26:10 +00:00
parent 756638fe21
commit 9e267becca
3 changed files with 22 additions and 12 deletions

View File

@@ -89,7 +89,7 @@ func (this *InstallClass) ChartRepo() (error) {
}
func (this *InstallClass) InstallCharts() (error) {
func (this *InstallClass) InstallCharts(modules []string) (error) {
helm_bin, _ := this.getToolBin("helm")
kubectl_bin, _ := this.getToolBin("kubectl")
@@ -97,19 +97,30 @@ func (this *InstallClass) InstallCharts() (error) {
for _, v := range this.charts {
for _, v1 := range v.Charts {
wg.Add(1)
if len(modules) == 0 || stringInSlice(v1.Name, modules) {
wg.Add(1)
go func() {
defer wg.Done()
this.installChart(helm_bin, kubectl_bin, v1)
} ()
go func() {
defer wg.Done()
this.installChart(helm_bin, kubectl_bin, v1)
} ()
}
}
}
wg.Wait()
return nil
}
func stringInSlice(a string, list []string) bool {
for _, b := range list {
if b == a {
return true
}
}
return false
}
func (this *InstallClass) installChart(helm_bin string, kubectl_bin string, chart chart.ChartData) {
log.Log().Info().Msg(fmt.Sprintf(" << Chart : %s ", chart.Name))