-
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
checkup: Introduce vmi under test configmap #219
Conversation
passes on CNV 4.15 cluster:
|
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.
Thank you for the PR @RamLavi.
Please see the inline comments.
func vmiUnderTestConfigMapName(suffix string) string { | ||
return vmiUnderTestConfigMapNamePrefix + "-" + suffix | ||
} |
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 of trafficGenConfigMapName
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
pkg/internal/checkup/checkup_test.go
Outdated
@@ -200,7 +200,7 @@ func TestTeardownShouldFailWhen(t *testing.T) { | |||
}) | |||
} | |||
|
|||
func TestTrafficGenCMTeardownFailure(t *testing.T) { | |||
func TestCMTeardownFailure(t *testing.T) { |
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.
WDYT about?
func TestCMTeardownFailure(t *testing.T) { | |
func TestVMConfigMapTeardownFailure(t *testing.T) { |
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.
DONE
vmi.WithConfigMapVolume(configVolumeName, configMapName), | ||
vmi.WithConfigMapDisk(configVolumeName, configDiskSerial), |
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 part could potentially be moved to baseOptions()
so it could be shared by the two VMIs.
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 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?
@@ -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 comment
The reason will be displayed to describe this comment to others. Learn more.
Please consider increasing the scope of the existing configMountDirectory
const, and share it between the functions.
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.
we don't need it anywhere else. Everything is copied from this dir to where it will actually be executed.
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Please consider increasing the scope of the original configDiskSerial
const, and share it between the VMIs.
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 don't see a reason to do that, It would imply that it is connected somehow..
Both VMIs have configmaps, both happen to have the same serial..
pkg/internal/checkup/checkup.go
Outdated
func (c *Checkup) createVMIUnderTestCM(ctx context.Context) error { | ||
log.Printf("Creating ConfigMap %q...", ObjectFullName(c.namespace, c.vmiUnderTestConfigMap.Name)) | ||
|
||
_, err := c.client.CreateConfigMap(ctx, c.namespace, c.vmiUnderTestConfigMap) | ||
return err | ||
} | ||
|
||
func (c *Checkup) deleteVMIUnderTestCM(ctx context.Context) error { | ||
log.Printf("Deleting ConfigMap %q...", ObjectFullName(c.namespace, c.vmiUnderTestConfigMap.Name)) | ||
|
||
return c.client.DeleteConfigMap(ctx, c.namespace, c.vmiUnderTestConfigMap.Name) | ||
} |
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.
Please consider adjusting the signatures of createTrafficGenCM
and deleteTrafficGenCM
so they could be shared between the two configMaps.
In a similar way to how createVMI
and deleteVMI
work.
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.
DONE
This commit adds a new configmap that will be consumed by the vmi-under-test in future commits. The create and delete configmap functions are generalized to accept both configmaps. The unit test is also generalized in order to include any configmap deleted/created. Signed-off-by: Ram Lavi <[email protected]>
Currently the configmap is mounted but has no data. Signed-off-by: Ram Lavi <[email protected]>
de93b0d
to
d63b317
Compare
|
This PR introduces a new configmap to the checkup, that will be consumed by the VMI-under-test VMI.
In future PRs this configmap will be used to insert scripts to the guest.