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

use existing network and subnet in OpenStack #7699

Merged
merged 2 commits into from Oct 27, 2019

Conversation

zetaab
Copy link
Member

@zetaab zetaab commented Sep 28, 2019

It is now possible to use existing OpenStack project network by specifying --os-network when creating cluster. More info in documentation section

There is experimental feature to use existing network and subnets in OpenStack project. When you create new cluster you can specify flag --subnets and it will then use existing subnet. There is similar flag for utility subnets --utility-subnets .

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 28, 2019
@k8s-ci-robot k8s-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Sep 28, 2019
@zetaab zetaab changed the title use existing network and subnet use existing network and subnet in OpenStack Sep 28, 2019
@zetaab zetaab force-pushed the existnetandsubnet branch 2 times, most recently from b69c9f8 to 4f8b605 Compare September 28, 2019 09:09
@zetaab
Copy link
Member Author

zetaab commented Sep 28, 2019

@mitch000001 I combined both network and subnet PRs and rebased against master. Could you review this PR

@zetaab
Copy link
Member Author

zetaab commented Sep 28, 2019

/test pull-kops-e2e-kubernetes-aws

@zetaab
Copy link
Member Author

zetaab commented Sep 28, 2019

W0928 10:39:16.189] error running tasks: deadline exceeded executing task VPC/e2e-a3de3751a9-ff1eb.test-cncf-aws.k8s.io. Example error: error creating VPC: VpcLimitExceeded: The maximum number of VPCs has been reached.

aws test will fail to error like that

@zetaab
Copy link
Member Author

zetaab commented Sep 28, 2019

/test pull-kops-e2e-kubernetes-aws

return err
if len(c.Zones) > 0 && len(c.UtilitySubnetIDs) > 0 {
if api.CloudProviderID(cluster.Spec.CloudProvider) == api.CloudProviderAWS {
zoneToSubnetProviderID, err = getZoneToSubnetProviderID(cluster.Spec.NetworkID, c.Zones[0][:len(c.Zones[0])-1], c.UtilitySubnetIDs)
Copy link
Member

Choose a reason for hiding this comment

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

Nit: we should probably put the word aws in getZoneToSubnetProviderIDandOpenstack in getSubnetProviderID

upup/pkg/fi/cloudup/openstack/cloud.go Outdated Show resolved Hide resolved
}

for index, subnet := range subnets {
zone := c.zones[int(index)%len(c.zones)]
Copy link
Member

Choose a reason for hiding this comment

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

This seems fragile - should c.zones be a map?

Copy link
Member Author

@zetaab zetaab Sep 30, 2019

Choose a reason for hiding this comment

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

this is similar logic that we have in https://github.com/kubernetes/kops/blob/master/pkg/model/openstackmodel/servergroup.go#L99 or https://github.com/kubernetes/kops/blob/master/pkg/model/openstackmodel/servergroup.go#L109

the problem is that in openstack the subnet does not have any relation to zones

Copy link
Contributor

Choose a reason for hiding this comment

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

I kind of like the idea mapping the zones and the subnets. Possibly according to Cluster.Spec.Subnets as there are already zones in it.
Another option is to annotate the zones onto the subnets (also via tags?).

@justinsb
Copy link
Member

A few nits, but otherwise LGTM

You have a conflict though :-(

Does this need to make 1.14?

@zetaab
Copy link
Member Author

zetaab commented Sep 30, 2019

I think we should not put this to 1.14 or even 1.15. It is quite big change and I would like to see this going through alpha and beta stages before stable. Also this is going to have many conflicts if we cherry-pick this to 1.15.

So I would say kops 1.16 alpha 1 is first release which contains this PR.

@zetaab
Copy link
Member Author

zetaab commented Oct 4, 2019

/test pull-kops-verify-bazel

@zetaab
Copy link
Member Author

zetaab commented Oct 4, 2019

@justinsb friendly ping :) I have solved now quite many conflicts

@zetaab zetaab requested a review from justinsb October 8, 2019 18:45
@zetaab
Copy link
Member Author

zetaab commented Oct 11, 2019

/test pull-kops-verify-generated

@zetaab
Copy link
Member Author

zetaab commented Oct 11, 2019

@justinsb could you check this. I would like to see this in 1.16 alpha 1

cmd/kops/create_cluster.go Show resolved Hide resolved
pkg/model/openstackmodel/context.go Show resolved Hide resolved
pkg/model/openstackmodel/network.go Show resolved Hide resolved
}

if needRouter {
Copy link
Contributor

Choose a reason for hiding this comment

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

And we could even check if there is a router already. But the main question is if the router is connected to the internet, because that is normally why we want to have it in the first place.

var err error
for _, sp := range b.Cluster.Spec.Subnets {
if sp.Type == kops.SubnetTypePrivate {
lbSubnetName, err = b.findSubnetNameByID(sp.ProviderID, sp.Name)
Copy link
Contributor

Choose a reason for hiding this comment

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

So, previously we used one subnet of the masters, but now we just use one subnet independent if there are masters in there or not?

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, if you have better ideas how to do it. Feel free to say

pkg/resources/openstack/lb.go Show resolved Hide resolved
pkg/resources/openstack/lb.go Show resolved Hide resolved
pkg/resources/openstack/network.go Show resolved Hide resolved
pkg/resources/openstack/network.go Show resolved Hide resolved
}

for index, subnet := range subnets {
zone := c.zones[int(index)%len(c.zones)]
Copy link
Contributor

Choose a reason for hiding this comment

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

I kind of like the idea mapping the zones and the subnets. Possibly according to Cluster.Spec.Subnets as there are already zones in it.
Another option is to annotate the zones onto the subnets (also via tags?).

@zetaab
Copy link
Member Author

zetaab commented Oct 21, 2019

@mikesplain @justinsb ping, could you check this

@justinsb
Copy link
Member

I think this looks good - let's get it into 1.16.0-alpha.1 :-)

/approve
/lgtm

@k8s-ci-robot k8s-ci-robot added lgtm "Looks good to me", indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Oct 26, 2019
@justinsb
Copy link
Member

I don't think I can resolve the merge conflict though :-( - do you mind rebasing @zetaab ?

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 27, 2019
@justinsb
Copy link
Member

Thanks @zetaab

/approve
/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 27, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: justinsb, 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 merged commit 1c37a32 into kubernetes:master Oct 27, 2019
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/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants