Commit c423be11 authored by Davanum Srinivas's avatar Davanum Srinivas

Process existing cloud nodes in CCM

Existing nodes are sent via update and not via the add function, so let's add an UpdateCloudNode and just forward it to the AddCloudNode. This works fine as all we do is look for the cloud taint and bail out if it is not present.
parent 7377c591
...@@ -98,8 +98,11 @@ func NewCloudNodeController( ...@@ -98,8 +98,11 @@ func NewCloudNodeController(
nodeStatusUpdateFrequency: nodeStatusUpdateFrequency, nodeStatusUpdateFrequency: nodeStatusUpdateFrequency,
} }
nodeInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{ // Use shared informer to listen to add/update of nodes. Note that any nodes
AddFunc: cnc.AddCloudNode, // that exist before node controller starts will show up in the update method
cnc.nodeInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
AddFunc: cnc.AddCloudNode,
UpdateFunc: cnc.UpdateCloudNode,
}) })
return cnc return cnc
...@@ -277,6 +280,14 @@ func (cnc *CloudNodeController) MonitorNode() { ...@@ -277,6 +280,14 @@ func (cnc *CloudNodeController) MonitorNode() {
} }
} }
func (cnc *CloudNodeController) UpdateCloudNode(_, newObj interface{}) {
if _, ok := newObj.(*v1.Node); !ok {
utilruntime.HandleError(fmt.Errorf("unexpected object type: %v", newObj))
return
}
cnc.AddCloudNode(newObj)
}
// This processes nodes that were added into the cluster, and cloud initialize them if appropriate // This processes nodes that were added into the cluster, and cloud initialize them if appropriate
func (cnc *CloudNodeController) AddCloudNode(obj interface{}) { func (cnc *CloudNodeController) AddCloudNode(obj interface{}) {
node := obj.(*v1.Node) node := obj.(*v1.Node)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment