-
Notifications
You must be signed in to change notification settings - Fork 2
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
checkup: Introduce vmi under test configmap #219
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,15 +53,23 @@ const ( | |
terminationGracePeriodSeconds = 0 | ||
) | ||
|
||
func newVMIUnderTest(name string, checkupConfig config.Config) *kvcorev1.VirtualMachineInstance { | ||
func newVMIUnderTest(name string, checkupConfig config.Config, configMapName string) *kvcorev1.VirtualMachineInstance { | ||
const ( | ||
configDiskSerial = "DEADBEEF" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please consider increasing the scope of the original There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see a reason to do that, It would imply that it is connected somehow.. |
||
configVolumeName = "vmi-under-test-config" | ||
) | ||
|
||
optionsToApply := baseOptions(checkupConfig) | ||
|
||
optionsToApply = append(optionsToApply, | ||
vmi.WithAffinity(Affinity(checkupConfig.VMUnderTestTargetNodeName, checkupConfig.PodUID)), | ||
vmi.WithSRIOVInterface(eastNetworkName, checkupConfig.VMUnderTestEastMacAddress.String(), config.VMIEastNICPCIAddress), | ||
vmi.WithSRIOVInterface(westNetworkName, checkupConfig.VMUnderTestWestMacAddress.String(), config.VMIWestNICPCIAddress), | ||
vmi.WithContainerDisk(rootDiskName, checkupConfig.VMUnderTestContainerDiskImage), | ||
vmi.WithCloudInitNoCloudVolume(cloudInitDiskName, CloudInit(config.VMIUsername, config.VMIPassword, nil)), | ||
vmi.WithCloudInitNoCloudVolume(cloudInitDiskName, | ||
CloudInit(config.VMIUsername, config.VMIPassword, vmiUnderTestBootCommands(configDiskSerial))), | ||
vmi.WithConfigMapVolume(configVolumeName, configMapName), | ||
vmi.WithConfigMapDisk(configVolumeName, configDiskSerial), | ||
Comment on lines
+71
to
+72
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This part could potentially be moved to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought about it, but ended up not liking the fact that part of the configmap is loaded on the base function, and part here. It makes it less understood. WDYT? |
||
) | ||
|
||
return vmi.New(name, optionsToApply...) | ||
|
@@ -156,3 +164,12 @@ func trafficGenBootCommands(configDiskSerial string) []string { | |
fmt.Sprintf("cp %s/*.py %s", configMountDirectory, trex.StreamsPyPath), | ||
} | ||
} | ||
|
||
func vmiUnderTestBootCommands(configDiskSerial string) []string { | ||
const configMountDirectory = "/mnt/app-config" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please consider increasing the scope of the existing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't need it anywhere else. Everything is copied from this dir to where it will actually be executed. |
||
|
||
return []string{ | ||
fmt.Sprintf("mkdir %s", configMountDirectory), | ||
fmt.Sprintf("mount /dev/$(lsblk --nodeps -no name,serial | grep %s | cut -f1 -d' ') %s", configDiskSerial, configMountDirectory), | ||
} | ||
} |
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.
This function is a duplicate of
trafficGenConfigMapName()
, please consider adjusting the signature oftrafficGenConfigMapName
and using a single function for both uses.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.
Let's do it in a later PR