Skip to content

Commit

Permalink
Added support for specifying the image that is used by multipass (#3796)
Browse files Browse the repository at this point in the history
Co-authored-by: Derek Ruths <[email protected]>
  • Loading branch information
druths and Derek Ruths authored Mar 21, 2023
1 parent f260f3d commit 20ec6d5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion installer/cli/microk8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def show_help():
--help Show this message and exit.
Commands:
install Installs MicroK8s. Use --cpu, --mem, --disk and --channel to configure your setup.
install Installs MicroK8s. Use --cpu, --mem, --disk, --channel, and --image to configure your setup.
uninstall Removes MicroK8s"""
click.echo(msg)
commands = _get_microk8s_commands()
Expand All @@ -112,6 +112,7 @@ def _show_install_help():
--mem RAM in GB used by MicroK8s (default={definitions.DEFAULT_MEMORY_GB}, min={definitions.MIN_MEMORY_GB})
--disk Max volume in GB of the dynamically expandable hard disk to be used (default={definitions.DEFAULT_DISK_GB}, min={definitions.MIN_DISK_GB})
--channel Kubernetes version to install (default={definitions.DEFAULT_CHANNEL})
--image Ubuntu version to install (default={definitions.DEFAULT_IMAGE})
-y, --assume-yes Automatic yes to prompts""" # noqa
Echo.info(msg)

Expand Down Expand Up @@ -156,6 +157,7 @@ def install(args) -> None:
parser.add_argument("--mem", default=definitions.DEFAULT_MEMORY_GB, type=memory)
parser.add_argument("--disk", default=definitions.DEFAULT_DISK_GB, type=disk)
parser.add_argument("--channel", default=definitions.DEFAULT_CHANNEL, type=str)
parser.add_argument("--image", default=definitions.DEFAULT_IMAGE, type=str)
parser.add_argument(
"-y", "--assume-yes", action="store_true", default=definitions.DEFAULT_ASSUME
)
Expand Down
1 change: 1 addition & 0 deletions installer/common/definitions.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
DEFAULT_DISK_GB: int = 50
DEFAULT_ASSUME: bool = False
DEFAULT_CHANNEL: str = "1.26/stable"
DEFAULT_IMAGE: str = "18.04"

MIN_CORES: int = 2
MIN_MEMORY_GB: int = 2
Expand Down
3 changes: 2 additions & 1 deletion installer/vm_providers/_multipass/_multipass.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ def run(self, command: Sequence[str], hide_output: bool = False) -> Optional[byt
)

def _launch(self, specs: Dict) -> None:
image = "18.04"

# prepare core launch setting
image = specs["image"]
cpus = "{}".format(specs["cpu"])
mem = "{}G".format(specs["mem"])
disk = "{}G".format(specs["disk"])
Expand Down

0 comments on commit 20ec6d5

Please sign in to comment.