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

Openstack: Fix cluster floating ips #8115

Merged
merged 3 commits into from
Dec 18, 2019

Conversation

mitch000001
Copy link
Contributor

This fixes an issue when we have multiple floating IPs which have the same virtual IPs but point to different networks.

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

Hi @mitch000001. 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 Dec 15, 2019
@zetaab
Copy link
Member

zetaab commented Dec 15, 2019

Could you please tell the use-case for this? This whole if loop should handle loadbalancer ip addresses, NOT instance addresses. What is the thing that is not working currently? I am just worrying that this PR will break things like using old neutron lbaas. Also I am not sure does this work with octavia either

@mitch000001
Copy link
Contributor Author

mitch000001 commented Dec 16, 2019

@zetaab The problem is that the current logic is connecting Floating IPs with Loadbalancers by their virtual IP. Having multiple networks with the same IP ranges in one project can lead to Loadbalancers having the same private IP they point to but within different networks. This fix mitigates that by using the Loadbalancer id stored within the FloatingIP

@mitch000001
Copy link
Contributor Author

Having said that, InstanceID refers to different things than you would expect, i.e. when connecting a server to a FloatingIP it refers to the server ID, when connecting a LoadBalancer to the FloatingIP, it refers to its ID.

@mitch000001
Copy link
Contributor Author

mitch000001 commented Dec 16, 2019

Another solution than the used one in this PR is to filter all LoadBalancers by their subnet/network to use the appropriate ones. I am also fine with that solution. In either way the current solution leads to bad side effects which we have to fix.

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 16, 2019
@mitch000001
Copy link
Contributor Author

@zetaab btw: we are using neutron loadbalancers. For them, this change is working fine. How it will behave on octavia I cannot tell.

@zetaab
Copy link
Member

zetaab commented Dec 16, 2019

ok I will test this tomorrow

@zetaab
Copy link
Member

zetaab commented Dec 16, 2019

/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 Dec 16, 2019
Copy link
Member

@zetaab zetaab left a comment

Choose a reason for hiding this comment

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

this does not work for octavia loadbalancers:

% ./kops export kubecfg --name xjxjjx.k8s.local -v 2

I1217 13:13:43.469803   59537 factory.go:68] state store do://kopstest
I1217 13:13:44.400841   59537 cloud.go:354] authenticating to keystone
I1217 13:13:44.883163   59537 cloud.go:458] Openstack using Octavia lbaasv2 api
I1217 13:13:44.883226   59537 cloud.go:632] Querying Openstack to find Loadbalancers for API ("xjxjjx.k8s.local")
W1217 13:13:47.152999   59537 create_kubecfg.go:76] Did not find API endpoint for gossip hostname; may not be able to reach cluster
kops has set your kubectl context to xjxjjx.k8s.local

without this change I can find the hostname and everything works like should

Added debug for that:

W1217 13:13:47.152801   59537 cloud.go:648] DEBUG3 dbab1a38-faa5-49df-98bc-f638d057a96f lb-dbab1a38-faa5-49df-98bc-f638d057a96f

So when lb.ID is dbab1a38-faa5-49df-98bc-f638d057a96f the fip.InstanceID is lb-dbab1a38-faa5-49df-98bc-f638d057a96f so the floatingip instanceid contains prefix lb- which should be ignored in case of octavia

@mitch000001
Copy link
Contributor Author

mitch000001 commented Dec 17, 2019

this does not work for octavia loadbalancers:
...
So when lb.ID is dbab1a38-faa5-49df-98bc-f638d057a96f the fip.InstanceID is lb-dbab1a38-faa5-49df-98bc-f638d057a96f so the floatingip instanceid contains prefix lb- which should be ignored in case of octavia

Given that fact I would propose another way of implementing it. The problem currently for us is that there are IP clashes between LoadBalancers. So if we add a filter for the loadbalancer to make sure it is originating from the proper subnet/network we should be able to leave the implementation with IP addresses as is.

@mitch000001
Copy link
Contributor Author

Given that fact I would propose another way of implementing it. The problem currently for us is that there are IP clashes between LoadBalancers. So if we add a filter for the loadbalancer to make sure it is originating from the proper subnet/network we should be able to leave the implementation with IP addresses as is.

Thinking more about it the just proposed solution does not work, because we iterate over FloatingIPs and there is the problem of identification, not at the LoadBalancer side. So in oder to get it working we have to use the prefix strip approach, although it is not pleasing to me and feels brittle.

@mitch000001
Copy link
Contributor Author

I will try to use parts of the implementation of https://github.com/kubernetes/kops/blob/master/upup/pkg/fi/cloudup/openstacktasks/floatingip.go#L85-L121 where we already connect LoadBalancers and FloatingIPs. Possibly a good idea to reuse knowledge.

@k8s-ci-robot k8s-ci-robot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Dec 18, 2019
@mitch000001
Copy link
Contributor Author

/retest

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Dec 18, 2019
Copy link
Member

@zetaab zetaab left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mitch000001, zetaab

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 Dec 18, 2019
@mitch000001
Copy link
Contributor Author

/test pull-kops-verify-govet
/test pull-kops-verify-gofmt

@k8s-ci-robot k8s-ci-robot merged commit 42867a8 into kubernetes:master Dec 18, 2019
@mitch000001 mitch000001 deleted the fix-cluster-floating-ips branch December 18, 2019 10:48
k8s-ci-robot added a commit that referenced this pull request Dec 18, 2019
…115-origin-release-1.16

Automated cherry pick of #8115 Openstack: Fix cluster floating ips
k8s-ci-robot added a commit that referenced this pull request Dec 19, 2019
…115-origin-release-1.15

Automated cherry pick of #8115 Openstack: Fix cluster floating ips
k8s-ci-robot added a commit that referenced this pull request Dec 24, 2019
…115-origin-release-1.17

Automated cherry pick of #8115 origin release 1.17
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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants