Skip to content

Commit

Permalink
config: Force use of podman preset on M1 CPUs
Browse files Browse the repository at this point in the history
Since we cannot have a m1 OpenShift bundles, there's no point in
allowing to select one.
  • Loading branch information
cfergeau authored and anjannath committed Jun 2, 2022
1 parent 7429468 commit b14fb9d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/crc/config/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,10 @@ func RegisterSettings(cfg *Config) {
}

// Preset setting should be on top because CPUs/Memory config depend on it.
cfg.AddSetting(Preset, string(preset.OpenShift), validatePreset, RequiresDeleteAndSetupMsg,
fmt.Sprintf("Virtual machine preset (alpha feature - valid values are: %s or %s)", preset.Podman, preset.OpenShift))
if runtime.GOOS != "darwin" || runtime.GOARCH != "arm64" {
cfg.AddSetting(Preset, string(preset.OpenShift), validatePreset, RequiresDeleteAndSetupMsg,
fmt.Sprintf("Virtual machine preset (alpha feature - valid values are: %s or %s)", preset.Podman, preset.OpenShift))
}
// Start command settings in config
cfg.AddSetting(Bundle, defaultBundlePath(cfg), validateBundlePath, SuccessfullyApplied,
fmt.Sprintf("Bundle path (string, default '%s')", defaultBundlePath(cfg)))
Expand Down Expand Up @@ -116,6 +118,10 @@ func defaultBundlePath(cfg Storage) string {
}

func GetPreset(config Storage) preset.Preset {
if runtime.GOOS == "darwin" && runtime.GOARCH == "arm64" {
return preset.Podman
}

return preset.ParsePreset(config.Get(Preset).AsString())
}

Expand Down

0 comments on commit b14fb9d

Please sign in to comment.