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

Reserve ILB IP address before deleting FR on protocol change #1839

Merged

Conversation

panslava
Copy link
Contributor

@panslava panslava commented Oct 18, 2022

This fixes a bug, which could result in losing ip address. On Service Protocol change, we delete forwarding rule before changing Backend Service. But we didn't reserve address before forwarding rule rule deletion, so after deleting forwarding rule, this address could be reserved from some other place.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Oct 18, 2022
@k8s-ci-robot k8s-ci-robot requested review from bowei and freehan October 18, 2022 09:42
@k8s-ci-robot k8s-ci-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Oct 18, 2022
@aojea
Copy link
Member

aojea commented Oct 19, 2022

no tests?

@panslava
Copy link
Contributor Author

it's hard, maybe, I need to add a hook for fake gce, and check on forwarding rule deletion, that address of the forwarding rule is reserved

@aojea
Copy link
Member

aojea commented Oct 20, 2022

it's hard, maybe, I need to add a hook for fake gce, and check on forwarding rule deletion, that address of the forwarding rule is reserved

and an e2e instead?

@cezarygerard
Copy link
Contributor

there is a line of code in thatd does not follow the best practices:
pkg/loadbalancers/forwarding_rules.go:ensureForwardingRule

	equal, err := Equal(existingFwdRule, fr)
	if err != nil {
		return existingFwdRule, err
	}

please change it to

	equal, err := Equal(existingFwdRule, fr)
	if err != nil {
		return nil, err
	}

@cezarygerard
Copy link
Contributor

Please also add the unit test for address reservation

@panslava panslava force-pushed the reserve-address-in-the-beggining branch 2 times, most recently from ca0609d to 0e2b1f4 Compare October 20, 2022 14:54
@panslava
Copy link
Contributor Author

Added unit tests, with adding hook on forwarding rule deletion which checks that address is reserved before deletion

This fixes a bug, which could result in losing ip address.
On Service Protocol change, we delete forwarding rule before changing
Backend Service. But we didn't reserve address before forwrading rule
rule deletion, so after deleting forwarding rule, this address could be reserved from some other place.
@panslava panslava force-pushed the reserve-address-in-the-beggining branch from 0e2b1f4 to 0cd469a Compare October 20, 2022 15:02
@panslava
Copy link
Contributor Author

And btw, the added code in unit tests is failing on master, as expected

@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 Oct 20, 2022
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

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

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:
  • OWNERS [cezarygerard,panslava]

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 merged commit 3285151 into kubernetes:master Oct 20, 2022
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. 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.

4 participants