Skip to content

Commit

Permalink
check if custom charts are disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
danj-replicated committed Oct 4, 2023
1 parent 6ba7990 commit ce01dd8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/addons/applier.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,13 @@ func (a *Applier) GenerateHelmConfigs(ctx *cli.Context) (dig.Mapping, error) {
charts := []dig.Mapping{}

addons, err := a.load()
fmt.Printf("addons: %v", addons)

if err != nil {
return helmConfig, fmt.Errorf("unable to load addons: %w", err)
}
for _, addon := range addons {

addonChartConfig, err := addon.GenerateHelmConfig(ctx)
if err != nil {
return helmConfig, fmt.Errorf("Could not add chart: %w", err)
Expand Down Expand Up @@ -100,6 +103,7 @@ func (a *Applier) HostPreflights() (*v1beta2.HostPreflightSpec, error) {

// load instantiates all enabled addons.
func (a *Applier) load() (map[string]AddOn, error) {

addons := map[string]AddOn{}
if _, disabledAddons := a.disabledAddons["openebs"]; !disabledAddons {
obs, err := openebs.New("helmvm")
Expand All @@ -108,6 +112,7 @@ func (a *Applier) load() (map[string]AddOn, error) {
}
addons["openebs"] = obs
}

if _, disabledAddons := a.disabledAddons["adminconsole"]; !disabledAddons {
aconsole, err := adminconsole.New("helmvm", a.prompt)
if err != nil {
Expand Down
5 changes: 5 additions & 0 deletions pkg/addons/custom/custom.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ func (c *Custom) GenerateHelmConfig(ctx *cli.Context) ([]dig.Mapping, error) {
return chartConfigs, fmt.Errorf("unable to load chart archive: %w", err)
}

if c.chartHasBeenDisabled(chartData) {
logrus.Infof("skipping disabled chart %s", chartData.Name())
continue
}

chartName := strings.ToLower(chartData.Name())
chartFile := fmt.Sprintf("%s-%s.tgz", chartName, chartData.Metadata.Version)
dstpath := filepath.Join(defaults.HelmChartSubDir(), chartFile)
Expand Down

0 comments on commit ce01dd8

Please sign in to comment.