mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 14:37:00 +00:00
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.
This commit is contained in:
parent
7377c5911a
commit
c423be11d5
@ -98,8 +98,11 @@ func NewCloudNodeController(
|
||||
nodeStatusUpdateFrequency: nodeStatusUpdateFrequency,
|
||||
}
|
||||
|
||||
nodeInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
|
||||
AddFunc: cnc.AddCloudNode,
|
||||
// Use shared informer to listen to add/update of nodes. Note that any nodes
|
||||
// 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
|
||||
@ -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
|
||||
func (cnc *CloudNodeController) AddCloudNode(obj interface{}) {
|
||||
node := obj.(*v1.Node)
|
||||
|
Loading…
Reference in New Issue
Block a user