Merge pull request #222 from GLYASAI/V3.7

[REV] ignore nil event object
This commit is contained in:
barnettZQG 2019-02-27 21:01:41 +08:00 committed by GitHub
commit f044eb24d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 0 deletions

View File

@ -271,6 +271,9 @@ func (m *manager) waitDeploymentReplicas(n int32, logger event.Logger, deploymen
logger.Error("实例关闭超时,请重试!", map[string]string{"step": "worker-appm", "status": "error"})
return ErrTimeOut
case event := <-watch.ResultChan():
if event.Object == nil {
continue
}
state := event.Object.(*v1beta1.Deployment)
logger.Info(fmt.Sprintf("实例正在关闭,当前应用实例数 %d", state.Status.Replicas), map[string]string{"step": "worker-appm"})
case event := <-podWatch.ResultChan():
@ -328,6 +331,9 @@ func (m *manager) waitDeploymentReplicasReady(n int32, serviceID string, logger
logger.Error("实例启动超时,置于后台启动,请留意应用状态", map[string]string{"step": "worker-appm", "status": "error"})
return ErrTimeOut
case event := <-watch.ResultChan():
if event.Object == nil {
continue
}
state := event.Object.(*v1beta1.Deployment)
logger.Info(fmt.Sprintf("实例正在启动,当前启动实例数 %d,未启动实例数 %d ", state.Status.Replicas, n-state.Status.Replicas), map[string]string{"step": "worker-appm"})
case event := <-podWatch.ResultChan():

View File

@ -592,6 +592,9 @@ func (m *manager) waitRCReplicas(n int32, logger event.Logger, rc *v1.Replicatio
logger.Error("实例关闭超时,请重试!", map[string]string{"step": "worker-appm", "status": "error"})
return ErrTimeOut
case event := <-watch.ResultChan():
if event.Object == nil {
continue
}
state := event.Object.(*v1.ReplicationController)
logger.Info(fmt.Sprintf("实例正在关闭,当前应用实例数 %d", state.Status.Replicas), map[string]string{"step": "worker-appm"})
case event := <-podWatch.ResultChan():

View File

@ -280,6 +280,9 @@ func (m *manager) waitStatefulReplicas(n int32, logger event.Logger, stateful *v
logger.Error("实例关闭超时,请重试!", map[string]string{"step": "worker-appm", "status": "error"})
return ErrTimeOut
case event := <-watch.ResultChan():
if event.Object == nil {
continue
}
state := event.Object.(*v1beta1.StatefulSet)
logger.Info(fmt.Sprintf("实例正在顺序关闭,当前应用实例数 %d", state.Status.Replicas), map[string]string{"step": "worker-appm"})
case event := <-podWatch.ResultChan():
@ -337,6 +340,9 @@ func (m *manager) waitStatefulReplicasReady(n int32, serviceID string, logger ev
logger.Error("实例启动超时,置于后台启动,请留意应用状态", map[string]string{"step": "worker-appm", "status": "error"})
return ErrTimeOut
case event := <-watch.ResultChan():
if event.Object == nil{
continue
}
state := event.Object.(*v1beta1.StatefulSet)
logger.Info(fmt.Sprintf("实例正在顺序启动,当前启动实例数 %d,未启动实例数 %d ", state.Status.Replicas, n-state.Status.Replicas), map[string]string{"step": "worker-appm"})
case event := <-podWatch.ResultChan():