Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement changing instance type #248

Open
WilliamMcCumstie opened this issue Jul 16, 2019 · 1 comment
Open

Implement changing instance type #248

WilliamMcCumstie opened this issue Jul 16, 2019 · 1 comment

Comments

@WilliamMcCumstie
Copy link
Contributor

When deploying a node, it will spin up with the instance given by the template. However this requires spinning up large (expensive) instances during testing. Instead the ability to spin up a cheap (small) instance for testing is desirable.

This requires the following steps:

  1. The change_instance_type method
    This needs to be implemented in three places:
Cloudware::Provider::Base::Machine#change_instance_type => raise NotImplementedError
Cloudware::Provider::AWSInterface::Machine#change_instance_type => aws implementation
Cloudware::Provider::AzureInterface::Machine#change_instance_type => azure implementation
  1. This method then needs to be hooked into the Models::Machine or Models::Node. See Remove tagging and Models::Machine #247 for details. For consistency, it should be implemented on Models::Machine until it is removed.

  2. A instance_type field needs to be added to Models::Node. This records what the instance should be at the end of deploy

  3. When the Models::Node#deploy method is called, it should fire the template off to the provider. Hang for a response, and then initiate the instance type modify. The instance_type should be obeyed on deploy!.

  4. A modify-type command needs to be added to the CLI, similar to the power commands. It should work with both a single and group of nodes.

@ColonelPanics
Copy link
Member

A few thoughts on usability/user-facing implementation are below but I am open to other ideas for getting this to work

General Specs

  • Set/change instance type of nodes
    • Set at deploy time (e.g. flight cloud deploy node01 --instance-type c4.large or flight cloud deploy node01 -p "instance-type=c4.large")
    • Modify running instances (e.g. flight cloud modify node01 --instance-type c4.large)
    • Potentially use instance type maps for provider-agnostic names and consistency of CLI
  • Display available instance types
    • Could be provider-specific or a generic map of names (e.g. compute.large would be platform-generic instance type)
  • Limit available instance types by group

Instance Type as Parameter

  • Can specify instance type on deploy/create (%instancetype%)
  • Modify instance type updates metadata parameter value for instance type for consistency's sake

Instance Type Map

  • Consistent instance type names between providers
  • More human readable, clearer to end-user what they're using
  • Allows for group restriction/whitelisting
compute:
  tiny: 
    aws: 'c4.large'
    azure: 'Standard_F2s'
    groups: 'login,nodes,compute,all'
  small:
    aws: 'c4.xlarge'
    azure: 'Standard_F4s'
    groups: 'login,nodes,compute,all'
  medium:
    aws: 'c4.2xlarge'
    azure: 'Standard_F8s'
    groups: 'login,nodes,compute,all'
  large:
    aws: 'c4.4xlarge'
    azure: 'Standard_F16s'
    groups: 'login,nodes,compute,all'
  xlarge:
    aws: 'c4.8xlarge'
    azure: 'Standard_F32s'
    groups: 'login,nodes,compute,all'
gpu:
  small:
    aws: 'p3.2xlarge'
    azure: 'Standard_NC6'
    groups: 'login'
  medium:
    aws: 'p3.8xlarge'
    azure: 'Standard_NC12'
    groups: 'login'
  large:
    aws: 'p3.16xlarge'
    azure: 'Standard_NC24'
    groups: 'login'

Interactive Selection

  • Very useful for cloud-client usage of modification
  • Only show available/allowed instances for node
> flight modify node01
Instance type:
- Compute Tiny (c4.large) <
- Compute Small (c4.xlarge)
- Compute Medium (c4.2xlarge)
- Compute Large (c4.4xlarge)
- Compute Xlarge (c4.8xlarge)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants