Skip to content

Commit

Permalink
deprecated preset: add warning for podman preset during and commands
Browse files Browse the repository at this point in the history
  • Loading branch information
vyasgun authored and praveenkumar committed Feb 6, 2024
1 parent f9b75fd commit 81eb68c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cmd/crc/cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
8 changes: 7 additions & 1 deletion pkg/crc/config/callbacks.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand All @@ -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")) {
Expand Down
5 changes: 5 additions & 0 deletions pkg/crc/preset/preset.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 81eb68c

Please sign in to comment.