Skip to content

Commit

Permalink
Add deprecation warning in case user are on macOS < 13
Browse files Browse the repository at this point in the history
This will add deprecation warning of old macOS users since we always
support latest 2 major release and 14.x and 13.x is already present.
Till now we also supported 12.x but this we should stop supporting so
this deprecation warning help user to prepare for it.
  • Loading branch information
praveenkumar authored and anjannath committed Feb 26, 2024
1 parent 764f90d commit 3f3acba
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 5 deletions.
7 changes: 7 additions & 0 deletions packaging/darwin/Distribution.in
Expand Up @@ -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;
}
</script>
Expand Down
12 changes: 12 additions & 0 deletions pkg/crc/preflight/preflight_checks_darwin.go
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}
12 changes: 12 additions & 0 deletions pkg/crc/preflight/preflight_darwin.go
Expand Up @@ -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{
{
Expand Down Expand Up @@ -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))
Expand Down
10 changes: 5 additions & 5 deletions pkg/crc/preflight/preflight_darwin_test.go
Expand Up @@ -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)
}

0 comments on commit 3f3acba

Please sign in to comment.