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

🐾 Add a "fast create plan" form #801

Closed
yaacov opened this issue Jan 2, 2024 · 25 comments
Closed

🐾 Add a "fast create plan" form #801

yaacov opened this issue Jan 2, 2024 · 25 comments
Assignees
Labels
enhancement Categorizes issue or PR as related to a new feature. plans
Milestone

Comments

@yaacov
Copy link
Member

yaacov commented Jan 2, 2024

Current state:
when creating a plan, a user need to use a multi step wizard

Issue:
a migration plan always start from choosing a list of vms to migrate from a source provider, it makes sense to add an option to "fast create" a plan from a source provider details page.

Fix:
add a button in the vms tab of source providers that will open a "fast create" from

@yaacov yaacov added the enhancement Categorizes issue or PR as related to a new feature. label Jan 2, 2024
@yaacov yaacov added this to the 2.6.0 milestone Jan 2, 2024
@yaacov
Copy link
Member Author

yaacov commented Jan 2, 2024

note:
first PR, adding option to sellect vms: #796

@yaacov
Copy link
Member Author

yaacov commented Jan 9, 2024

Update:
the form will take a
source provider - none editable
source vms list - none editable

target provider - default to this cluster, editable
target namespace - default to current namespace, editable

storage map - default to all source storage types mapped to "prefered storage class"
editable
network map - default to all networks mapped to "prefered NAD" TBD #821
editable

no hooks

[create ans start button] - will create a plan and start a migration
[create and customize button] - will create a plan and jump to details view with options to editing the mappings and hooks

@yaacov
Copy link
Member Author

yaacov commented Jan 9, 2024

Update II:
#821 - how to choose a "prefered NAD" when creating a network mapping default target

"preferred storage class" - is defined by an annotation on the storage class, if missing default to first storage class

@yaacov
Copy link
Member Author

yaacov commented Jan 14, 2024

Update:
#822 - implementing first step:

  • create a "create plan" page
  • fields for first step:
    • name: default to [name of source provider]-[short hash] with "pencil" icon for editing the name
    • source provider as a resource link with label
    • vms: [N] vms selected + info icon that will open a modal
      • modal with a table of seleced vms, table has same columns and filtes as vms table

first step:
- no need for description

second step:
- target provider selector, default to "host" provider, show the resource link, with a "pencil" icon to open modal to change the target
- target namespace selector, default to current namespace, show the resource link with a "pencil" icon to open modal to change the target

cc:// @rszwajko

@yaacov
Copy link
Member Author

yaacov commented Jan 14, 2024

third step:

  • create a component for editing maps, with an editable varied length list, for example see aditing pods in create deployment form, ( "deployments" -> "create deployment")

mapping-with-values

mapping-empty

forth step:
use the new component to add network and storage mappings,
in our case the default mappings will have the default lists (editable):

  • each source network will be mapped to default network
  • each source storage will be mapped to default storage

example hooks:

  • hook to get a list of source networks
  • hook to get a list of source storages
  • hook to get a list of target network
  • hook to get a list of target storages
  • hook to get default target storage
  • hood to get default target network

@yaacov
Copy link
Member Author

yaacov commented Jan 15, 2024

@liranr23 @ahadas hi, do you know what is the specific annotation/label on the storage class that we will use to find the "prefered" storage class ?

@yaacov
Copy link
Member Author

yaacov commented Jan 16, 2024

do you know what is the specific annotation/label on the storage class that we will use to find the "prefered" storage class ?

on the storageclass CR there is an annotation:

annotations:
    storageclass.kubevirt.io/is-default-virt-class: 'true'

@liranr23
Copy link
Member

i am not aware of anything from our end?
the default is storageclass.kubernetes.io/is-default-class: 'true' from my point of view. but maybe i am missing something.

@yaacov
Copy link
Member Author

yaacov commented Jan 16, 2024

but maybe i am missing something.

no, storageclass.kubernetes.io/is-default-class: 'true' is what was looking for

@yaacov
Copy link
Member Author

yaacov commented Jan 16, 2024

@rszwajko , hi,

about default NAD:

def get default network for virtualization():
  if we have NAD defined in target namespace of target cluster:
      return the first NAD sorted alphabetically.  
  else:
      return Pod network

cc:// @ahadas WDYT ^^ ?

@rszwajko
Copy link
Contributor

@yaacov @ahadas

about default NAD:

This heuristics may lead to security issues i.e. for VMs that should use specific networks.
IMHO if we need a default then let's use the Pod network. May prevent the VM from starting but seems safe.

@yaacov
Copy link
Member Author

yaacov commented Jan 16, 2024

@rszwajko ok, let's go with pod network, we can update the logic in later time

@yaacov
Copy link
Member Author

yaacov commented Jan 17, 2024

@rszwajko hi,

here is a screenshot from the "create deployment" page, the "create plan" should look and feel similar:
see: "Workloads -> Deployments -> Create Deployment"
form header and sections:
create-deployment

form section for creating a sub resource, like our mappings:
create-deployment-sub-recource

@yaacov
Copy link
Member Author

yaacov commented Jan 17, 2024

Notes:
a. In the case of deployment they implemented a yaml view, we can add it in some future
b. The added the name of the container above the container spec, it looks easy to implement in our case:
so we can add NetworkMap: [NP] name... above the mapping list input

p.s.
name of networkMap and storageMap (and hook that we will not create here) objects is the same as the plan name, no need to add "map" as postfix or suffix because it has a different kind, so no overlapping names

@yaacov yaacov changed the title Add a "fast create plan" form 🐾 Add a "fast create plan" form Jan 17, 2024
@yaacov yaacov added the plans label Jan 17, 2024
@yaacov
Copy link
Member Author

yaacov commented Jan 17, 2024

Note:
when editing the new plan name - remember to validate a valid k8s name + no plan with this name exist in this namespace

@yaacov
Copy link
Member Author

yaacov commented Jan 22, 2024

Ref: #690 - make sure all sources net and storage are mapped when creating the default mappings

@yaacov
Copy link
Member Author

yaacov commented Feb 1, 2024

Notes from demo for 2.6 milestone:
a. create a warning/error https://www.patternfly.org/components/alert when the mappings are re-set by changing the target.
b. create a warning/error for mappings we know are problematic:
- missing mappings for storage or network known to be used by vms
- empty mappings, even if the vms don't use any storage or mappings

@rszwajko
Copy link
Contributor

rszwajko commented Feb 6, 2024

@liranr23 @bennyz @ahadas @bkhizgiy
Below extra validations that we could implement to check the plan before creating. Please vote by giving thumbs up/down.

@rszwajko
Copy link
Contributor

rszwajko commented Feb 6, 2024

(error) Equivalent of VMNetworksNotMapped

@rszwajko
Copy link
Contributor

rszwajko commented Feb 6, 2024

(error) Equivalent of VMStorageNotMapped

@rszwajko
Copy link
Contributor

rszwajko commented Feb 6, 2024

(error) Equivalent of VMMultiplePodNetworkMappings

@rszwajko
Copy link
Contributor

rszwajko commented Feb 6, 2024

(error) Target namespace is the same as source namespace - a case where source provider and target provider are the same resource or point to the same environment (checked by comparing spec.url )

@liranr23
Copy link
Member

liranr23 commented Feb 6, 2024

(error) Target namespace is the same as source namespace - a case where source provider and target provider are the same resource or point to the same environment (checked by comparing spec.url )

is it even possible? i guess it's only OCP to OCP @bennyz

@rszwajko
Copy link
Contributor

rszwajko commented Feb 7, 2024

@liranr23

i guess it's only OCP to OCP

right. this is a special case of migrating VMs in the same k8s cluster (between different namespaces).

@yaacov
Copy link
Member Author

yaacov commented Feb 16, 2024

Addressed by #899

@yaacov yaacov closed this as completed Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Categorizes issue or PR as related to a new feature. plans
Projects
None yet
Development

No branches or pull requests

3 participants