Skip to content

Instantly share code, notes, and snippets.

@gbraad
Last active May 13, 2022 04:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gbraad/ab07131c0054abf2a0d5aa729454eb9c to your computer and use it in GitHub Desktop.
Save gbraad/ab07131c0054abf2a0d5aa729454eb9c to your computer and use it in GitHub Desktop.

Changes to the installation flow

Summary

The accepted installation flow might be inadequate for future use with OpenShift Local, therefore an alternative is proposed for this use.

Detail

Because of postponing the MSI installation phase to the provider, the reboot that is necessary to activate the hypervisor, won't happen until after the application has fully started and when the provider is activated. At that point you can't easily determine if the hypervisor is installed and operational, as this is a privileged function (needs admin).

At that point you can't easily determine if the hypervisor is installed and operational, as this is a privileged function (needs admin).

For CRC I will look into an alternative flow. Probably by using the Burn bootstrapper for MSI, and therefore treat certain parts as a library for when OpenShift Local has to be delivered.

I summarized this in the following diagrams.

MSI flow

This is the flow as CRC performs, which makes sure the requirements are setup during the privileged phase. We also enforce the use non-Home editions of Windows.

sequenceDiagram
    rect rgb(200, 0, 0)
        note right of User: Installation
        User->>+Installer: Double clicks installer
        System-->>System: Privilege escalation
        Installer->>+System: Install hypervisor (Hyper-V)
        note right of Installer: Additional privileged actions
        Installer->>+System: Store program files
        System-->>System: reboot
        note right of System: only when reboot is needed ask user
    end
    rect rgb(30, 120, 30)
        note right of User: Application start
        rect rgb(30, 30, 140)
            User-->>Desktop app: Start Desktop app application
            note right of Desktop app: check if onboarding needed
            Desktop app->>+crc: `crc setup --check-only`
            note right of crc: Pre-flight checks
            crc-->>-Desktop app: return if needed
            rect rgb(130, 130, 130)
                note right of User: First start or update
                User->>Desktop app: Dialog confirm
                Desktop app-->>+crc: Initiate `crc setup`
                note right of crc: Pre-flight fixes
                crc->>+System: Download system bundle
                System-->>-crc: Download finished
                crc-->>-Desktop app: Setup Finished
            end
        end
    end

Note: Docker Desktop does something similar with a custom .NET application as the installer and Rancher Desktop using as I believe NSIS. Requirements are set up during the installation phase (although can be ignored, but usage will fail).

Delayed MSI installation

Here the user will only be shown the need to install virtualization in a late stage of the use. Here the assumption is that WSL2/Hyper-V is already installed on the machine. If not, the user will have to reboot during usage.

sequenceDiagram
    rect rgb(200, 0, 0)
        note right of User: Installation
        User->>+Installer: Double clicks installer
        System-->>System: Privilege escalation
        Installer->>+System: Store program files
    end
    rect rgb(30, 120, 30)
        note right of User: Application start
        rect rgb(30, 30, 140)
            User-->>Desktop app: Start Desktop app application
            note right of Desktop app: check if onboarding needed
            Desktop app->>+Installer: Start MSI
            rect rgb(200,0,0)
                System-->>System: Privilege escalation
                Installer->>+System: Install hypervisor (Hyper-V)
                System-->>System: reboot
            end
            rect rgb(200, 0, 0)
                note right of Desktop app: provider remains unusable until rebooted
            end
            rect rgb(130, 130, 130)
                note right of User: First start or update
                User->>Desktop app: Dialog confirm
                Desktop app-->>+crc: Initiate `crc setup`
                note right of crc: Pre-flight fixes
                crc->>+System: Download system bundle
                System-->>-crc: Download finished
                crc-->>-Desktop app: Setup Finished
            end
        end
            rect rgb(200, 0, 0)
                note right of Desktop app: provider remains unusable until rebooted
            end
    end

Alternative approach

This approach is an alternative that OpenShift Local could follow to perform the necessary setup steps before the use of the application.

sequenceDiagram
    rect rgb(200, 0, 0)
        note right of User: OpenShift Local Installation
        User->>+Installer: Double clicks installer
        System-->>System: Privilege escalation
        rect rgb(0,0,200)
            Installer->>+Desktop installer: Setup Podman Desktop
            Desktop installer->>+System: Store program files
        end
        rect rgb(0,200,0)
            Installer->>+CRC installer: Setup CRC backend
            CRC installer->>+System: Install hypervisor (Hyper-V)
            note right of CRC installer: Additional privileged actions
            CRC installer->>+System: Setup network stack
            CRC installer->>+System: Add user to CRC users group
            CRC installer->>+System: Store program files
            System-->>System: reboot
            note right of System: only when reboot is needed ask user
        end
    end
    rect rgb(30, 120, 30)
        note right of User: Application start
        rect rgb(30, 30, 140)
            User-->>Desktop app: Start Desktop app application
            note right of Desktop app: check if onboarding needed
            Desktop app->>+crc: `crc setup --check-only`
            note right of crc: Pre-flight checks
            crc-->>-Desktop app: return if needed
            rect rgb(130, 130, 130)
                note right of User: First start or update
                User->>Desktop app: Dialog confirm
                Desktop app-->>+crc: Initiate `crc setup`
                note right of crc: Pre-flight fixes
                crc->>+System: Download system bundle
                System-->>-crc: Download finished
                crc-->>-Desktop app: Setup Finished
            end
        end
    end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment