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

WIP: Implement migration from L4 Legacy Target Pool based services to L4 RBS #1721

Closed
wants to merge 4 commits into from

Conversation

panslava
Copy link
Contributor

  • Switch target of existing forwarding rule from target pool to regional
    backend service
  • Clean up GCP resources used only by legacy service: target pool,
    health checks, firewall rules for health checks

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 26, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @panslava. 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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 26, 2022
@k8s-ci-robot k8s-ci-robot requested a review from MrHohn May 26, 2022 15:03
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: panslava
To complete the pull request process, please assign mrhohn after the PR has been reviewed.
You can assign the PR to them by writing /assign @mrhohn in a comment when ready.

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

@k8s-ci-robot k8s-ci-robot requested a review from thockin May 26, 2022 15:03
@panslava panslava force-pushed the legacy-to-rbs-migration branch from 7fcc292 to cf60083 Compare May 26, 2022 15:05
Copy link
Contributor

@kl52752 kl52752 left a comment

Choose a reason for hiding this comment

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

I don't see and testcases for this feature.

pkg/l4lb/l4netlbcontroller.go Show resolved Hide resolved
pkg/l4lb/l4netlbcontroller.go Outdated Show resolved Hide resolved
@@ -452,6 +466,19 @@ func (l4netlb *L4NetLB) deleteForwardingRule(name string, version meta.Version)
}
}

// ConfigsEqual check if two forwarding rules are equal in configurations, except for backend targets
Copy link
Contributor

Choose a reason for hiding this comment

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

and description :)
For ILB and NetLB we have different "configs" if this function is only used by NetLB we can skip AllowGlobalAccess and Subnetwork checks (and changed the name to point to ExternalConfig)

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 used not only for NetLB, I just took a part of Equals(fr1, fr2) (which was used by both ILB, NetLB) and moved it to separate function, so Equals now still calls ConfigsEqual

pkg/loadbalancers/l4netlb.go Outdated Show resolved Hide resolved
pkg/loadbalancers/l4netlb.go Outdated Show resolved Hide resolved
pkg/utils/utils.go Outdated Show resolved Hide resolved
pkg/utils/utils.go Show resolved Hide resolved
@panslava panslava force-pushed the legacy-to-rbs-migration branch 5 times, most recently from d8188e6 to a0f8a02 Compare May 27, 2022 09:42
pkg/composite/composite.go Outdated Show resolved Hide resolved

// Check if we transition from Target Pool Legacy Service to RBS based one.
// If configs are not equal, we should delete forwarding rule and recreate.
if existingFwdRule.Target != "" && ConfigsEqual(fr, existingFwdRule) {
Copy link
Contributor

Choose a reason for hiding this comment

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

is this 'if' enought to identify transition from Target Pool Legacy Service to RBS based?

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 mostly business question, we can discuss it, but all the other functionality should stay pretty the same, so if needed we can change this condition

pkg/loadbalancers/forwarding_rules.go Outdated Show resolved Hide resolved
pkg/loadbalancers/forwarding_rules.go Outdated Show resolved Hide resolved
lbRefStr := fmt.Sprintf("%v(%v)", loadBalancerName, serviceName)

errs := utilerrors.AggregateGoroutines(
func() error {
Copy link
Contributor

Choose a reason for hiding this comment

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

plese used named functions

err := utils.IgnoreHTTPNotFound(l4netlb.cloud.DeleteFirewall(fwName))
return err
},
func() error {
Copy link
Contributor

Choose a reason for hiding this comment

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

plese used named functions

// They both use legacy naming scheme, so they are not useful for RBS service, and it is safe to delete them
healthChecksToDelete := []string{loadBalancerName, gce.MakeNodesHealthCheckName(l4netlb.namer.ClusterID())}

for _, hcToDelete := range healthChecksToDelete {
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. plese used named functions
  2. you can optimize this even furthrer by adding each HC deletion as one func in AggregateGoroutines
  3. wait for PR/1705 to be merged

)

func ensureFrontend(l4netlb *L4NetLB, nodeNames []string, svc *v1.Service) *L4NetLBSyncResult {
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. why do you need this?
  2. put int after TestXXX funcs

pkg/utils/utils.go Outdated Show resolved Hide resolved
@panslava panslava force-pushed the legacy-to-rbs-migration branch 2 times, most recently from 85344cc to 39f0c90 Compare May 27, 2022 10:51
@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 27, 2022
- create a common singleton-like struct fot l4 health checks
- new struct holds mutex for common resources (healthchecks and their firewall rules used for
- [bugfix] delete shared healtcheck firewall rules safely -  cross-check between ILB and NLB healthchecks is firewall rules are in use

Logging
New log line idicating firewall rule not deleted due to cross-check: "Failed to delete health check firewall rule %s: health check in use."

Testing
- healthcheck management is mostly covered (by existing tests), they required little update.
- added test cases for sahred firewall rule deletion(lack of), named TestHealthCheckFirewallDeletionWithILB and TestHealthCheckFirewallDeletionWithNetLB
- run test manual tests
@panslava
Copy link
Contributor Author

Rebased on this #1705 , waiting to be merged

@panslava panslava force-pushed the legacy-to-rbs-migration branch 4 times, most recently from cf109d6 to 6400ba5 Compare May 30, 2022 13:23
@kl52752
Copy link
Contributor

kl52752 commented May 31, 2022

/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 31, 2022
EnsureL4HealthCheck: replace lengthy return value list in with named struct
Improve firewall rule comparison
Added debug logs
Improved go fmt
Renamed function names
And many more small ones
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 31, 2022
@k8s-ci-robot
Copy link
Contributor

@panslava: PR needs rebase.

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.

@panslava panslava force-pushed the legacy-to-rbs-migration branch from 6400ba5 to 05c7fd9 Compare June 1, 2022 08:40
panslava added 2 commits June 1, 2022 17:17
- Switch target of existing forwarding rule from target pool to regional
  backend service
- Clean up GCP resources used only by legacy service: target pool,
  health checks, firewall rules for health checks
@panslava panslava force-pushed the legacy-to-rbs-migration branch from 05c7fd9 to e7cb75c Compare June 2, 2022 08:33
@k8s-ci-robot
Copy link
Contributor

@panslava: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-ingress-gce-test e7cb75c link true /test pull-ingress-gce-test

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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. I understand the commands that are listed here.

@panslava panslava changed the title Implement migration from L4 Legacy Target Pool based services to L4 RBS WIP: Implement migration from L4 Legacy Target Pool based services to L4 RBS Jun 3, 2022
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 3, 2022
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Sep 1, 2022
@panslava panslava closed this Sep 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants