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

Add network peering status #217

Merged
merged 2 commits into from
May 2, 2024
Merged

Add network peering status #217

merged 2 commits into from
May 2, 2024

Conversation

ushabelgur
Copy link
Contributor

Proposed Changes

  • Add Network peering status field
  • Modify network controller to logic to update Network peering status information
  • Add tests for network peering status
  • Refactor peering logic to process all the peered VNIs in a loop instead of returning for single vni error
  • Update docs

Fixes #189

@ushabelgur ushabelgur requested a review from a team as a code owner April 24, 2024 09:28
@ushabelgur ushabelgur requested review from afritzler and removed request for a team April 24, 2024 09:28
@github-actions github-actions bot added size/L documentation Improvements or additions to documentation enhancement New feature or request labels Apr 24, 2024
@ushabelgur ushabelgur requested a review from guvenc April 24, 2024 09:28
@ushabelgur ushabelgur self-assigned this Apr 26, 2024
@ushabelgur ushabelgur requested a review from a team April 26, 2024 05:47
Copy link
Collaborator

@guvenc guvenc left a comment

Choose a reason for hiding this comment

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

Thanks. This is already in pretty good shape. I have a suggestion to increase test coverage of the newly added feature.

ID: network.Spec.ID,
State: metalnetv1alpha1.NetworkPeeringStateReady,
}))))

Copy link
Collaborator

Choose a reason for hiding this comment

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

In order to exercise a bit more of the newly added functionality. Can we also remove the peering and check the status was correctly updated ?
If a peering is removed then the status will completely disappear right ? So that expectation can be tested here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done added test case for peering removal case.

@github-actions github-actions bot added size/XL and removed size/L labels Apr 26, 2024
@ushabelgur ushabelgur marked this pull request as draft April 26, 2024 12:25
@ushabelgur ushabelgur force-pushed the enh/network_peering_status branch 4 times, most recently from ab6a515 to d42d42c Compare April 26, 2024 13:07

Expect(networkReconcile(ctx, *network)).To(Succeed())

By("defining NetworkInterface object to use created network")
Copy link
Member

Choose a reason for hiding this comment

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

Do we really need to create a NetworkInterface for the peering test?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes we need it, this is the reply i had got from guvence: We need to create at least one NetworkInterface or LoadBalancer in the network/VNI then only ownVniAvail becomes true. If there is no object in the Network/VNI on that dpservice then there is nothing to peer.

Expect(networkReconcile(ctx, *network2)).To(Succeed())

By("defining a new NetworkInterface object to use created network")
networkInterface2 := &metalnetv1alpha1.NetworkInterface{
Copy link
Member

Choose a reason for hiding this comment

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

Same as above.

controllers/network_controller.go Outdated Show resolved Hide resolved
func (r *NetworkReconciler) patchStatus(ctx context.Context, network *metalnetv1alpha1.Network, mutate func()) error {
base := network.DeepCopy()

mutate()
Copy link
Member

Choose a reason for hiding this comment

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

What is the purpose of this mutate() function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It it just calling the function we are passing as a parameter to this PatchStatus method(Basically updating status)

r.patchStatus(ctx, network, func() { network.Status.Peerings = newStatusPeerings });
Just to keep it consistent with other parts of the metalnet code, i have used patch method like, otherwise we can use our usual way of patching.

@ushabelgur ushabelgur force-pushed the enh/network_peering_status branch from d42d42c to 54a14b1 Compare April 29, 2024 06:04
@ushabelgur ushabelgur force-pushed the enh/network_peering_status branch from 54a14b1 to afabf60 Compare April 29, 2024 06:40
@ushabelgur ushabelgur marked this pull request as ready for review April 29, 2024 06:48
@ushabelgur ushabelgur requested review from guvenc and afritzler April 29, 2024 06:48
Copy link
Collaborator

@guvenc guvenc left a comment

Choose a reason for hiding this comment

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

Looks good to me now.
@afritzler Do you have smt to add ?

@guvenc guvenc merged commit b55083c into main May 2, 2024
7 checks passed
@guvenc guvenc deleted the enh/network_peering_status branch May 2, 2024 16:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Network peering status
3 participants