-
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
Add network peering status #217
Conversation
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.
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, | ||
})))) | ||
|
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.
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.
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 added test case for peering removal case.
ab6a515
to
d42d42c
Compare
|
||
Expect(networkReconcile(ctx, *network)).To(Succeed()) | ||
|
||
By("defining NetworkInterface object to use created network") |
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.
Do we really need to create a NetworkInterface
for the peering test?
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.
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{ |
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.
func (r *NetworkReconciler) patchStatus(ctx context.Context, network *metalnetv1alpha1.Network, mutate func()) error { | ||
base := network.DeepCopy() | ||
|
||
mutate() |
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.
What is the purpose of this mutate()
function?
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.
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.
d42d42c
to
54a14b1
Compare
54a14b1
to
afabf60
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 to me now.
@afritzler Do you have smt to add ?
Proposed Changes
Fixes #189