diff --git a/packaging/darwin/Distribution.in b/packaging/darwin/Distribution.in index 46d4fa766e..8e77864a25 100755 --- a/packaging/darwin/Distribution.in +++ b/packaging/darwin/Distribution.in @@ -26,6 +26,13 @@ function installCheck() { my.result.type = 'Fatal'; return false; } + + if(!(system.compareVersions(system.version.ProductVersion, '13.0.0') >= 0)) { + my.result.title = 'Deprecation warning'; + my.result.message = 'This version of macOS is going to be unsupported for Red Hat OpenShift Local, Please update to macOS 13 or newer'; + my.result.type = 'Warning'; + return true; + } return true; } diff --git a/pkg/crc/preflight/preflight_checks_darwin.go b/pkg/crc/preflight/preflight_checks_darwin.go index 55a7da36d3..e0fd3b5b6f 100644 --- a/pkg/crc/preflight/preflight_checks_darwin.go +++ b/pkg/crc/preflight/preflight_checks_darwin.go @@ -15,6 +15,7 @@ import ( "github.com/crc-org/crc/v2/pkg/crc/machine/vfkit" "github.com/crc-org/crc/v2/pkg/crc/version" crcos "github.com/crc-org/crc/v2/pkg/os" + "github.com/crc-org/crc/v2/pkg/os/darwin" "github.com/crc-org/crc/v2/pkg/os/darwin/launchd" "github.com/klauspost/cpuid/v2" "golang.org/x/sys/unix" @@ -224,3 +225,14 @@ func fixPlistFileExists(agentConfig launchd.AgentConfig) error { } return waitForDaemonRunning() } + +func deprecationNotice() error { + supports, err := darwin.AtLeast("13.0.0") + if err != nil { + return err + } + if !supports { + logging.Warnf("This version of macOS is going to be unsupported for CRC, Please update to macOS 13 or newer") + } + return nil +} diff --git a/pkg/crc/preflight/preflight_darwin.go b/pkg/crc/preflight/preflight_darwin.go index 48f6735672..b4d963d11c 100644 --- a/pkg/crc/preflight/preflight_darwin.go +++ b/pkg/crc/preflight/preflight_darwin.go @@ -10,6 +10,17 @@ import ( "github.com/crc-org/crc/v2/pkg/os/darwin/launchd" ) +// Deprecate warning for older version of mac<13.x +var deprecationWarning = Check{ + configKeySuffix: "check-mac-version", + checkDescription: "Checking if running macOS version >= 13.x", + check: deprecationNotice, + fixDescription: "This version of macOS is going to be unsupported on CRC", + flags: NoFix, + + labels: labels{Os: Darwin}, +} + // SetupHost performs the prerequisite checks and setups the host to run the cluster var vfkitPreflightChecks = []Check{ { @@ -105,6 +116,7 @@ func getAllPreflightChecks() []Check { func getChecks(_ network.Mode, bundlePath string, preset crcpreset.Preset, enableBundleQuayFallback bool) []Check { checks := []Check{} + checks = append(checks, deprecationWarning) checks = append(checks, nonWinPreflightChecks...) checks = append(checks, genericPreflightChecks(preset)...) checks = append(checks, memoryCheck(preset)) diff --git a/pkg/crc/preflight/preflight_darwin_test.go b/pkg/crc/preflight/preflight_darwin_test.go index 12c2687ac6..4a1c83bf7c 100644 --- a/pkg/crc/preflight/preflight_darwin_test.go +++ b/pkg/crc/preflight/preflight_darwin_test.go @@ -13,13 +13,13 @@ import ( func TestCountConfigurationOptions(t *testing.T) { cfg := config.New(config.NewEmptyInMemoryStorage(), config.NewEmptyInMemorySecretStorage()) RegisterSettings(cfg) - assert.Len(t, cfg.AllConfigs(), 12) + assert.Len(t, cfg.AllConfigs(), 13) } func TestCountPreflights(t *testing.T) { - assert.Len(t, getPreflightChecks(true, network.SystemNetworkingMode, constants.GetDefaultBundlePath(preset.OpenShift), preset.OpenShift, false), 18) - assert.Len(t, getPreflightChecks(true, network.SystemNetworkingMode, constants.GetDefaultBundlePath(preset.OpenShift), preset.OpenShift, false), 18) + assert.Len(t, getPreflightChecks(true, network.SystemNetworkingMode, constants.GetDefaultBundlePath(preset.OpenShift), preset.OpenShift, false), 19) + assert.Len(t, getPreflightChecks(true, network.SystemNetworkingMode, constants.GetDefaultBundlePath(preset.OpenShift), preset.OpenShift, false), 19) - assert.Len(t, getPreflightChecks(true, network.UserNetworkingMode, constants.GetDefaultBundlePath(preset.OpenShift), preset.OpenShift, false), 17) - assert.Len(t, getPreflightChecks(true, network.UserNetworkingMode, constants.GetDefaultBundlePath(preset.OpenShift), preset.OpenShift, false), 17) + assert.Len(t, getPreflightChecks(true, network.UserNetworkingMode, constants.GetDefaultBundlePath(preset.OpenShift), preset.OpenShift, false), 18) + assert.Len(t, getPreflightChecks(true, network.UserNetworkingMode, constants.GetDefaultBundlePath(preset.OpenShift), preset.OpenShift, false), 18) }