Update/streamline operations - #10
Conversation
This commit refactors most of the codebase, isolation several core logic into their own packages. The init command was added to ensure all dependencies are available. The create command was added to create microvms and the run command was added to run microvms.
| image, _ := cmd.Flags().GetString("image") | ||
|
|
||
| if len(image) == 0 { | ||
| return fmt.Errorf("image flag must be specified") |
There was a problem hiding this comment.
- might be wise not to tie the create command to only creating drives from OCI images. the constants are the fstype, size and name (or path to put it). whether we want an image burned into the loop drive should be optional
There was a problem hiding this comment.
Are you suggesting that we pull container images without making drives out of them?
| func MakeInitCmd() *cobra.Command { | ||
| command := &cobra.Command{ | ||
| Use: "init", | ||
| Short: "download assets if they don't exist", |
There was a problem hiding this comment.
- i don't think an init command should be downloading stuff from the internet. the name does not imply that, command should imply the action they perform, so pull/download will be better for things that pull from the internet. you know where my mind is at
There was a problem hiding this comment.
I agree. What name would you suggest though. The idea is that it's a command that makes sure that all dependencies are met
| } | ||
|
|
||
| initPath := filepath.Join(assetsDir, "init") | ||
| _, err = os.Stat(initPath) |
There was a problem hiding this comment.
there is a utils.Exists function
|
LGTM. great work bro |
|
LGTM bro otherwise, everything else lgtm as I mentioned. you should as well look into Joe's comments. I think he makes a good argument about whether or not having an image burned on the drive is optional (unless I'm missing some context) |
Addresses: #9
This commit refactors most of the codebase, isolation several core logic into their own packages. The init command was added to ensure all dependencies are available. The create command was added to create microvms and the run command was added to run microvms.
New commands
Init
This ensures all the dependencies are available
# spitfire initoutput:
Create
This command creates the microvm image from a container image
# spitfire create --image alpine:latest testspitfire create --init --image alpine:latest testRun
This command runs the microvm
# spitfire run <image name>