Skip to content

Commit 3f3acba

Browse files
praveenkumaranjannath
authored andcommitted
Add deprecation warning in case user are on macOS < 13
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.
1 parent 764f90d commit 3f3acba

File tree

4 files changed

+36
-5
lines changed

4 files changed

+36
-5
lines changed

packaging/darwin/Distribution.in

+7
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ function installCheck() {
2626
my.result.type = 'Fatal';
2727
return false;
2828
}
29+
30+
if(!(system.compareVersions(system.version.ProductVersion, '13.0.0') >= 0)) {
31+
my.result.title = 'Deprecation warning';
32+
my.result.message = 'This version of macOS is going to be unsupported for Red Hat OpenShift Local, Please update to macOS 13 or newer';
33+
my.result.type = 'Warning';
34+
return true;
35+
}
2936
return true;
3037
}
3138
</script>

pkg/crc/preflight/preflight_checks_darwin.go

+12
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"github.com/crc-org/crc/v2/pkg/crc/machine/vfkit"
1616
"github.com/crc-org/crc/v2/pkg/crc/version"
1717
crcos "github.com/crc-org/crc/v2/pkg/os"
18+
"github.com/crc-org/crc/v2/pkg/os/darwin"
1819
"github.com/crc-org/crc/v2/pkg/os/darwin/launchd"
1920
"github.com/klauspost/cpuid/v2"
2021
"golang.org/x/sys/unix"
@@ -224,3 +225,14 @@ func fixPlistFileExists(agentConfig launchd.AgentConfig) error {
224225
}
225226
return waitForDaemonRunning()
226227
}
228+
229+
func deprecationNotice() error {
230+
supports, err := darwin.AtLeast("13.0.0")
231+
if err != nil {
232+
return err
233+
}
234+
if !supports {
235+
logging.Warnf("This version of macOS is going to be unsupported for CRC, Please update to macOS 13 or newer")
236+
}
237+
return nil
238+
}

pkg/crc/preflight/preflight_darwin.go

+12
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,17 @@ import (
1010
"github.com/crc-org/crc/v2/pkg/os/darwin/launchd"
1111
)
1212

13+
// Deprecate warning for older version of mac<13.x
14+
var deprecationWarning = Check{
15+
configKeySuffix: "check-mac-version",
16+
checkDescription: "Checking if running macOS version >= 13.x",
17+
check: deprecationNotice,
18+
fixDescription: "This version of macOS is going to be unsupported on CRC",
19+
flags: NoFix,
20+
21+
labels: labels{Os: Darwin},
22+
}
23+
1324
// SetupHost performs the prerequisite checks and setups the host to run the cluster
1425
var vfkitPreflightChecks = []Check{
1526
{
@@ -105,6 +116,7 @@ func getAllPreflightChecks() []Check {
105116
func getChecks(_ network.Mode, bundlePath string, preset crcpreset.Preset, enableBundleQuayFallback bool) []Check {
106117
checks := []Check{}
107118

119+
checks = append(checks, deprecationWarning)
108120
checks = append(checks, nonWinPreflightChecks...)
109121
checks = append(checks, genericPreflightChecks(preset)...)
110122
checks = append(checks, memoryCheck(preset))

pkg/crc/preflight/preflight_darwin_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ import (
1313
func TestCountConfigurationOptions(t *testing.T) {
1414
cfg := config.New(config.NewEmptyInMemoryStorage(), config.NewEmptyInMemorySecretStorage())
1515
RegisterSettings(cfg)
16-
assert.Len(t, cfg.AllConfigs(), 12)
16+
assert.Len(t, cfg.AllConfigs(), 13)
1717
}
1818

1919
func TestCountPreflights(t *testing.T) {
20-
assert.Len(t, getPreflightChecks(true, network.SystemNetworkingMode, constants.GetDefaultBundlePath(preset.OpenShift), preset.OpenShift, false), 18)
21-
assert.Len(t, getPreflightChecks(true, network.SystemNetworkingMode, constants.GetDefaultBundlePath(preset.OpenShift), preset.OpenShift, false), 18)
20+
assert.Len(t, getPreflightChecks(true, network.SystemNetworkingMode, constants.GetDefaultBundlePath(preset.OpenShift), preset.OpenShift, false), 19)
21+
assert.Len(t, getPreflightChecks(true, network.SystemNetworkingMode, constants.GetDefaultBundlePath(preset.OpenShift), preset.OpenShift, false), 19)
2222

23-
assert.Len(t, getPreflightChecks(true, network.UserNetworkingMode, constants.GetDefaultBundlePath(preset.OpenShift), preset.OpenShift, false), 17)
24-
assert.Len(t, getPreflightChecks(true, network.UserNetworkingMode, constants.GetDefaultBundlePath(preset.OpenShift), preset.OpenShift, false), 17)
23+
assert.Len(t, getPreflightChecks(true, network.UserNetworkingMode, constants.GetDefaultBundlePath(preset.OpenShift), preset.OpenShift, false), 18)
24+
assert.Len(t, getPreflightChecks(true, network.UserNetworkingMode, constants.GetDefaultBundlePath(preset.OpenShift), preset.OpenShift, false), 18)
2525
}

0 commit comments

Comments
 (0)