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

Modify the NEG controller to also create NEGs for L4 External Load Ba… #2155

Merged
merged 1 commit into from
Jun 14, 2023

Conversation

mmamczur
Copy link
Contributor

…lancers that are using multinetworking.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 29, 2023
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 29, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @mmamczur. Thanks for your PR.

I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 29, 2023
@code-elinka
Copy link
Contributor

nit: modify the commit message:

image

Change NEG controller to support multinetwork

The NEG controller should create NEGs for the
L4 External Load Balancers that use multinetworking.

https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html

return false
}

if val, ok := service.Annotations[RBSAnnotationKey]; ok && val == RBSEnabled {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Do you want to add check for ok as well? Like it was done in func WantsL4NetLB(

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'm not sure what you mean, this code does check the ok variable: ok && val == RBSEnabled

I actually just copied an old function from netlb controller and use this one instead not to duplicate

Copy link
Contributor Author

Choose a reason for hiding this comment

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

but this reminded me that I forgot to remove the old function

Copy link
Contributor

Choose a reason for hiding this comment

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

I mean that maybe it's nice to return the error in case it is not ok.

Copy link
Contributor

Choose a reason for hiding this comment

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

But I don't have a strong opinion on it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not ok means the annotation is not present at all, which means the service doesn't have it, that isn't an error state

@mmamczur
Copy link
Contributor Author

nit: modify the commit message:
...

done

@@ -371,7 +372,7 @@ func runControllers(ctx *ingctx.ControllerContext) {
flags.F.NumNegGCWorkers,
flags.F.EnableReadinessReflector,
flags.F.RunIngressController,
flags.F.RunL4Controller,
flags.F.RunL4Controller || enableNEGsForNetLB,
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is it OR?

Copy link
Contributor

Choose a reason for hiding this comment

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

discussed offline: RunL4Controller is a name for Run Internal L4 Controller. Usually there is a naming:

  • just LB means internal
  • NetLB means external

Copy link
Member

Choose a reason for hiding this comment

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

Does that mean we do not support having ILB subsetting disabled when L4 Net LB negs is enabled?

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 think I forgot to hit send on the comment I wrote before

there is another check to see if the service is really subsetting. So it will be possible to have non subsetting ILBs and multinet at the same time (but legacy ILB won't support multinet so I see no point in doing that)

return true
}
return false
return annotations.HasRBSAnnotation(svc) || utils.HasL4NetLBFinalizerV2(svc) || lc.hasRBSForwardingRule(svc)
Copy link
Contributor

Choose a reason for hiding this comment

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

I know that this is not related to your change, but maybe you know why do we say that it's RBS if it has Netlb Finalizer? Or it is about the fact that it's Finalizer V2?

Copy link
Contributor

Choose a reason for hiding this comment

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

@cezarygerard Could you please elaborate on this logic?

Copy link
Contributor

@cezarygerard cezarygerard May 30, 2023

Choose a reason for hiding this comment

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

@code-elinka

this is just a bad naming

HasL4NetLBFinalizerV2 maybe it should be HasRBSFinalizer

@code-elinka
Copy link
Contributor

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels May 30, 2023
@@ -371,7 +372,7 @@ func runControllers(ctx *ingctx.ControllerContext) {
flags.F.NumNegGCWorkers,
flags.F.EnableReadinessReflector,
flags.F.RunIngressController,
flags.F.RunL4Controller,
flags.F.RunL4Controller || enableNEGsForNetLB,
Copy link
Member

Choose a reason for hiding this comment

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

Does that mean we do not support having ILB subsetting disabled when L4 Net LB negs is enabled?

if wantsILB, _ := annotations.WantsL4ILB(service); !wantsILB {
wantsILB, _ := annotations.WantsL4ILB(service)
wantsNetLB, _ := annotations.WantsL4NetLB(service)
needsNEGForNetLB := wantsNetLB && !networkInfo.IsDefault && annotations.HasRBSAnnotation(service)
Copy link
Member

Choose a reason for hiding this comment

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

does this mean we only support NEGs for NEGLB if using the non default network?

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
The reason for this is that NetLB NEG will not be GA when we preview this. With non multinet NetLB being GA, I don't think we can use backends that are not GA.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

as for the quetion about - subsetting, there is another check https://github.com/kubernetes/ingress-gce/pull/2155/files/813d3551b391e33b4a00a9bb1003555fad0b4ce8#diff-6fdd3264dcdaccfcfd6c0a41aee9fbf719529a11b24c94609de61b1f038306efR599 if wantsILB && !utils.IsSubsettingL4ILBService(service) - the controller will ignore the service if it isn't subsetting ILB

validateSyncerManagerWithPortInfoMap(t, controller, testServiceNamespace, testServiceName, expectedPortInfoMap)
validateServiceAnnotationWithPortInfoMap(t, svc, expectedPortInfoMap, expectZones)

time.Sleep(1 * time.Second)
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 sleep here for?

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 actually copied and modified an existing testcase (check line 414 in this file). I assume it has something to do with waiting before GC?

@swetharepakula
Copy link
Member

Mostly looks good to me. Just a few clarification questions

return true
}
return false
return annotations.HasRBSAnnotation(svc) || utils.HasL4NetLBFinalizerV2(svc) || lc.hasRBSForwardingRule(svc)
Copy link
Contributor

@cezarygerard cezarygerard May 30, 2023

Choose a reason for hiding this comment

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

@code-elinka

this is just a bad naming

HasL4NetLBFinalizerV2 maybe it should be HasRBSFinalizer

@@ -589,11 +589,14 @@ func (c *Controller) mergeStandaloneNEGsPortInfo(service *apiv1.Service, name ty

// mergeVmIpNEGsPortInfo merges the PortInfo for ILB services using GCE_VM_IP NEGs into portInfoMap
Copy link
Contributor

Choose a reason for hiding this comment

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

please update this comment

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is just bad naming

HasL4NetLBFinalizerV2 maybe it should be HasRBSFinalizer

I haven't touched this function actually, I only moved HasRBSAnnotation to another place

I can rename HasL4NetLBFinalizerV2 but it's not directly related to this change

Copy link
Contributor Author

Choose a reason for hiding this comment

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

please update this comment

updated

pkg/neg/controller_test.go Outdated Show resolved Hide resolved
@cezarygerard
Copy link
Contributor

it's LGTM overall from my side

The NEG controller should create NEGs for the
L4 External Load Balancers that use multinetworking.
@cezarygerard
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 14, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cezarygerard, mmamczur

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 14, 2023
@k8s-ci-robot k8s-ci-robot merged commit 6e5fafd into kubernetes:master Jun 14, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants