mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-29 06:27:05 +00:00
Merge pull request #63852 from hzxuzhonghu/node-controller-run-with-stopch
Automatic merge from submit-queue. If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. pass stop channel to node-controller node controller run with stop channel passed from outside. **Release note**: ```release-note NONE ```
This commit is contained in:
commit
e3b0e85138
@ -216,13 +216,12 @@ func startControllers(c *cloudcontrollerconfig.CompletedConfig, rootClientBuilde
|
|||||||
c.Generic.ComponentConfig.KubeCloudShared.NodeMonitorPeriod.Duration,
|
c.Generic.ComponentConfig.KubeCloudShared.NodeMonitorPeriod.Duration,
|
||||||
c.Extra.NodeStatusUpdateFrequency)
|
c.Extra.NodeStatusUpdateFrequency)
|
||||||
|
|
||||||
nodeController.Run()
|
nodeController.Run(stop)
|
||||||
time.Sleep(wait.Jitter(c.Generic.ComponentConfig.GenericComponent.ControllerStartInterval.Duration, ControllerStartJitter))
|
time.Sleep(wait.Jitter(c.Generic.ComponentConfig.GenericComponent.ControllerStartInterval.Duration, ControllerStartJitter))
|
||||||
|
|
||||||
// Start the PersistentVolumeLabelController
|
// Start the PersistentVolumeLabelController
|
||||||
pvlController := cloudcontrollers.NewPersistentVolumeLabelController(client("pvl-controller"), cloud)
|
pvlController := cloudcontrollers.NewPersistentVolumeLabelController(client("pvl-controller"), cloud)
|
||||||
threads := 5
|
go pvlController.Run(5, stop)
|
||||||
go pvlController.Run(threads, stop)
|
|
||||||
time.Sleep(wait.Jitter(c.Generic.ComponentConfig.GenericComponent.ControllerStartInterval.Duration, ControllerStartJitter))
|
time.Sleep(wait.Jitter(c.Generic.ComponentConfig.GenericComponent.ControllerStartInterval.Duration, ControllerStartJitter))
|
||||||
|
|
||||||
// Start the service controller
|
// Start the service controller
|
||||||
|
@ -112,7 +112,7 @@ func NewCloudNodeController(
|
|||||||
|
|
||||||
// This controller deletes a node if kubelet is not reporting
|
// This controller deletes a node if kubelet is not reporting
|
||||||
// and the node is gone from the cloud provider.
|
// and the node is gone from the cloud provider.
|
||||||
func (cnc *CloudNodeController) Run() {
|
func (cnc *CloudNodeController) Run(stopCh <-chan struct{}) {
|
||||||
defer utilruntime.HandleCrash()
|
defer utilruntime.HandleCrash()
|
||||||
|
|
||||||
// The following loops run communicate with the APIServer with a worst case complexity
|
// The following loops run communicate with the APIServer with a worst case complexity
|
||||||
@ -120,10 +120,10 @@ func (cnc *CloudNodeController) Run() {
|
|||||||
// very infrequently. DO NOT MODIFY this to perform frequent operations.
|
// very infrequently. DO NOT MODIFY this to perform frequent operations.
|
||||||
|
|
||||||
// Start a loop to periodically update the node addresses obtained from the cloud
|
// Start a loop to periodically update the node addresses obtained from the cloud
|
||||||
go wait.Until(cnc.UpdateNodeStatus, cnc.nodeStatusUpdateFrequency, wait.NeverStop)
|
go wait.Until(cnc.UpdateNodeStatus, cnc.nodeStatusUpdateFrequency, stopCh)
|
||||||
|
|
||||||
// Start a loop to periodically check if any nodes have been deleted from cloudprovider
|
// Start a loop to periodically check if any nodes have been deleted from cloudprovider
|
||||||
go wait.Until(cnc.MonitorNode, cnc.nodeMonitorPeriod, wait.NeverStop)
|
go wait.Until(cnc.MonitorNode, cnc.nodeMonitorPeriod, stopCh)
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateNodeStatus updates the node status, such as node addresses
|
// UpdateNodeStatus updates the node status, such as node addresses
|
||||||
|
@ -252,7 +252,7 @@ func TestNodeShutdown(t *testing.T) {
|
|||||||
}
|
}
|
||||||
eventBroadcaster.StartLogging(glog.Infof)
|
eventBroadcaster.StartLogging(glog.Infof)
|
||||||
|
|
||||||
cloudNodeController.Run()
|
cloudNodeController.Run(wait.NeverStop)
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-fnh.PatchWaitChan:
|
case <-fnh.PatchWaitChan:
|
||||||
@ -351,7 +351,7 @@ func TestNodeDeleted(t *testing.T) {
|
|||||||
}
|
}
|
||||||
eventBroadcaster.StartLogging(glog.Infof)
|
eventBroadcaster.StartLogging(glog.Infof)
|
||||||
|
|
||||||
cloudNodeController.Run()
|
cloudNodeController.Run(wait.NeverStop)
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-fnh.DeleteWaitChan:
|
case <-fnh.DeleteWaitChan:
|
||||||
@ -768,7 +768,7 @@ func TestNodeAddresses(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
cloudNodeController.Run()
|
cloudNodeController.Run(wait.NeverStop)
|
||||||
|
|
||||||
<-time.After(2 * time.Second)
|
<-time.After(2 * time.Second)
|
||||||
|
|
||||||
@ -872,7 +872,7 @@ func TestNodeProvidedIPAddresses(t *testing.T) {
|
|||||||
assert.Equal(t, "node0", fnh.UpdatedNodes[0].Name, "Node was not updated")
|
assert.Equal(t, "node0", fnh.UpdatedNodes[0].Name, "Node was not updated")
|
||||||
assert.Equal(t, 3, len(fnh.UpdatedNodes[0].Status.Addresses), "Node status unexpectedly updated")
|
assert.Equal(t, 3, len(fnh.UpdatedNodes[0].Status.Addresses), "Node status unexpectedly updated")
|
||||||
|
|
||||||
cloudNodeController.Run()
|
cloudNodeController.Run(wait.NeverStop)
|
||||||
|
|
||||||
<-time.After(2 * time.Second)
|
<-time.After(2 * time.Second)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user