-
Notifications
You must be signed in to change notification settings - Fork 35
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
MTV-1388 | Add dynamic way to specify the virt-customize #1017
Conversation
47b461a
to
84c9642
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1017 +/- ##
==========================================
- Coverage 16.43% 16.41% -0.03%
==========================================
Files 107 108 +1
Lines 19642 19723 +81
==========================================
+ Hits 3229 3238 +9
- Misses 16126 16195 +69
- Partials 287 290 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #1017 +/- ##
==========================================
- Coverage 16.34% 16.25% -0.10%
==========================================
Files 110 111 +1
Lines 19645 19750 +105
==========================================
- Hits 3211 3210 -1
- Misses 16154 16259 +105
- Partials 280 281 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
a963aa1
to
da23443
Compare
3ed9a8e
to
b178e95
Compare
Issue: Right now all the run/firstboot scripts are located inside the conversion pod. To get new scripts to the users we need some alternative way to allow users to specify the scripts themselves. This will speed up the migration process as the users won't need to wait for the build and release of the patch. Additionally, the users themselves can tweak the scripts depending on their needs. Design: We have two options use the config maps, mount it to the container and read the mounted directory depending on their name we do virt-customize with them. An alternative solution would be to create CRD with all configurations such as `action`, `path` etc. I have chosen first as this is needed as soon as possible. User flow: 1. The user needs to create a config map inside the namespace where they want to migrate the VM. The config map needs to be named `mtv-virt-customize`. 2. Inside the configmap user can specify data with key/value definition. The value is script itself which they want to run. The key needs to follow regex `^([0-9]+_win_firstboot(([\w\-]*).ps1))$` or `^([0-9]+_linux_(run|firstboot)(([\w\-]*).sh))$` depending on where the customer wants the script to run. For example `00_win_firstboot_test.ps1` will specify that the data should be interpreted as PowerShell script which should start at boot. Alternatively, the Linux option has not only the `firstboot` but also the `run` option. This will be applied on the VM after virt-v2v conversion, but before the VM is started. Note: The number in the begining of the key sets the order. Conversion pod flow: 1. The `forklift-controller` checks if there is a config map inside the namespace. If the config map is present it is automatically mounted to the conversion pod at `/mnt/dynamic_scripts`. 2. The conversion pod checks if the `/mnt/dynamic_scripts` directory is present and if it is, it checks the files and their regexes. Depending on the VM operating system it will use different. From the filename the conversion pod determines the action required on the `virt-customize` step. Additional changes: - I have moved the static variables into a single file as we are using more and more and it's hard to keep track. - New batch file which will run all PowerShell scripts inside the windows first boot scripts dir. Signed-off-by: Martin Necas <[email protected]>
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Hi @jsakil14, The config looks correct which version of forklift are you using? |
Don't rebuild anything, but use the latest images from https://quay.io/organization/kubev2v/ |
you can replace the image in the CSV and the operator will do the rest |
you are correct only in the admin cluster, from there we create the pods on the remote clusters, but the configurations and images are specified in the master |
@mnecas question reg-configmap - Can I have both linux & windows scripts in a single CM? will the v2v pick up the right one based on the OS flavour? |
Issue:
Right now all the run/firstboot scripts are located inside the conversion pod. To get new scripts to the users we need some alternative way to allow users to specify the scripts themselves. This will speed up the migration process as the users won't need to wait for the build and release of the patch. Additionally, the users themselves can tweak the scripts depending on their needs.
Design:
We have two options use the config maps, mount it to the container and read the mounted directory depending on their name we do virt-customize with them. An alternative solution would be to create CRD with all configurations such as
action
,path
etc. I have chosen first as this is needed as soon as possible and configmaps are faster to implement.User flow:
The user needs to create a config map inside the namespace where they want to migrate the VM. The config map needs to be named
forklift-virt-customize
.Inside the configmap user can specify data with key/value definition. The value is the script itself which they want to run. The key needs to follow regex
([0-9]+_win_firstboot(([\w\-]*).ps1))$
or^([0-9]+_linux_(run|firstboot)(([\w\-]*).sh))$
depending on where the customer wants the script to run.For example
00_win_firstboot_test.ps1
will specify that the data should be interpreted as PowerShell script which should start at boot. Alternatively, the Linux option has not only thefirstboot
but also therun
option. This will be applied on the VM after virt-v2v conversion, but before the VM is started.Note: The number in the beginning of the key sets the order.
Conversion pod flow:
forklift-controller
checks if there is a config map inside the namespace. If the config map is present it is automatically mounted to the conversion pod at/mnt/dynamic_scripts
./mnt/dynamic_scripts
directory is present and if it is, it checks the files and their regexes.virt-customize
step.Additional changes:
virt_customize_configmap_name