-
Notifications
You must be signed in to change notification settings - Fork 298
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
Query NEGs from Svcneg when linking BackendServices. #2615
Query NEGs from Svcneg when linking BackendServices. #2615
Conversation
8c83a46
to
367f98e
Compare
/cc @mmamczur we are updating NEG linking logic, fyi |
22d9677
to
caa252c
Compare
caa252c
to
754f243
Compare
0dd1f1f
to
3c57dea
Compare
3c57dea
to
f7dc7a0
Compare
/retest |
f7dc7a0
to
b31266a
Compare
/assign |
* Query NEGs from Svcneg Status, and only do GCE query as a fallback. * If multi-subnet cluster is enabled, we will only link NEGs from the default subnet. We will try to add all NEGs once CRD is available.
b31266a
to
d9f9364
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.
Thanks @sawsa307. This all looks good to me.
Just one minor suggestion for test.
/lgtm
/hold (If you want approval from Swetha)
if err := linker.Link(svcPort, shrinkZone); err != nil { | ||
t.Fatalf("Failed to link backend service to NEG for svcPort %v: %v", svcPort, err) | ||
if err := linker.Link(tc.svcPort, shrinkZone); err != nil { | ||
t.Fatalf("Failed to link backend service to NEG for svcPort %v when populateSvcNeg = %v: %v", tc.svcPort, populateSvcNeg, err) | ||
} | ||
|
||
validate() |
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 think this second validate()
is trying to ensure that even if the Zones shrink, we don't remove the NEG from the BackendService.
With the new way of using SvcNEG for finding all the NEGs from all the zones, the previous "mimic'ing" part is not sufficiently "mimic'ing" the zone contraction. In addition to passing only zones[0], you may also need to update the existing SvcNEG with only one NegObjectReference, before calling this second validate()
.
(NOTE: I think it's also true that SvcNEGs would never be updated with such a zone contraction, but it's still nice to verify this behavior independently here)
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 so much Gaurav for pointing this out! It is a very subtle point that I haven't thought about.
We do need to update existing SvcNEG, but instead of remove one of the NegObjectReference, we should instead mark it as Inactive since this will match the expected behavior by NEG controller(Detailed in #2604, my apology that I haven't thought about this dependency).
In short, when NEG controller no longer observes nodes in a specific zone, it will mark the NEG ref in that zone as Inactive. This is to retain the NEG ref so we won't miss any NEGs during GC().
As a side effect, it would also introduce a small behavior change during zone contract. Previously/currently, we won't include NEGs from contracted zone in the Backend Service. With this PR, since we include NEGs in both Active and Inactive state, NEGs from contracted zone will present in the Backend Service. However, there shouldn't be any effect/issue since this situation is simply equivalent to the current behavior when there are nodes but no endpoints/pods in a specific zone.
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.
>Previously/currently, we won't include NEGs from contracted zone in the Backend Service.
Actually I think this is not the case, which means I don't think there's a behavior change -- even better :)
* Fixed an bug where svcNegLister.Add() return error is not check. Malformed SvcNeg struct results in an error during Add(), so there is no reference of SvcNeg in cache, and the test case isn't testing the expected behavior(querying NEG link from SvcNeg). * Add SvcNeg CR to all neg_linker test cases.
d9f9364
to
1f60070
Compare
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: gauravkghildiyal, sawsa307 The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/unhold |
/retest |
/assign @swetharepakula