From 81eb68cce1c37ddf0eb0ff6db671aa78ebc90bf1 Mon Sep 17 00:00:00 2001 From: vyasgun Date: Mon, 5 Feb 2024 16:05:08 +0530 Subject: [PATCH] deprecated preset: add warning for podman preset during and commands --- cmd/crc/cmd/start.go | 4 ++++ pkg/crc/config/callbacks.go | 8 +++++++- pkg/crc/preset/preset.go | 5 +++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/cmd/crc/cmd/start.go b/cmd/crc/cmd/start.go index c2c367b01d..33a2cb83ac 100644 --- a/cmd/crc/cmd/start.go +++ b/cmd/crc/cmd/start.go @@ -87,6 +87,10 @@ func runStart(ctx context.Context) (*types.StartResult, error) { EnableBundleQuayFallback: config.Get(crcConfig.EnableBundleQuayFallback).AsBool(), } + if startConfig.Preset == preset.Podman { + logging.Warn(preset.PodmanDeprecatedWarning) + } + client := newMachine() isRunning, _ := client.IsRunning() diff --git a/pkg/crc/config/callbacks.go b/pkg/crc/config/callbacks.go index 2beb9ef697..5d3ab7f142 100644 --- a/pkg/crc/config/callbacks.go +++ b/pkg/crc/config/callbacks.go @@ -5,6 +5,8 @@ import ( "path/filepath" "github.com/crc-org/crc/v2/pkg/crc/constants" + "github.com/crc-org/crc/v2/pkg/crc/logging" + "github.com/crc-org/crc/v2/pkg/crc/preset" "github.com/crc-org/crc/v2/pkg/os" "github.com/spf13/cast" ) @@ -21,7 +23,11 @@ func RequiresDeleteMsg(key string, _ interface{}) string { "delete the CRC instance with 'crc delete' and start it with 'crc start'.", key) } -func RequiresDeleteAndSetupMsg(key string, _ interface{}) string { +func RequiresDeleteAndSetupMsg(key string, value interface{}) string { + + if key == Preset && value == string(preset.Podman) { + logging.Warn(preset.PodmanDeprecatedWarning) + } // since we cannot easily import the machine package here to check for existence of the CRC vm // we rely on the existence of the machine config file to determine if a VM exists if os.FileExists(filepath.Join(constants.MachineInstanceDir, "crc", "config.json")) { diff --git a/pkg/crc/preset/preset.go b/pkg/crc/preset/preset.go index 72944e08b4..65ed30373e 100644 --- a/pkg/crc/preset/preset.go +++ b/pkg/crc/preset/preset.go @@ -22,6 +22,11 @@ var presetMap = map[Preset]string{ Microshift: string(Microshift), } +const ( + PodmanDeprecatedWarning = "The Podman preset is deprecated and will be removed in a future release. Consider" + + " rather using a Podman Machine managed by Podman Desktop: https://podman-desktop.io" +) + func AllPresets() []Preset { var keys []Preset for k := range presetMap {