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

e2e, persistent-ip: Add primary-UDN tests #71

Closed
wants to merge 4 commits into from

Conversation

RamLavi
Copy link
Contributor

@RamLavi RamLavi commented Sep 26, 2024

What this PR does / why we need it:
This PR adds the needed tests needed in order to cover ipam-extentions operation on VMI/VMs using primary-UDN.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

Release note:

NONE

@kubevirt-bot kubevirt-bot added the dco-signoff: yes Indicates the PR's author has DCO signed all their commits. label Sep 26, 2024
@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign qinqon for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@RamLavi
Copy link
Contributor Author

RamLavi commented Sep 26, 2024

Added commit to prevent the e2e from failing on restart scenario.
@qinqon perhaps this is also needed in the secondary case?

@@ -116,6 +116,8 @@ var _ = Describe("Persistent IPs on Primary UDN interface", func() {
WithTimeout(5 * time.Minute).
Should(testenv.ContainConditionVMIReady())

Expect(testenv.Client.Get(context.Background(), client.ObjectKeyFromObject(vmi), vmi)).To(Succeed())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please consider making it part of the Eventually block
(also on the other places)
this what we are usually on kubevirt fwiw

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need eventually, because this call is right after we wait for the VMI to be ready

Copy link
Collaborator

@oshoval oshoval Sep 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you already fetch the latest vmi as part of ThisVMI in the Eventually above (implicit Eventually happens for what you need)
so you can just set & use that value externally

func ThisVMI(vmi *kubevirtv1.VirtualMachineInstance) func() (*kubevirtv1.VirtualMachineInstance, error) {
	return func() (p *kubevirtv1.VirtualMachineInstance, err error) {
		p = &kubevirtv1.VirtualMachineInstance{}
		err = Client.Get(context.Background(), client.ObjectKeyFromObject(vmi), p)
		if apierrors.IsNotFound(err) {
			return nil, nil
		}
		return
	}
}

Copy link
Contributor Author

@RamLavi RamLavi Sep 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

true, but this change has bigger scope than what I want to achieve in this PR.
What my last commit is doing is only aligning the behavior to what is done in other tests..

But we should definitely should do it on a follow up PR (change ThisVMI + remove all the "fetch" that is used before the assertion)

Copy link
Collaborator

@oshoval oshoval Sep 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

honestly i dont understand why to not add
vmi = testenv.ThisVMI(vmi) in the first line of the Eventually
(returning vmi in the func of it etc as we do on kubevirt)

iiuc this all what needed instead those additional lines, and imho better

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I intend to do so, but in a larger scope, in a follow up PR

@oshoval
Copy link
Collaborator

oshoval commented Sep 26, 2024

Added commit to prevent the e2e from failing on restart scenario. @qinqon perhaps this is also needed in the secondary case?

for now they are stable, i wouldnt suggest to add unless we see either by code reading or by a failure that it is really needed
not sure if the exact code / flow is there (well you know better as you derived from there)

@RamLavi
Copy link
Contributor Author

RamLavi commented Sep 26, 2024

Added commit to prevent the e2e from failing on restart scenario. @qinqon perhaps this is also needed in the secondary case?

for now they are stable, i wouldnt suggest to add unless we see either by code reading or by a failure that it is really needed not sure if the exact code / flow is there (well you know better as you derived from there)

ah no no ... my bad. I need to just squash that commit with the former.. The issue cannot happen in the secondary case.

This will enable the network-segmentation feature on OVNK, needed in
order to run VM workloads with primary UDN.

Signed-off-by: Ram Lavi <[email protected]>
Currently GenerateLayer2WithSubnetNAD is creating NADs for secondary
roles (which is the default).
Add role input param to the function in order to support primary role
that will be used in future commits.

Signed-off-by: Ram Lavi <[email protected]>
This is done to differentiate this test from the primary udn tests that
will be added in future commits.

Signed-off-by: Ram Lavi <[email protected]>
@RamLavi
Copy link
Contributor Author

RamLavi commented Sep 26, 2024

Change: Rebase

These tests run practically the same tests as in secondary interfaces,
with a few semantic changes:
- networkInterfaceName is 'ovn-udn1'
- VMI is created with primary UDN
- NAD is created with role: Primary
- interface IPS are extracted using network-status annotation, and not
vmi.status as that is not yet supported for primaryUDN.

Signed-off-by: Ram Lavi <[email protected]>
@qinqon
Copy link
Collaborator

qinqon commented Sep 30, 2024

@RamLavi let's refactor current tests a little to parameterize role and VM's interface (so we can pass the proper primary UDN network binding).

@RamLavi
Copy link
Contributor Author

RamLavi commented Oct 1, 2024

closing in favor of #72

@RamLavi RamLavi closed this Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dco-signoff: yes Indicates the PR's author has DCO signed all their commits. size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants