-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
feat(virtctl,create): Add support for sysprep volumes #13053
Conversation
e6461a6
to
20bea69
Compare
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.
Looks good overall.
I'm wondering what's the added value of the e2e test actually
pkg/virtctl/create/vm/vm.go
Outdated
SysprepVolumeFlag = "volume-sysprep" | ||
|
||
SysprepDisk = "sysprepdisk" | ||
SysprepConfigMap = "configMap" | ||
SysprepSecret = "secret" |
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.
I wonder why all these const are exported...
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.
To make them reusable in vm_test.go
.
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.
e2e test should not use the productions const.
If something changes in the production code, we have to manually adjust the e2e test as well, without automatically inheriting them.
We should start decoupling them.
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.
vm_test.go
is the unit test file of vm.go
.
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.
Right! But I see it is also used in tests/create_vm
file
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.
Right! Well, we don't have any strict rules about this atm. But we should consider adding some to the coding conventions. For now I'd like to keep it.
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.
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.
Right, updated this PR to decouple SysprepDisk
in production and test code. Will update other places in virtctl in a follow up.
tests/virtctl/create_vm.go
Outdated
Expect(vm.Spec.RunStrategy).ToNot(BeNil()) | ||
Expect(*vm.Spec.RunStrategy).To(Equal(runStrategy)) |
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.
nit, use PointTo
instead of not be nil and check equality:
Expect(vm.Spec.RunStrategy).ToNot(BeNil()) | |
Expect(*vm.Spec.RunStrategy).To(Equal(runStrategy)) | |
Expect(vm.Spec.RunStrategy).To(PointTo... |
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.
TIL
tests/virtctl/create_vm.go
Outdated
Expect(vm.Spec.Template.Spec.TerminationGracePeriodSeconds).ToNot(BeNil()) | ||
Expect(*vm.Spec.Template.Spec.TerminationGracePeriodSeconds).To(Equal(terminationGracePeriod)) |
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.
same as above
To verify that the VM admitter is happy with the generated manifest. It uses DryRun so it does not create an actual VM. |
20bea69
to
364a9d4
Compare
/lgtm |
364a9d4
to
4f0e1b9
Compare
Looks good |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alicefr The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm |
Required labels detected, running phase 2 presubmits: |
Add support for specifying a sysprep volume to virtctl create vm by adding the --sysprep flag. Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
Add a test case for specifying a sysprep volume to the virtctl create vm functests. Signed-off-by: Felix Matouschek <fmatouschek@redhat.com>
4f0e1b9
to
6057cb0
Compare
/lgtm |
Required labels detected, running phase 2 presubmits: |
What this PR does
This adds support for specifying a sysprep volume to virtctl create vm by
adding the --sysprep flag. A test case for specifying a sysprep volume is
added to the virtctl create vm functests.
Before this PR:
Users cannot specify a sysprep volume in VMs created with virtctl create vm.
After this PR:
Users can now specify a sysprep volume in VMs created with virtctl create vm.
Fixes #
Why we need it and why it was done in this way
The following tradeoffs were made:
The following alternatives were considered:
Links to places where the discussion took place:
Special notes for your reviewer
Checklist
This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR.
Approvers are expected to review this list.
Release note