-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Minimize direct API calls in SDN master by using informer cache #18911
Minimize direct API calls in SDN master by using informer cache #18911
Conversation
@openshift/sig-networking PTAL |
/retest |
What is this commit doing? |
This seems completely independent of everything else, and needs a pkg/cmd approver, so you probably should split it into a separate PR |
- Currently, we need to pass all allocated subnets during subnet allocator creation time (inUse arg to NewSubnetAllocator()). This means we need to know all existing subnets beforehand. - This change exposes additional method so that we can mark a specific subnet as already allocated dynamically (after the subnet allocated is created). Precursor for openshift#18911
- Currently, we need to pass all allocated subnets during subnet allocator creation time (inUse arg to NewSubnetAllocator()). This means we need to know all existing subnets beforehand. - This change exposes additional method so that we can mark a specific subnet as already allocated dynamically (after the subnet allocator is created). Precursor for openshift#18911
On Fri, Mar 9, 2018 at 11:01 AM, Dan Winship ***@***.***> wrote:
Allow allocator to mark assigned subnet
What is this commit doing?
Added more details in #18999 which
needs pkg/util approver
… —
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#18911 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABM0hp403dEGjFGSW26RsKO4sx7Iq7jvks5tctGCgaJpZM4SjueJ>
.
|
On Fri, Mar 9, 2018 at 11:12 AM, Dan Winship ***@***.***> wrote:
Use existing network informers from openshift controller context
This seems completely independent of everything else, and needs a pkg/cmd
approver, so you probably should split it into a separate PR
Created #18998
… —
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#18911 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABM0hg4Bw48_AMw59X0BDYAV7e5A9SE7ks5tctQtgaJpZM4SjueJ>
.
|
- Currently, we need to pass all allocated subnets during subnet allocator creation time (inUse arg to NewSubnetAllocator()). This means we need to know all existing subnets beforehand. - This change exposes additional method so that we can mark a specific subnet as already allocated dynamically (after the subnet allocator is created). Precursor for openshift#18911
- Currently, we need to pass all allocated subnets during subnet allocator creation time (inUse arg to NewSubnetAllocator()). This means we need to know all existing subnets beforehand. - This change exposes additional method so that we can mark a specific subnet as already allocated dynamically (after the subnet allocator is created). Precursor for openshift#18911
Automatic merge from submit-queue (batch tested with PRs 18999, 18543). Allow subnet allocator to mark assigned subnet dynamically - Moved subnet allocator from pkg/util/netutils to pkg/network/master Subnet allocator is specific to SDN master and not used anywhere. - Currently, we need to pass all allocated subnets during subnet allocator creation time (inUse arg to NewSubnetAllocator()). This means we need to know all existing subnets beforehand. - This change exposes additional method so that we can mark a specific subnet as already allocated dynamically (after the subnet allocator is created). Precursor for #18911
02ecfac
to
5920c3c
Compare
5920c3c
to
9be3468
Compare
dependent prs got merged, now this is ready for review/merge |
} | ||
|
||
func (master *OsdnMaster) handleDeleteNode(obj interface{}) { | ||
node := obj.(*kapi.Node) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need the "Tombstone" pattern here? eg
ns, ok := obj.(*kapi.Namespace)
if !ok {
tombstone, ok := obj.(cache.DeletedFinalStateUnknown)
if !ok {
logrus.Errorf("couldn't get object from tombstone %+v", obj)
return
}
ns, ok = tombstone.Obj.(*kapi.Namespace)
if !ok {
logrus.Errorf("tombstone contained object that is not a namespace %#v", obj)
return
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, 'Tombstone' pattern is already handled in InformerFuncs()
https://github.com/pravisankar/origin/blob/c367802e15a6070aefe9ca83823153da9b31be96/pkg/network/master/subnets.go#L45
https://github.com/pravisankar/origin/blob/c367802e15a6070aefe9ca83823153da9b31be96/pkg/network/common/informers.go#L27
/retest |
pkg/network/master/master.go
Outdated
|
||
func (master *OsdnMaster) startSubSystems(pluginName string) { | ||
if err := master.SubnetStartMaster(master.networkInfo.ClusterNetworks); err != nil { | ||
panic(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
glog.Fatalf
(likewise below and in other commits)
pkg/network/master/vnids.go
Outdated
@@ -77,26 +75,17 @@ func (vmap *masterVNIDMap) isAdminNamespace(nsName string) bool { | |||
return false | |||
} | |||
|
|||
func (vmap *masterVNIDMap) populateVNIDs(netNamespaceInformer networkinformers.NetNamespaceInformer) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This patch doesn't work. You're removing the initial bulk NetNamespace->netIDManager initialization, but there isn't any lazy NetNamespace->netIDManager initialization anywhere, so it will never learn the existing namespace->VNID mappings. So when you start up the master the second time, it will see Namespace Added events for each pre-existing Namespace, and it will call assignVNID, which will call allocateNetID, which will call getVNID to see if the Namespace is already known, but it's not already known, so that will return !found, and so then allocateNetID will call vmap.netIDManager.AllocateNext() to allocate a new VNID, then try to Create a NetNamespace object with that VNID, fail because the NetNamespace already exists, and then log an error.
Even if you updated handleAddOrUpdateNetNamespace to do the right thing, you'd still have to deal with the fact that you don't know if you're going to see Namespace "foo" or NetNamespace "foo" first. So I think basically you can't get rid of populateVNIDs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed, initializing vnid allocator is done in 00bf4a7
/lol |
pkg/network/master/master.go
Outdated
go master.startSubSystems(networkConfig.NetworkPluginName) | ||
|
||
return nil | ||
} | ||
|
||
func (master *OsdnMaster) initSubSystems() error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no reason this has to be a separate function, is there? You could just as easily call initSubnetMaster() at the start of startSubSystems().
Actually is there even any reason left at this point for separate init and start methods? It's true that we do that in some other files but that's usually because the start method does things we don't want to do from unit tests. But there are no unit tests of these files (and the init method does things we probably wouldn't want done from unit tests as well anyway).
Same comment applies to vnid code
- Move HostSubnet reconciliation inside watchSubnets() which will help us to detect and fix issues sooner and not during next restart. - Move host IP validations for existing subnets inside watchSubnets() Subnet watch gets both existing and new subnets and this avoids duplicate host IP validations. - Now we do not need to call release subnet in all the cluster networks.
- Removed inUse arg to newSubnetAllocator (no longer used) - Renamed method names
d2baa57
to
ae0f3e1
Compare
@danwinship PTAL |
/retest |
/test gcp |
/test extended_networking |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: danwinship, pravisankar 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 |
/hold |
extended_networking tests passed |
- Currently, we need to pass all allocated subnets during subnet allocator creation time (inUse arg to NewSubnetAllocator()). This means we need to know all existing subnets beforehand. - This change exposes additional method so that we can mark a specific subnet as already allocated dynamically (after the subnet allocator is created). Precursor for openshift/origin#18911
https://trello.com/c/Uifetuz3/597-5-minimize-direct-api-calls-in-sdn-using-shared-informers